/* ============================================================
   Mazens Zibara — portfolio
   Datasheet layout. Achromatic. Emphasis by inversion.
   ============================================================ */

:root {
  --paper:    #FBFBF9;
  --ink:      #101010;
  --ink-mid:  #5C5C5A;
  --rule:     #D8D8D4;
  --fill:     #EDEDE9;   /* screenshot backing while loading */

  --sans: "Archivo", ui-sans-serif, system-ui, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --gutter: 9.5rem;                        /* label column */
  --metric-col: 8.5rem;                    /* ladder figures column */
  --ladder-gap: 1.75rem;
  --pad: clamp(1.25rem, 4.5vw, 4.5rem);
  --maxw: 80rem;
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:    #0D0D0C;
    --ink:      #F2F2EE;
    --ink-mid:  #93938C;
    --rule:     #2C2C29;
    --fill:     #1D1D1B;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

main { max-width: var(--maxw); margin-inline: auto; }

a { color: inherit; text-decoration: none; }

:where(a):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* ---------- top rail -------------------------------------- */

.rail {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 1.1rem var(--pad);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

.rail__mark {
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--ink);
}

.sep { padding-inline: 0.35em; }

/* ---------- field: the one spacing owner ------------------ */
/* Every section is a labelled field. Nothing else sets
   section-level padding — keeps specificity fights out.     */

.field {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  gap: 0 2.5rem;
  padding: 3.25rem var(--pad);
  border-top: 1px solid var(--rule);
}

.field--identity { border-top: 0; padding-block: 1rem 4.5rem; }
.field--contact  { padding-bottom: 4rem; }

.label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mid);
  padding-top: 0.55rem;
}

.field__body { min-width: 0; }

/* ---------- identity -------------------------------------- */

.name {
  margin: 0;
  font-size: clamp(3rem, 11vw, 7.5rem);
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: -0.04em;
}

.role {
  margin: 1.25rem 0 0;
  font-size: clamp(1.05rem, 2.1vw, 1.375rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.role--sub {
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

/* ---------- summary --------------------------------------- */

.lede {
  margin: 0;
  max-width: var(--measure);
  font-size: clamp(1rem, 1.35vw, 1.125rem);
  line-height: 1.6;
}

.specs {
  margin: 2rem 0 0;
  display: grid;
  gap: 0;
}

.specs > div,
.caps > div {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  gap: 1.5rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
}

.specs dt,
.caps dt {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mid);
  padding-top: 0.2rem;
}

.specs dd,
.caps dd {
  margin: 0;
  max-width: var(--measure);
}

.caps dd { font-size: 0.9375rem; }
.caps strong { font-weight: 700; }

/* ---------- the ladder ------------------------------------ */
/* Selected work as a price ladder: right-aligned tabular
   figures, inversion on hover/focus.                          */

.ladder {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rung { border-top: 1px solid var(--rule); }
.rung:last-child { border-bottom: 1px solid var(--rule); }

.rung__head {
  position: relative;
  display: grid;
  grid-template-columns: var(--metric-col) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0 var(--ladder-gap);
  padding: 1.15rem 1rem;
  margin-inline: -1rem;
  color: var(--ink);
}

.rung__metric {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.plus { color: var(--ink-mid); }

.rung__name {
  margin: 0;
  font-size: clamp(1.375rem, 3.2vw, 2.125rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

/* stretch the name's link across the whole row — the containing block is
   .rung__head, which is the only positioned ancestor */
.rung__name a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.rung__tags {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mid);
  white-space: nowrap;
}

/* inversion — the only state change on the page.
   Scoped to the head so focusing a link in the detail below
   doesn't light up the row. */
.rung__head:hover,
.rung__head:focus-within {
  background: var(--ink);
  color: var(--paper);
}

.rung__head:hover :is(.rung__tags, .plus),
.rung__head:focus-within :is(.rung__tags, .plus) {
  color: inherit;
  opacity: 0.6;
}

/* the grouped row has no link of its own — don't imply one */
.rung--group .rung__head:hover { background: none; color: var(--ink); }
.rung--group .rung__head:hover :is(.rung__tags, .plus) { color: var(--ink-mid); opacity: 1; }

/* the row is the focus target, not the text inside it */
.rung__name a:focus-visible { outline: 0; }
.rung__head:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }

/* rung detail */

/* detail hangs under the name, not the figures — the metric column
   stays a clean empty channel down the left of the ladder.
   Width is capped on the prose children, not here, so the screenshot
   strips can run the full width of the field. */
.rung__detail {
  padding: 1.25rem 0 2.25rem calc(var(--metric-col) + var(--ladder-gap));
}

.rung__detail :is(.rung__specs, .notes, .caveat, .rung__links, .subrungs p, .prose) {
  max-width: var(--measure);
}

/* running description - carries the weight that bullet lists used to */
.prose {
  display: grid;
  gap: 0.85rem;
  font-size: 0.9375rem;
}

.prose p { margin: 0; }

.rung__specs {
  margin: 0 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 2rem;
}

.rung__specs > div { display: grid; gap: 0.15rem; }

.rung__specs dt {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

.rung__specs dd {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
}

.notes {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.6rem;
  font-size: 0.9375rem;
}

.notes li { padding-left: 1.15rem; position: relative; }

.notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 0.5rem;
  height: 1px;
  background: var(--ink-mid);
}

.caveat {
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
  color: var(--ink-mid);
}

.rung__links {
  margin: 1.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
}

.rung__links a,
.contact a {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.15em;
  transition: border-color 0.15s ease;
}

.rung__links a:hover,
.contact a:hover { border-color: currentColor; }

/* ---------- product shots --------------------------------- */
/* The page is monochrome so that these aren't. Everything MZI
   says about himself is black and white; everything he shipped
   appears exactly as it does in the store. */

.shots {
  display: flex;
  gap: 0.75rem;
  margin: 0 0 1.75rem;
  padding-bottom: 0.75rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

/* names the surface a strip belongs to - the extension and the mobile
   apps are separate pieces of evidence, so they get separate strips.
   .detail-h does the same job for prose subsections. */
.shots-label,
.detail-h {
  margin: 0 0 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.shots + .shots-label { margin-top: 1.25rem; }

/* prose subsection headings need breathing room above, unlike strip labels
   which sit tight to their images */
.detail-h { margin-top: 1.75rem; }

.shot {
  margin: 0;
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.shot img {
  display: block;
  height: clamp(215px, 24vw, 296px);
  width: auto;
  border: 1px solid var(--rule);
  background: var(--fill);
}

.shot figcaption {
  margin-top: 0.6rem;
  max-width: 22ch;
  font-family: var(--mono);
  font-size: 0.625rem;
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

/* licence credit, quieter than the caption it hangs off */
.credit {
  display: block;
  margin-top: 0.3rem;
  text-transform: none;
  letter-spacing: 0.02em;
  opacity: 0.72;
}

/* a single wide plate instead of a strip */
.shots--plate {
  display: block;
  overflow: visible;
  padding-bottom: 0;
}

.shots--plate .shot img {
  height: auto;
  width: 100%;
  max-width: 44rem;
}

.shots--plate figcaption { max-width: 44rem; }

/* strips inside the grouped row sit tighter to their heading */
.subrungs .shots { margin-top: 1rem; margin-bottom: 0.5rem; }

/* grouped sub-projects */

.subrungs {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1.5rem;
}

.subrungs > li {
  display: grid;
  gap: 0.3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.subrungs h4 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subrungs h4 a {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.1em;
  transition: border-color 0.15s ease;
}

.subrungs h4 a:hover { border-color: currentColor; }

.subrungs__tags {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

.subrungs p { margin: 0.2rem 0 0; font-size: 0.9375rem; }

/* ---------- contact --------------------------------------- */

.contact {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0;
}

.contact li {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
}

.contact__k {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

.contact a { justify-self: start; font-size: 1.0625rem; font-weight: 500; }

/* ---------- responsive ------------------------------------ */

@media (max-width: 60rem) {
  .field {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem;
    padding-block: 2.5rem;
  }
  .label { padding-top: 0; }
  .field--identity { padding-block: 0.5rem 3rem; }
}

@media (max-width: 40rem) {
  .rung__head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 1rem;
    padding-inline: 0.75rem;
    margin-inline: -0.75rem;
  }
  /* metric and tags share the top line, name drops below */
  .rung__metric { grid-row: 1; grid-column: 1; text-align: left; }
  .rung__tags   { grid-row: 1; grid-column: 2; white-space: normal; text-align: right; }
  .rung__name   { grid-row: 2; grid-column: 1 / -1; }
  .rung__detail { padding-left: 0; }

  .specs > div,
  .caps > div,
  .contact li,
  .rung__specs {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }

  .rung__specs { gap: 0.8rem; }

  .rail { letter-spacing: 0.1em; }
}

/* ---------- motion ---------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .rung__head {
    transition: background-color 0.18s ease, color 0.18s ease;
  }
}

/* ---------- print ----------------------------------------- */

@media print {
  :root { --paper: #fff; --ink: #000; --fill: #eee; }
  .rung { break-inside: avoid; }
}
