/* ==========================================================================
   kristileka.dev
   Text-first. Paper, ink, one accent, hairline rules. No gradients, no glow,
   no cards, no motion — the page should read like something a person wrote.
   ========================================================================== */

:root {
  --paper:    #fbfaf7;
  --paper-2:  #f4f1ea;
  --ink:      #1c1b19;
  --ink-2:    #55524c;
  --ink-3:    #8a867d;
  --rule:     #e0dcd3;
  --accent:   #8f3a24;

  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --measure: 34rem;
  --gutter: clamp(1.5rem, 5vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:   #1a1917;
    --paper-2: #232120;
    --ink:     #e9e5dc;
    --ink-2:   #a8a397;
    --ink-3:   #7c786f;
    --rule:    #343029;
    --accent:  #d9856a;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.62;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (min-width: 40em) { body { font-size: 1.125rem; } }

img, svg, iframe { max-width: 100%; display: block; }

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.2; letter-spacing: -0.011em; }

p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: inherit; }

/* Mono runs large next to a serif at the same nominal size */
code { font-family: var(--mono); font-size: 0.88em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* --- Shell ---------------------------------------------------------------- */

.page {
  max-width: 48rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The travel page is a picture wall — it earns the extra width. Prose inside
   it stays pinned to --measure, so only the images spread. */
.page--wide { max-width: 62rem; }

.skip-link {
  position: absolute;
  left: -9999px;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
}
.skip-link:focus { left: 0; top: 0; z-index: 10; }

/* --- Masthead ------------------------------------------------------------- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 2.25rem 1.1rem;
  border-bottom: 1px solid var(--rule);
}

.masthead__name {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.005em;
}

.masthead__name a { text-decoration: none; }

.masthead nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-2);
}

/* padding-block, not just padding-bottom: at 13px these links are ~21px tall,
   under the 24px minimum comfortable tap target on a phone. */
.masthead nav a {
  text-decoration: none;
  padding-block: 0.28rem;
  border-bottom: 1px solid transparent;
}

.masthead nav a:hover { color: var(--ink); border-bottom-color: var(--ink-3); }
.masthead nav a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--accent); }

/* --- Intro ---------------------------------------------------------------- */

.intro { padding-block: clamp(2.75rem, 7vw, 4.25rem) 0; }

.intro h1 {
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
  margin-bottom: 0.85rem;
}

.intro__role {
  font-family: var(--sans);
  font-size: 0.9375rem;
  color: var(--ink-2);
  margin-bottom: 1.5rem;
}

.intro p + p { margin-top: 1rem; }

.intro__body { max-width: var(--measure); }

/* --- Sections ------------------------------------------------------------- */

.section { padding-block: clamp(2.5rem, 6vw, 3.5rem) 0; }

.section__label {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 1.75rem;
}

/* --- Projects ------------------------------------------------------------- */

.project {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 0.4rem 2rem;
  padding-block: 1.9rem;
  border-top: 1px solid var(--rule);
}

.project:last-of-type { border-bottom: 1px solid var(--rule); }

.project__role {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 0.55rem;
}

.project h2 {
  font-size: 1.5rem;
  margin-bottom: 0.55rem;
}

.project__body { max-width: var(--measure); color: var(--ink-2); }
.project__body strong { color: var(--ink); font-weight: 600; }

.project__meta {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
}

.project__stack { color: var(--ink-3); }

.repo {
  display: inline-block;
  padding-block: 0.28rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.repo:hover { text-decoration-style: solid; }

@media (max-width: 40em) {
  .project { grid-template-columns: 1fr; gap: 0.3rem; }
  .project__role { padding-top: 0; order: -1; }
}

/* --- Plain prose blocks --------------------------------------------------- */

.note { max-width: var(--measure); color: var(--ink-2); }
.note strong { color: var(--ink); font-weight: 600; }

.note a, .intro__body a, .footer a, .gallery-intro a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* --- Footer --------------------------------------------------------------- */

.footer {
  margin-top: clamp(3rem, 8vw, 4.5rem);
  padding-block: 1.4rem 3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
}

.footer ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.footer ul a { display: inline-block; padding-block: 0.3rem; }

/* --- Travel: destinations ------------------------------------------------- */

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.55rem;
  margin-top: 2.5rem;
  padding-block: 0.9rem;
  border-block: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8125rem;
}

/* Padding on both axes: "Me" is barely 20px wide as bare text, under the
   minimum tap size. The column gap is reduced to keep the visual rhythm. */
.jump a {
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding: 0.3rem;
}
.jump a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.place { padding-top: clamp(2.25rem, 5vw, 3rem); scroll-margin-top: 1.5rem; }

.place__name { font-size: 1.35rem; margin-bottom: 0.3rem; }

.place__blurb {
  max-width: var(--measure);
  margin-bottom: 1.25rem;
  color: var(--ink-2);
}

/* --- Travel: films -------------------------------------------------------
   Covers are self-hosted; the Instagram embed only loads on click.

   The posts are a mix of 9:16 reels, 4:5 stills and a couple of landscapes.
   3:4 is the compromise crop that costs the portrait ones least; the
   landscapes are marked `is-wide` at build time and span two columns instead,
   because centre-cropping them to a portrait tile would throw the frame away. */

/* 9rem, not 10rem: at 10rem a 375px phone fits only one track and the wall
   collapses to one image per row. 9rem keeps two columns down there and still
   resolves to five on a full-width desktop. */
.reels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr));
  grid-auto-flow: dense;
  gap: 0.75rem;
}

.reel {
  position: relative;
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  text-decoration: none;
}

.reels .is-wide { grid-column: span 2; }
.reels .is-wide .reel { aspect-ratio: 3 / 2; }

@media (max-width: 34em) {
  .reels .is-wide { grid-column: span 1; }
  .reels .is-wide .reel { aspect-ratio: 3 / 4; }
}

.reel img { width: 100%; height: 100%; object-fit: cover; }

.reel__badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(20, 18, 16, 0.5);
  color: #fff;
}

.reel__badge svg { width: 0.72rem; height: 0.72rem; }

.reel__caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2rem 0.7rem 0.6rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.35;
  color: #fff;
  background: linear-gradient(transparent, rgba(18, 16, 14, 0.82));
}

.reel__caption em {
  display: block;
  font-style: normal;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.72);
}

.reel:hover .reel__caption { background: linear-gradient(transparent, rgba(18, 16, 14, 0.92)); }

/* --- Travel: stills ------------------------------------------------------- */

.gallery-intro { max-width: var(--measure); color: var(--ink-2); margin-bottom: 1.75rem; }

.gallery {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
}

.shot {
  position: relative;
  margin: 0;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.shot--wide { grid-column: span 2; aspect-ratio: 2 / 1; }
@media (max-width: 34em) { .shot--wide { grid-column: span 1; aspect-ratio: 4 / 3; } }

.shot img { width: 100%; height: 100%; object-fit: cover; }

.shot__btn {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}

.shot figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.5rem 0.7rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: #fff;
  background: rgba(20, 18, 16, 0.72);
  pointer-events: none;
}

/* Empty slot until real photographs are dropped in */
.shot--empty {
  display: grid;
  place-items: center;
  border-style: dashed;
}

.shot--empty span {
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* --- Lightbox ------------------------------------------------------------- */

.lightbox {
  border: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  background: transparent;
}

.lightbox::backdrop { background: rgba(16, 15, 13, 0.93); }

.lightbox__inner {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: clamp(1rem, 4vw, 2.5rem);
}

.lightbox img { max-width: 100%; max-height: 84vh; width: auto; }

.lightbox iframe {
  width: min(400px, 92vw);
  height: min(720px, 86vh);
  border: 0;
  background: var(--paper);
}

.lightbox__caption {
  margin-top: 0.9rem;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: #cdc8bd;
}

.lightbox__close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border: 1px solid #4a453d;
  background: transparent;
  color: #e9e5dc;
  cursor: pointer;
}

.lightbox__close:hover { border-color: #e9e5dc; }

/* --- Utility -------------------------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
