/* Alkhas Portfolio — shared styles
   Visual language: white ground, hairline rules, outlined frames, heavy grotesk titles,
   condensed body text, light serif bracket captions. One "material accent" per project. */

:root {
  --ink: #141414;
  --paper: #ffffff;
  --muted: #6d6d6d;
  --line: #141414;
  --accent: #0f7c62;          /* overridden per project / on hover */
  --pad: clamp(16px, 2.4vw, 36px);
  --header-h: 46px;
  --f-display: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-body: "Archivo Narrow", "Helvetica Neue", Arial, sans-serif;
  --f-serif: "Instrument Serif", "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
h1, h2, h3 { margin: 0; font-weight: inherit; font-size: inherit; }
ol, ul, dl, dd, figure { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

/* ---------- Type ---------- */
.display {
  font-family: var(--f-display); font-weight: 800; text-transform: uppercase;
  letter-spacing: -0.035em; line-height: 0.86;
}
.label { font-size: 0.95rem; letter-spacing: 0.01em; }
.serif { font-family: var(--f-serif); font-weight: 400; }
.bracket::before { content: "["; }
.bracket::after { content: "]"; }
.muted { color: var(--muted); }
.ph { border-bottom: 1px dashed var(--muted); color: var(--muted); } /* placeholder text awaiting real details */

.link { background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 1px no-repeat; transition: background-size .25s ease; padding-bottom: 1px; }
.link:hover { background-size: 100% 100%; }

/* ---------- Header (one component for every page; tokens defined below) ----------
   Four columns on --grid-open, the same grid as the homepage opening section,
   so the dividers sit on identical lines on every page at a given width. */
html { scrollbar-gutter: stable; }  /* reserve scrollbar space so short and long pages have the same width */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: var(--grid-open); height: var(--header-h);
  background: var(--paper); border-bottom: var(--rule);
}
.site-header nav { display: contents; }
.site-header a {
  display: flex; align-items: center; justify-content: flex-start; min-width: 0;
  padding: 0 var(--cell-x); color: var(--text); white-space: nowrap;
}
.site-header .brand { padding-left: var(--gutter); gap: var(--space-1); }
.brand::before { content: ""; width: var(--space-1); height: var(--space-1); background: var(--accent); transition: background .4s ease; flex: none; }
.site-header nav a { border-left: var(--rule); transition: background .2s ease; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { background: var(--accent); }

/* ---------- Grid and type tokens (site-wide) + Home: opening section ----------
   The tokens below are global so the header is identical on every page;
   the hero rules that use them only exist on the homepage.

   Grid: four columns, 21 : 5 : 5 : 5 (36 units). Column line 2 is the 7/12 line used by
   the Selected Work divider below. Every vertical rule in the opening section sits on
   one of these column lines, and every text block starts one gutter to the right of one:
     line 1  brand            intro
     line 2  "Work"           information labels
     line 3  "About"          information values
     line 4  "Email"
   Rows are built on a 48px module (24px line + 12px above and below), the header height.
   The horizontal gutter is the site-wide --pad, so text lines up with Selected Work. */
:root {
  /* spacing (8px scale, with a 4px half-step for the 48px row module) */
  --space-1: 8px;
  --space-1h: 12px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --gutter: var(--pad);             /* outer margin, shared with the rest of the site */
  --cell-x: var(--gutter);          /* inner horizontal padding of cells after a divider */
  --row: 48px;                      /* row module */
  --block-y: var(--space-3);        /* space above and below the heading */

  /* borders and colour */
  --rule: 1px solid var(--line);
  --text: var(--ink);
  --text-quiet: var(--muted);

  /* grid */
  --grid-open: minmax(0, 21fr) repeat(3, minmax(0, 5fr));
  --header-h: var(--row);

  /* typography: one family, three roles (15px text / 13px secondary / fitted display) */
  --f-sans: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --t-small-size: 0.9375rem;        /* 15px: navigation, introduction, labels, values */
  --t-small-lh: 1.6;                /* 24px line: half the row module */
  --t-small-weight: 500;
  --t-small-track: 0.005em;
  --t-xs-size: 0.8125rem;           /* 13px: secondary details (dates, locations, descriptions) */
  --t-xs-lh: 1.54;                  /* 20px */
  --t-xs-weight: 400;
  --t-xs-track: 0.01em;
  --t-display-weight: 800;
  --t-display-track: -0.025em;
  --t-display-ratio: 5.287;         /* measured ink width of "PORTFOLIO" in em at the tracking above */
  --t-display-bearing: 0.031em;     /* measured left side bearing of "P", removed so the ink sits on the gutter */
}
@media (min-width: 760px)  { :root { --block-y: var(--space-4); } }
@media (min-width: 1200px) { :root { --block-y: var(--space-6); } }

/* shared text roles (used on the homepage and the About page) */
.t-small, .site-header a {
  font-family: var(--f-sans); font-size: var(--t-small-size); line-height: var(--t-small-lh);
  font-weight: var(--t-small-weight); letter-spacing: var(--t-small-track);
}
.t-xs {
  font-family: var(--f-sans); font-size: var(--t-xs-size); line-height: var(--t-xs-lh);
  font-weight: var(--t-xs-weight); letter-spacing: var(--t-xs-track);
}
.t-quiet { color: var(--text-quiet); }
.t-measure { max-width: 44em; }  /* shared line length for 15px paragraphs, about 660px */

/* heading: fitted to the content width of the grid at every size */
.hero { border-bottom: var(--rule); container-type: inline-size; }
.hero-title {
  overflow: hidden;
  padding: var(--block-y) var(--gutter);
  font-family: var(--f-sans); font-weight: var(--t-display-weight); letter-spacing: var(--t-display-track);
  font-size: calc((100cqi - 2 * var(--gutter)) / var(--t-display-ratio));
  line-height: 0.8; white-space: nowrap;
}
@supports (text-box: trim-both cap alphabetic) {
  .hero-title { line-height: 1; text-box: trim-both cap alphabetic; }
}
.hero-title span { display: inline-block; margin-left: calc(-1 * var(--t-display-bearing)); }

/* introduction (column 1) and information table (columns 2 to 4) */
.hero-foot { display: grid; grid-template-columns: var(--grid-open); border-top: var(--rule); }
.hero-intro {
  grid-column: 1; margin: 0; align-self: center;  /* vertically centred in the row */
  padding: var(--space-3) var(--gutter);
}
.hero-intro span { display: block; }
.hero-info { grid-column: 2 / -1; border-left: var(--rule); }
.hero-info > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); } /* = 5 : 10, on column lines 2 and 3 */
.hero-info > div + div { border-top: var(--rule); }
.hero-info dt, .hero-info dd { padding: var(--space-1h) var(--cell-x); min-width: 0; }
.hero-info dt { color: var(--text-quiet); white-space: nowrap; }
.hero-info dd span { display: block; }
.hero-info dd span + span.deg { margin-top: var(--space-1); }

.lede { font-size: clamp(1.15rem, 1.9vw, 1.6rem); line-height: 1.3; max-width: 30em; }

.swatch { display: flex; align-items: flex-start; gap: 12px; }
.swatch i { width: 34px; height: 34px; background: var(--accent); border: 1px solid var(--line); flex: none; transition: background .4s ease; }
.swatch b { display: block; font-weight: 400; font-family: var(--f-serif); font-size: 1.25rem; line-height: 1.1; }
.swatch small { font-size: 0.85rem; color: var(--muted); }

/* ---------- Home: project index ---------- */
.section-head { display: flex; justify-content: space-between; padding: 12px var(--pad); border-bottom: 1px solid var(--line); }
.work { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); border-bottom: 1px solid var(--line); }
.index li + li { border-top: 1px solid var(--line); }
.index a { display: grid; grid-template-columns: 3.2rem 1fr auto; align-items: baseline; gap: 0 12px; padding: clamp(10px, 1.4vw, 20px) var(--pad); transition: background .3s ease; }
.index a:hover, .index a:focus-visible, .index a.is-active { background: var(--row-accent, var(--accent)); }
.idx-num { font-size: 0.95rem; }
.idx-title { font-size: clamp(2rem, 5.2vw, 5rem); }
.idx-type { font-size: 0.95rem; text-align: right; }
.idx-thumb { display: none; }

.preview { border-left: 1px solid var(--line); }
.preview-inner { position: sticky; top: var(--header-h); padding: var(--pad); }
.preview-frame { position: relative; aspect-ratio: 4 / 5; max-height: calc(100vh - var(--header-h) - 110px); width: 100%; border: 1px solid var(--line); overflow: hidden; background: #f3f3f1; }
.preview-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.03); transition: opacity .45s ease, transform .8s ease; }
.preview-frame img.is-active { opacity: 1; transform: none; }
.preview-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-top: 10px; }
.preview-cap .serif { font-size: 1.35rem; }

/* ---------- Home: about teaser ---------- */
.teaser { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); border-bottom: 1px solid var(--line); }
.teaser > * { padding: clamp(24px, 4vw, 64px) var(--pad); }
.teaser > * + * { border-left: 1px solid var(--line); }

/* ---------- Project pages ---------- */
.p-run { display: flex; justify-content: space-between; padding: 12px var(--pad); }
.p-title { border-top: 1px solid var(--line); padding: 0.06em var(--pad) 0.02em; font-size: min(calc(138vw / var(--chars, 8)), 15rem); }
.p-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--line); }
.p-intro-text { padding: var(--pad); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.p-intro-img { border-left: 1px solid var(--line); background: #f3f3f1; }
.p-intro-img img { width: 100%; height: 100%; max-height: min(86vh, 900px); min-height: 320px; object-fit: cover; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.facts > div { padding: 10px 12px 14px 0; border-bottom: 1px solid var(--line); }
.facts > div:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--line); }
.facts dt { font-size: 0.85rem; color: var(--muted); }
.facts dd { font-size: 1rem; line-height: 1.3; }
.facts .swatch i { width: 22px; height: 22px; }
.facts .swatch { align-items: center; gap: 8px; }

.stage { display: grid; grid-template-columns: minmax(150px, 17%) minmax(0, 1fr); border-top: 1px solid var(--line); position: relative; }
.stage-label { border-right: 1px solid var(--line); padding: 12px var(--pad); }
.stage-label > div { position: sticky; top: calc(var(--header-h) + 12px); }
.stage-label .n { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); margin-bottom: 2px; }
.stage-label .n::before { content: ""; width: 8px; height: 8px; background: var(--accent); }
.stage-label h2 { font-size: 1.05rem; line-height: 1.2; }
.stage-body { padding: clamp(28px, 4.5vw, 72px) var(--pad) clamp(36px, 6vw, 96px); min-width: 0; }

.figs { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: clamp(16px, 3vw, 56px); align-items: end; }
.figs.top { align-items: start; }
.figs + .figs { margin-top: clamp(16px, 3vw, 56px); }
.figs.narrow { max-width: 760px; }
.figs.mid { max-width: 1100px; }
figure figcaption { font-family: var(--f-serif); font-size: 1.3rem; line-height: 1.15; text-align: center; padding-bottom: 8px; }
figure figcaption::before { content: "["; }
figure figcaption::after { content: "]"; }
figure img { width: 100%; cursor: zoom-in; background: #f3f3f1; }
figure.line img { border: 1px solid var(--line); background: #fff; }
figure.note figcaption { font-family: var(--f-body); font-size: 0.85rem; color: var(--muted); text-align: left; padding: 8px 0 0; }
figure.note figcaption::before, figure.note figcaption::after { content: none; }

.copy { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1em clamp(24px, 4vw, 72px); max-width: 1150px; margin-top: clamp(24px, 3.5vw, 48px); }
.copy:first-child { margin-top: 0; }
.copy + .figs { margin-top: clamp(24px, 3.5vw, 48px); }
.copy p { max-width: 46ch; }
.copy.wide { display: block; }
.copy.wide p { max-width: 75ch; }

/* research -> design table (Touch by Design) and simple lists */
.pairs { border-top: 1px solid var(--line); max-width: 900px; margin-top: clamp(24px, 3.5vw, 48px); }
.pairs > div { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 2fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.pairs dt { font-family: var(--f-display); font-weight: 700; text-transform: uppercase; font-size: 0.95rem; letter-spacing: -0.01em; }
.pairs .arrow { color: var(--accent); font-family: var(--f-display); font-weight: 700; }

.next { display: grid; grid-template-columns: minmax(150px, 17%) minmax(0, 1fr); border-top: 1px solid var(--line); }
.next span { padding: 12px var(--pad); border-right: 1px solid var(--line); }
.next a { padding: clamp(18px, 3vw, 40px) var(--pad); font-size: clamp(2rem, 6vw, 5.5rem); display: flex; justify-content: space-between; gap: 16px; align-items: baseline; transition: background .3s ease; }
.next a:hover { background: var(--next-accent, var(--accent)); }
.next a em { font-style: normal; transition: transform .3s ease; }
.next a:hover em { transform: translateX(8px); }

/* ---------- About ---------- */
.about-title { border-bottom: 1px solid var(--line); padding: 0.06em var(--pad) 0.02em; font-size: min(21vw, 15rem); }
/* About: on the shared --grid-open grid. Biography in column 1; CV in columns 2 to 4,
   so its divider is the same line as the "Work" divider in the header.
   Inside the CV, dates sit under "Work" and details under "About" (1 : 2 = 5 : 10). */
.about { display: grid; grid-template-columns: var(--grid-open); border-bottom: var(--rule); }
.about-body { grid-column: 1; min-width: 0; }
.cv { grid-column: 2 / -1; min-width: 0; border-left: var(--rule); }
.about-h { display: flex; align-items: center; min-height: var(--row); padding: 0 var(--gutter); border-bottom: var(--rule); }
.cv .about-h { padding: 0 var(--cell-x); }
.cv-sec + .cv-sec .about-h { border-top: var(--rule); }
.about-text { padding: var(--space-3) var(--gutter) var(--space-6); }
.about-text p { margin: 0 0 var(--space-3); }
.about-text .about-link { margin: var(--space-4) 0 0; }
.cv-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); align-items: baseline; }
.cv-row + .cv-row { border-top: var(--rule); }
.cv-when, .cv-what { padding: var(--space-2) var(--cell-x); min-width: 0; }
.cv-what > * { margin: 0; }
.cv-desc { margin-top: var(--space-1) !important; max-width: 40em; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.stage + .site-footer, .next + .site-footer, .about + .site-footer, .teaser + .site-footer { border-top: 0; }
.next + .site-footer { border-top: 1px solid var(--line); }
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); border-bottom: 1px solid var(--line); }
.contact > * { padding: clamp(24px, 4vw, 56px) var(--pad); }
.contact > * + * { border-left: 1px solid var(--line); }
.contact-mail { font-family: var(--f-display); font-weight: 700; letter-spacing: -0.03em; font-size: clamp(1.5rem, 4.6vw, 4.2rem); line-height: 1; word-break: break-word; }
.contact-links { display: flex; flex-wrap: wrap; gap: 6px 28px; margin-top: 18px; }
.lines { height: clamp(70px, 11vw, 150px); margin: clamp(20px, 3vw, 40px) var(--pad); display: flex; justify-content: space-between; }
.lines i { width: 1px; background: var(--line); transform-origin: top; }
.lines i:nth-child(4) { background: var(--accent); width: 3px; }
.foot-base { display: flex; justify-content: space-between; gap: 16px; padding: 12px var(--pad); border-top: 1px solid var(--line); font-size: 0.9rem; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(255, 255, 255, 0.97); display: none; align-items: center; justify-content: center; padding: 48px 20px 20px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border: 1px solid var(--line); }
.lightbox button { position: absolute; top: 0; right: 0; height: var(--header-h); padding: 0 var(--pad); background: none; border: 0; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); font: inherit; cursor: pointer; }

/* ---------- Motion (only when JS is running) ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
.js .hero-title span, .js .p-title span, .js .about-title span { transform: translateY(105%); transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
.js .loaded .hero-title span, .js .loaded .p-title span, .js .loaded .about-title span { transform: none; }
.js .home:not(.loaded) .hero-title span { transform: translateY(calc(100% + var(--block-y) + 8px)); }
.p-title, .about-title { overflow: hidden; }
.p-title span, .about-title span { display: inline-block; }
.js .lines i { transform: scaleY(0); transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.js .lines.in i { transform: none; }
.lines i:nth-child(2) { transition-delay: .05s; } .lines i:nth-child(3) { transition-delay: .1s; } .lines i:nth-child(4) { transition-delay: .15s; }
.lines i:nth-child(5) { transition-delay: .2s; } .lines i:nth-child(6) { transition-delay: .25s; } .lines i:nth-child(7) { transition-delay: .3s; }
.lines i:nth-child(8) { transition-delay: .35s; } .lines i:nth-child(9) { transition-delay: .4s; } .lines i:nth-child(10) { transition-delay: .45s; }
figure img { transition: outline-offset .25s ease; outline: 1px solid transparent; outline-offset: 0; }
figure:hover img { outline-color: var(--line); outline-offset: 6px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .js .reveal, .js .hero-title span, .js .p-title span, .js .about-title span, .js .lines i { opacity: 1; transform: none; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1000px) {
  .figs[style*="--n:4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* About CV: the narrow column stacks the date above the details */
  .cv-row { grid-template-columns: minmax(0, 1fr); }
  .cv-when { padding-bottom: 0; }
  .cv-what { padding-top: var(--space-1); }
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  /* home opening section: same four columns, rebalanced to 4 : 2 : 2 : 2 */
  :root { --grid-open: minmax(0, 4fr) repeat(3, minmax(0, 2fr)); --cell-x: var(--space-2); }
  /* About: biography and CV stack; CV rows return to date | details on the 4 : 6 split,
     so details start on the "Work" line of the header */
  .about-body, .cv { grid-column: 1 / -1; }
  .cv { border-left: 0; border-top: var(--rule); }
  .cv .about-h { padding-left: var(--gutter); }
  .cv-row { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .cv-when { padding: var(--space-2) var(--cell-x) var(--space-2) var(--gutter); }
  .cv-what { padding-top: var(--space-2); }
  .hero-intro { grid-column: 1 / -1; }
  .hero-info { grid-column: 1 / -1; border-left: 0; border-top: var(--rule); }
  .hero-info > div { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } /* = 4 : 6, values start on the "Work" line */
  .hero-info dt { padding-left: var(--gutter); }

  .work { grid-template-columns: 1fr; }
  .preview { display: none; }
  .index a { grid-template-columns: 2.2rem 1fr; padding: var(--pad); row-gap: 4px; background: none !important; }
  .idx-thumb { display: block; grid-column: 1 / -1; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--line); margin-bottom: 10px; }
  .idx-title { font-size: clamp(2rem, 10.5vw, 3.2rem); }
  .idx-type { grid-column: 2; text-align: left; display: flex; align-items: center; gap: 8px; }
  .idx-type::before { content: ""; width: 10px; height: 10px; background: var(--row-accent); border: 1px solid var(--line); }

  .teaser, .contact, .p-intro { grid-template-columns: 1fr; }
  .teaser > * + *, .contact > * + * { border-left: 0; border-top: 1px solid var(--line); }
  .p-title { font-size: min(calc(128vw / var(--chars-m, var(--chars, 8))), 15rem); }
  .p-intro-img { border-left: 0; border-top: 1px solid var(--line); order: -1; }
  .p-intro-img img { max-height: 70vh; min-height: 0; }

  .stage, .next { grid-template-columns: 1fr; }
  .stage-label { border-right: 0; border-bottom: 1px solid var(--line); padding: 10px var(--pad); }
  .stage-label > div { position: static; display: flex; gap: 12px; align-items: baseline; }
  .next span { border-right: 0; border-bottom: 1px solid var(--line); }
  .figs, .figs[style*="--n:4"] { grid-template-columns: 1fr; }
  .figs.pair-m { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figs.trio-m { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .figs.trio-m figcaption { font-size: 1rem; }
  .pairs > div { grid-template-columns: 1fr; gap: 2px; }
  .pairs .arrow { display: none; }
  .foot-base { flex-direction: column; gap: 2px; }
  figure:hover img { outline-color: transparent; }
}

/* ---------- Small phones: home opening section ---------- */
@media (max-width: 400px) {
  :root { --cell-x: var(--space-1); }
}
