/* Shared site system: tokens, header, links, footer, and the homepage. Project pages add case-study.css. */
:root {
  --paper: #FAF9F6;
  --ink: #222321;
  --muted: #626660;
  --rule: #DADDD5;
  --accent: #365848;
  --stone: #ECE9E1;
  --render: #141B19;

  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Spacing scale: every margin, gap and padding below uses one of these steps. */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem;
  --s6: 2rem; --s7: 3rem; --s8: 4rem; --s9: 6rem; --s10: 8rem;

  --site-width: 75rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  /* Hero foot and Selected Work share these columns so the actions line up with the preview. */
  --index-cols: minmax(0, 5fr) minmax(0, 7fr);
  --index-gap: clamp(2rem, 5vw, 5rem);
  --fade: 200ms;
}

* { box-sizing: border-box; }
html { scroll-padding-top: var(--s5); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1.0625rem/1.6 var(--sans); }
h1, h2, h3, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 1px; }

.wrap { width: min(var(--site-width), calc(100% - var(--gutter) * 2)); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; top: -100px; left: var(--s4); z-index: 10; padding: var(--s2) var(--s4); background: var(--paper); color: var(--accent); }
.skip-link:focus { top: var(--s4); }
.anchor-alias { position: absolute; }

/* Small uppercase metadata. Tabular figures keep years and numbers aligned. */
.meta { font-size: .6875rem; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Links: thin underline that thickens and takes the accent on hover/focus. */
.quiet-link {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px;
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule);
  text-decoration-thickness: 1px; text-underline-offset: .3em;
  transition: text-decoration-color var(--fade), color var(--fade);
}
.quiet-link:hover, .quiet-link:focus-visible { color: var(--accent); text-decoration-color: currentColor; }
.quiet-link .meta { color: inherit; opacity: .75; }
.arrow { display: inline-block; transition: transform var(--fade); }
.quiet-link:hover .arrow, .quiet-link:focus-visible .arrow { transform: translateX(3px); }

/* Header */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s2) var(--s6); padding-block: var(--s4); border-bottom: 1px solid var(--rule); }
.wordmark { display: inline-flex; align-items: center; min-height: 44px; font-size: .9375rem; font-weight: 600; text-decoration: none; }
nav { display: flex; flex-wrap: wrap; column-gap: var(--s5); }
nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: .9375rem; text-decoration: none; color: var(--muted); transition: color var(--fade); }
nav a:hover, nav a:focus-visible { color: var(--ink); }

/* Hero: a wide headline, then support and actions set on the Selected Work columns. */
.hero { padding-block: clamp(3.5rem, 8vw, 6.5rem) 0; }
.hero h1 { font: 400 clamp(2.25rem, 5.6vw, 4.5rem)/1.05 var(--serif); letter-spacing: -.022em; max-width: 21ch; text-wrap: balance; }
.hero-foot { margin-top: clamp(2rem, 4vw, 3rem); }
.hero-support { max-width: 36ch; font-size: 1.125rem; line-height: 1.55; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5); margin-top: var(--s5); }
.button {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s4);
  background: var(--accent); color: var(--paper); text-decoration: none; border-radius: 2px; font-size: .9375rem;
  transition: background-color var(--fade);
}
.button:hover, .button:focus-visible { background: #2A463A; }
.hero-actions .quiet-link { font-size: .9375rem; }

/* Sections vary their openings: Work is ruled, About and Contact hang a label, Photography stays open. */
.section { padding-top: clamp(4rem, 8vw, 6rem); }
#selected-work { padding-top: clamp(4rem, 8vw, 6.5rem); }
#about { padding-top: clamp(5rem, 11vw, 9rem); }
#photography { padding-top: clamp(5rem, 11vw, 9rem); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding-top: var(--s3); border-top: 1px solid var(--ink); margin-bottom: var(--s6); }
.section-head h2 { font-size: .75rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }

/* Selected work: index rows beside one large preview. */
.work-legend { display: none; }
.work-row {
  position: relative; display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; grid-template-rows: auto 1fr;
  column-gap: var(--s4); padding-block: var(--s5); border-top: 1px solid var(--rule);
  text-decoration: none;
}
.work-row::before {
  content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform 250ms ease;
}
.work-num { grid-area: 1 / 1; padding-top: .7em; font: 500 .75rem/1 var(--mono); color: var(--muted); transition: color var(--fade); }
.work-main { grid-area: 1 / 2 / 3 / 3; display: flex; flex-direction: column; gap: var(--s3); }
.work-title { font: 400 clamp(1.5rem, 2.5vw, 2.125rem)/1.12 var(--serif); letter-spacing: -.015em; text-wrap: balance; transition: color var(--fade); }
.work-type { font-size: .6875rem; font-weight: 500; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.work-year { grid-area: 1 / 3; padding-top: .55em; font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.work-arrow { grid-area: 2 / 3; align-self: end; justify-self: end; font-size: 1.25rem; line-height: 1; color: var(--muted); transition: transform var(--fade), color var(--fade); }
.work-row:hover .work-title, .work-row:focus-visible .work-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }
.work-row:hover .work-arrow, .work-row:focus-visible .work-arrow,
.work-row.is-active .work-arrow { color: var(--accent); transform: translateX(4px); }
.work-row.is-active .work-num { color: var(--accent); }
.work-row.is-active::before { transform: scaleX(1); }
.work-row:focus-visible { outline-offset: 2px; }

.work-visual { margin-bottom: var(--s7); }
.work-frame { position: relative; aspect-ratio: 5 / 4; overflow: hidden; border-radius: 2px; background: var(--stone); }
.work-frame img { width: 100%; height: 100%; object-fit: cover; }
.work-visual--dark .work-frame { background: var(--render); }
.work-visual figcaption { margin-top: var(--s3); font-size: .875rem; line-height: 1.5; }
.work-visual figcaption .meta { margin-right: var(--s2); }
.work-visual .note { display: block; margin-top: var(--s1); font-size: .8125rem; color: var(--muted); }
.work-index.is-enhanced .work-visual { cursor: pointer; }

/* Document preview: a rendered one-page PDF set as a sheet, inset on the stone frame. */
.work-frame .sheet-img { position: absolute; top: 7%; left: 7%; width: 86%; height: auto; object-fit: initial; border: 1px solid #D3D1C8; box-shadow: 0 1px 0 rgba(34, 35, 33, .04); }

/* Research preview: an HTML research sheet, sized relative to its frame. */
.doc { position: absolute; inset: 0; container-type: inline-size; }
.doc-sheet {
  position: absolute; top: 8%; left: 10%; right: -3%; bottom: -8%;
  padding: 5.5cqi 7cqi; background: #FFFEFA; border: 1px solid #D3D1C8; color: var(--ink);
  box-shadow: 0 1px 0 rgba(34, 35, 33, .04);
}
.doc-top { display: flex; justify-content: space-between; padding-bottom: 2cqi; border-bottom: 1px solid var(--ink); font-size: max(7px, 1.55cqi); letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.doc-title { margin-top: 4cqi; max-width: 17ch; font: 400 max(13px, 4.3cqi)/1.12 var(--serif); letter-spacing: -.01em; }
.doc-sub { margin-top: 2.5cqi; font-size: max(8px, 1.8cqi); color: var(--muted); }
.doc-sub span { color: var(--accent); }
.doc-table { width: 100%; margin-top: 4.5cqi; border-collapse: collapse; font-size: max(7px, 1.6cqi); line-height: 1.35; font-variant-numeric: tabular-nums; }
.doc-table th { text-align: left; font-weight: 600; padding: 0 1.5cqi 1.5cqi 0; border-bottom: 1px solid var(--ink); text-transform: uppercase; letter-spacing: .06em; font-size: .9em; }
.doc-table td { padding: 1.6cqi 1.5cqi 1.6cqi 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.doc-table td:first-child { font-weight: 500; }
.doc-table td:last-child { color: var(--muted); }
.doc-foot { margin-top: 3cqi; font: italic max(7px, 1.5cqi)/1.4 var(--serif); color: var(--muted); }

/* About: a quiet dated record. Georgia's old-style figures give the dates an editorial texture. */
#about .section-head { border-top: 0; padding-top: 0; }
.record li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); column-gap: var(--s5); row-gap: var(--s1); padding-block: var(--s4); }
.record li + li { border-top: 1px solid var(--rule); }
.record li:first-child { padding-top: 0; }
.record-year { grid-row: 1 / span 2; padding-top: .2em; font: italic 400 1rem/1.4 var(--serif); color: var(--muted); }
.record-what { font: 400 1.25rem/1.3 var(--serif); }
.record-detail { grid-column: 2; font-size: .875rem; color: var(--muted); }

/* Photography: one lead frame, then a stepped sequence. */
.photo-set { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s4); }
.photo-set figure { overflow: hidden; background: var(--stone); }
.photo-set img { width: 100%; }
.p-lead { position: relative; grid-column: 1 / 9; grid-row: 1 / 3; }
.p-lead img { position: absolute; inset: 0; height: 100%; object-fit: cover; }
.p-a { grid-column: 9 / 13; grid-row: 1; }
.p-b { grid-column: 9 / 13; grid-row: 2; }
.p-caption { grid-column: 1 / 5; grid-row: 3; align-self: end; display: flex; flex-direction: column; gap: var(--s1); }
.p-c { grid-column: 5 / 9; grid-row: 3; }
.p-d { grid-column: 9 / 13; grid-row: 3; }
.p-title { font: 400 1.5rem/1.2 var(--serif); }
.p-caption .quiet-link { margin-top: var(--s2); align-self: flex-start; }

/* Contact: a light rule, set apart from the ink rule that opens Selected Work. */
#contact { margin-top: clamp(5rem, 11vw, 9rem); padding-top: var(--s7); border-top: 1px solid var(--rule); }
#contact .section-head { border-top: 0; padding-top: 0; }
.contact-line { font: 400 clamp(1.5rem, 2.6vw, 2rem)/1.2 var(--serif); }
.contact-links { display: flex; flex-wrap: wrap; column-gap: var(--s6); margin-top: var(--s4); }

.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s2) var(--s5); margin-top: var(--s9); padding-block: var(--s3); border-top: 1px solid var(--rule); color: var(--muted); font-size: .875rem; }
.site-footer .quiet-link { color: var(--muted); }

/* Desktop and tablet: rows on the left, one shared preview on the right. */
@media (min-width: 880px) {
  .hero-foot { display: grid; grid-template-columns: var(--index-cols); column-gap: var(--index-gap); align-items: end; }
  .hero-actions { margin-top: 0; }

  /* Rows share the preview frame's height, so the last rule meets the bottom of the image. */
  .work-index { display: grid; grid-template-columns: var(--index-cols); grid-template-rows: auto repeat(5, minmax(0, 1fr)); column-gap: var(--index-gap); padding-bottom: var(--s8); }
  .work-legend { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) auto; column-gap: var(--s4); grid-column: 1; grid-row: 1; padding-bottom: var(--s3); }
  .work-row { grid-column: 1; }
  .work-row:nth-of-type(1) { grid-row: 2; }
  .work-row:nth-of-type(2) { grid-row: 3; }
  .work-row:nth-of-type(3) { grid-row: 4; }
  .work-row:nth-of-type(4) { grid-row: 5; }
  .work-row:nth-of-type(5) { grid-row: 6; border-bottom: 1px solid var(--rule); }
  .work-visual {
    position: relative; grid-column: 2; grid-row: 2 / 7; align-self: start; margin: 0;
    opacity: 0; visibility: hidden;
    transition: opacity var(--fade) ease, visibility 0s linear var(--fade);
  }
  .work-visual.is-active { opacity: 1; visibility: visible; transition: opacity var(--fade) ease, visibility 0s; }
  .work-visual figcaption { position: absolute; top: 100%; left: 0; right: 0; }
  /* Inactive titles recede so the active project reads with the preview. */
  .work-index.is-enhanced .work-row:not(.is-active) .work-title { color: var(--muted); }
  .work-index.is-enhanced .work-row:not(.is-active):hover .work-title { color: var(--ink); }

  .section-split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); column-gap: var(--s5); align-items: start; }
  .section-split > .section-head { grid-column: 1; margin-bottom: 0; }
  #about .record, #contact > :not(.section-head) { grid-column: 2; }
  #contact .contact-links { grid-row: 2; }
  .section-split > .section-head h2 { line-height: 2.2; }
}

@media (max-width: 879px) {
  .work-row { border-top: 0; padding-block: 0 var(--s4); }
  .work-row::before { display: none; }
  .work-row .work-arrow { transform: none; }
  .work-main { gap: var(--s2); }
  .work-visual { margin-bottom: var(--s7); }
  .work-visual:last-child { margin-bottom: 0; }
  .hero-actions { margin-top: var(--s5); }
}

@media (max-width: 699px) {
  body { font-size: 1rem; }
  .site-header { flex-direction: column; align-items: flex-start; gap: 0; padding-block: var(--s2); }
  nav { column-gap: var(--s4); }
  .hero-support { font-size: 1.0625rem; }
  .section-head { margin-bottom: var(--s5); }
  .record li { grid-template-columns: 4.75rem minmax(0, 1fr); column-gap: var(--s4); }
  .record-what { font-size: 1.125rem; }
  .photo-set { grid-template-columns: 1fr 1fr; gap: var(--s2); }
  .photo-set > * { grid-column: auto; grid-row: auto; }
  .p-lead { grid-column: 1 / -1; }
  .p-lead img { position: static; height: auto; }
  .p-caption { grid-column: 1 / -1; order: 5; margin-top: var(--s3); }
  .site-footer { margin-top: var(--s8); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  html { scroll-behavior: auto; }
}
