/* Lawrence Nieves — site styles, built on the Kudzu identity system.
   Layout: home is one kudzu field of linked sentences; the work pages are a
   sticky index of projects on the left and the reading column on the right. */

:root {
  --white: #ffffff;
  --fog: #e4e4e2;          /* rules, image slots */
  --graphite-600: #6f7172; /* small secondary text: years, clients, captions */
  --graphite-700: #4a4c4d; /* field labels */
  --ink: #1c1d1f;          /* text and links */
  --kudzu: #2d4a30;        /* the one accent: hover, focus, role line, home ground */

  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --index-width: 312px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
/* Anything the script hides stays hidden, even when a rule gives it a display (e.g. figure { display: grid }). */
[hidden] { display: none !important; }

html { background: var(--white); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { text-wrap: balance; }
p { margin: 0; }

/* Links: ink with a hairline underline, kudzu on hover. */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--kudzu); }
:focus-visible { outline: 2px solid var(--kudzu); outline-offset: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--white); padding: 8px 12px;
}
.skip:focus { left: max(16px, env(safe-area-inset-left, 0px)); z-index: 20; }

.mono, .meta, .label {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.4;
}
.meta { color: var(--graphite-600); font-variant-numeric: tabular-nums; }
.label {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--graphite-700);
}

/* ------------------------------------------------------------------ */
/* Home: the whole page is kudzu.                                      */
/* ------------------------------------------------------------------ */

html.home, html.home body { background: var(--kudzu); }
html.home { height: 100%; }
.home body {
  --home-bottom: clamp(24px, 4vh, 40px);
  min-height: 100%;
  color: var(--white);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: clamp(24px, 3vw, 56px);
  align-items: start;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  padding-block: clamp(40px, 12vh, 128px) var(--home-bottom);
}

/* Optional portrait drawing (none on the site right now). Add <img class="portrait" ...> after </main> in index.html.
   Desktop: right of the text, running off the bottom edge. Phone: above the text. */
.home body:has(> .portrait) { grid-template-columns: minmax(0, 1fr) auto; }
.portrait {
  align-self: end;
  width: clamp(200px, 24vw, 400px);
  height: auto;
  margin-bottom: calc(-1 * var(--home-bottom));
}
@media (max-width: 820px) {
  .home body, .home body:has(> .portrait) { grid-template-columns: minmax(0, 1fr); }
  .portrait {
    order: -1;
    align-self: start;
    width: min(46vw, 190px);
    margin: 0 0 28px -8px;
  }
}
.home :focus-visible { outline-color: var(--white); outline-offset: 3px; }

.intro {
  grid-area: auto; /* undo the work pages' main { grid-area: main } */
  padding: 0;
  display: grid;
  gap: 0.85em;
  max-width: 36em;
  font-size: clamp(20px, 1rem + 1vw, 30px);
  font-weight: 500;
  line-height: 1.28;
  letter-spacing: -0.018em;
  text-wrap: pretty;
}
.intro strong { font-weight: 800; letter-spacing: -0.04em; }

.intro a {
  white-space: nowrap; /* keep "click here" on one line */
  color: var(--white);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.16em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.intro a:hover {
  background: var(--white);
  color: var(--kudzu);
  text-decoration-color: transparent;
}

/* ------------------------------------------------------------------ */
/* Work pages: index on the left, reading column on the right.         */
/* ------------------------------------------------------------------ */

.work body {
  display: grid;
  grid-template-columns: var(--index-width) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "bar  top"
    "list main";
  min-height: 100vh;
  background: linear-gradient(var(--fog), var(--fog)) no-repeat var(--index-width) 0 / 1px 100%;
}

.bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  padding-block: 24px 8px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: 24px;
}
.home-link {
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
}

.top {
  grid-area: top;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding-block: 24px 8px;
  padding-left: var(--gutter);
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  font-family: var(--mono);
  font-size: 13px;
}

/* The project index */
.index {
  grid-area: list;
  align-self: start;
  padding-block: 20px 32px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: 24px;
  display: grid;
  gap: 32px;
}
/* Keep the index in view while scrolling, on screens tall enough to show all of it. */
@media (min-width: 821px) and (min-height: 900px) {
  .index { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; overscroll-behavior: contain; }
}
.index-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.index-list a {
  display: grid;
  gap: 1px;
  text-decoration: none;
}
.index-list .t {
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}
.mobile-only { display: none; }
.index-list .y { font-family: var(--mono); font-size: 12px; color: var(--graphite-600); }
.index-list a:hover .t, .index-list a:focus-visible .t { color: var(--kudzu); text-decoration-color: currentColor; }
.index-list a[aria-current="page"] .t { font-weight: 800; letter-spacing: -0.01em; text-decoration-line: none; }
.index-list a[aria-current="page"] .y { color: var(--ink); }

.tag-cloud { display: grid; gap: 10px; }
.tag-cloud ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  font-size: 14px;
}
.tag-cloud sup, .tags sup {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--graphite-600);
  margin-left: 2px;
  vertical-align: 0.6em;
  line-height: 0;
}
.tag-cloud a[aria-current="page"] { font-weight: 700; text-decoration: none; }

/* Reading column */
main {
  grid-area: main;
  min-width: 0;
  padding-block: 24px 96px;
  padding-left: var(--gutter);
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.col { max-width: 760px; display: grid; gap: 28px; }

.eyebrow { font-family: var(--mono); font-size: 13px; color: var(--graphite-600); }
.page-title {
  margin: 0;
  font-size: clamp(34px, 1.6rem + 2.4vw, 56px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.02;
}
.head { display: grid; gap: 12px; }
.role {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--kudzu);
}
.lead { font-size: 19px; line-height: 1.55; max-width: 36em; text-wrap: pretty; }

/* Figures */
figure { margin: 0; display: grid; gap: 8px; }
figure a { display: block; width: fit-content; max-width: 100%; }
figure img {
  background: var(--fog);
  max-height: 78vh;
  width: auto;
  object-fit: contain;
}
figcaption { font-family: var(--mono); font-size: 12px; color: var(--graphite-600); }
.gallery { display: grid; gap: 40px; }

/* YouTube embeds */
.video .embed { width: 100%; background: var(--fog); }
.video.tall .embed { width: min(100%, 380px); }
.video iframe { display: block; width: 100%; height: 100%; border: 0; }

/* Facts list */
.facts { margin: 0; display: grid; border-top: 1px solid var(--fog); max-width: 36em; }
.facts div {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  gap: 16px;
  padding-block: 10px;
  border-bottom: 1px solid var(--fog);
}
.facts dt { font-family: var(--mono); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--graphite-700); padding-top: 3px; }
.facts dd { margin: 0; font-size: 16px; }

.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 17px; font-weight: 500; }

.tags { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; font-size: 15px; }
.tags ul { list-style: none; margin: 0; padding: 0; display: contents; }

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  padding-top: 20px;
  border-top: 1px solid var(--fog);
  font-size: 15px;
}
.pager a { display: grid; gap: 2px; text-decoration: none; }
.pager .next { text-align: right; margin-left: auto; }
.pager .t { text-decoration: underline 1px; text-underline-offset: 0.2em; font-weight: 500; }

/* Tag pages */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--fog); }
.rows li { border-bottom: 1px solid var(--fog); }
.rows a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 24px;
  align-items: baseline;
  padding-block: 14px;
  text-decoration: none;
}
.rows .t { font-size: 19px; font-weight: 500; text-decoration: underline 1px; text-underline-offset: 0.2em; }
.rows .meta { grid-column: 1; }
.rows .y { grid-column: 2; grid-row: 1; font-family: var(--mono); font-size: 13px; color: var(--graphite-600); }
.rows a:hover .t { color: var(--kudzu); }

/* Projects landing: hover preview */
.preview { display: grid; gap: 12px; min-height: 50vh; align-content: start; }
.preview img { max-height: 66vh; }
.preview-text { display: grid; gap: 6px; }
.preview-text .name { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
.hint { font-family: var(--mono); font-size: 13px; color: var(--graphite-600); }

/* Hobbies: no project index, one wide column of image + text rows. */
.work body.plain {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "bar  top"
    "main main";
  background: var(--white);
}
.plain main { padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); }
.hobbies { display: grid; gap: 48px; max-width: 1040px; }
.hobby-list { display: grid; }
.hobby {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 24px 48px;
  align-items: start;
  padding-block: 40px;
  border-top: 1px solid var(--fog);
}
.hobby img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--fog); }
.hobby-text { display: grid; gap: 12px; max-width: 34em; }
.hobby h2 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.1; }
.hobby p { font-size: 17px; line-height: 1.6; }

/* ------------------------------------------------------------------ */
/* Phone and narrow tablet: one column. The index follows the project. */
/* ------------------------------------------------------------------ */
@media (max-width: 820px) {
  .mobile-only { display: block; }
  .listing .mobile-only { display: none; }
  .work body, .work body.plain {
    background: var(--white);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "bar"
      "top"
      "main"
      "list";
  }
  .bar { padding-right: 0; }
  .top {
    justify-content: flex-start;
    gap: 4px 16px;
    padding-block: 8px 0;
    padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  }
  .index {
    position: static;
    max-height: none;
    overflow: visible;
    border-right: 0;
    border-top: 1px solid var(--fog);
    gap: 24px 0;
    padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
    padding-block: 32px 56px;
  }
  .listing .index { border-top: 0; padding-top: 8px; }
  .listing main { padding-bottom: 16px; }
  .listing .preview, .listing .hint { display: none; }
  main { padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-bottom: 56px; }
  .lead { font-size: 18px; }
  .facts div { grid-template-columns: 1fr; gap: 2px; }
  .rows a { grid-template-columns: 1fr; }
  .hobby { grid-template-columns: 1fr; padding-block: 32px; }
  .rows .y { grid-column: 1; grid-row: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
