/* ═══
   ELIAS AL-MOHAMEDI — THE LEDGER
   Design law: paper field, ink states, one spine, graded
   whitespace, folding entries, baseline grid (8px).
   Two motions only: the fold (240ms) + ink fades (200ms).
   ═══ */

/* Local variable font — served from ./google font/ */
@font-face {
  font-family: 'Google Sans Flex';
  src: url('google font/GoogleSansFlex-VariableFont_GRAD,ROND,opsz,slnt,wdth,wght.ttf') format('truetype-variations');
  font-weight: 100 1000;
  font-stretch: 75% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f4f1ea;
  --ink: #141210;
  --ink-90: rgba(20, 18, 16, 0.90);
  --ink-faint: rgba(20, 18, 16, 0.35);
  --ink-ghost: rgba(20, 18, 16, 0.14);
  --correction: #e0491f;              /* correction-ink orange-red */
  --hairline: rgba(20, 18, 16, 0.18);

  --grotesk: 'Google Sans Flex', 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Google Sans Flex', 'Courier New', monospace;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --spine-x: 22%;                     /* the document's spine */
  --pad-l: clamp(24px, 6vw, 88px);
  --pad-r: clamp(24px, 7vw, 110px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink-90);
  font-family: var(--grotesk);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--correction); color: var(--paper); }

/* ── The spine: one vertical hairline, full document ── */
body::before {
  content: '';
  position: fixed;
  top: 0; bottom: 0;
  left: var(--spine-x);
  width: 1px;
  background: var(--hairline);
  pointer-events: none;
  z-index: 1;
}

/* ═══ MASTHEAD — living ledger header ═══ */
.masthead {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 16px var(--pad-r) 14px var(--pad-l);
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  z-index: 10;
}

.masthead-mark {
  font-family: var(--grotesk);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.masthead-mark a { color: var(--ink); text-decoration: none; }
.masthead-name {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin-left: 8px;
}

.masthead-readout {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.masthead-github {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 2px;
  transition: border-color 0.2s ease;
}
.masthead-github:hover { border-color: var(--ink); }

main { position: relative; z-index: 2; }

/* ═══
   BRAND ANCHOR — the signature. Large quiet field, thin frame,
   logo placeholder centered, tiny metadata at the corners.
   ═══ */
.hero { padding: 0 var(--pad-r) 0 var(--pad-l); }

.brand-anchor {
  position: relative;
  min-height: clamp(280px, 48vh, 420px);
  border: 1px solid var(--hairline);
  display: grid;
  place-items: center;
  margin-top: 40px;
}

/* corner metadata, like plate markings */
.brand-meta {
  position: absolute;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  bottom: 16px;
}
.brand-meta-left { left: 20px; }
.brand-meta-right { right: 20px; }

/* centered crosshair ticks — where the real logo will sit */
.brand-anchor::before,
.brand-anchor::after {
  content: '';
  position: absolute;
  background: var(--hairline);
}
.brand-anchor::before {
  left: 50%; top: 12px; bottom: 12px;
  width: 1px;
}
.brand-anchor::after {
  top: 50%; left: 12px; right: 12px;
  height: 1px;
}

/* the real brand logo — sits on the crosshair, paper backing knocks out the lines */
.brand-logo {
  position: relative;
  z-index: 1;
  width: clamp(96px, 14vw, 160px);
  height: auto;
  background: var(--paper);
  padding: 22px 30px;
}

/* ═══ HERO COPY ═══ */
.hero-copy { padding: 96px 0 40px; }

.eb-title {
  font-weight: 800;
  font-size: clamp(48px, 8.5vw, 118px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.eb-line { display: block; }
.eb-line-2 { margin-left: clamp(0px, 8vw, 140px); }

/* the shipping full-stop — scaled down so it reads as a stamp, not a block */
.ship-dot {
  color: var(--correction);
  font-style: normal;
  font-size: 0.38em;
  letter-spacing: 0;
}

.eb-desc {
  max-width: 46ch;
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.55;
  margin-top: 40px;
  margin-left: clamp(0px, 8vw, 140px);
  color: var(--ink-90);
}

.eb-path {
  margin-top: 64px;
  margin-left: clamp(0px, 8vw, 140px);
  display: flex;
  align-items: center;
  gap: 20px;
}

.eb-path-rule {
  flex: 0 0 72px;
  height: 1px;
  background: var(--hairline);
}

.eb-path-note {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}

/* ═══ INK STATES — links are text, density changes only ═══ */
.ink-link {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 200ms var(--ease);
}
.ink-link:hover,
.ink-link:focus-visible {
  color: var(--correction);
  outline: none;
}
.ink-faint { color: var(--ink-faint); }
.ink-faint:hover, .ink-faint:focus-visible { color: var(--correction); }

/* keyboard visibility: ink alone is not enough for focus */
.entry-head:focus-visible,
.idx:focus-visible,
.ink-link:focus-visible {
  outline: 1px solid var(--correction);
  outline-offset: 4px;
}

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

/* ═══ WORK HEAD — quiet, sentence case ═══ */
.work-head {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  padding: 96px var(--pad-r) 24px var(--pad-l);
}

/* ═══ THE LEDGER ═══ */
.ledger {
  list-style: none;
  padding: 0 var(--pad-r) 0 var(--pad-l);
}

.entry {
  position: relative;
  border-top: 1px solid var(--hairline);
}

/* active-entry indicator: the spine tick answers with ink */
.entry.is-active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: calc(var(--spine-x) - var(--pad-l) - 11px);
  width: 23px;
  height: 1px;
  background: var(--correction);
}

/* composition variants — one system, six different bodies.
   All still hang off the same grid; only scale and alignment shift. */
.entry-wide .entry-head   { padding: 56px 0 52px; }
.entry-wide .entry-title  { font-size: clamp(40px, 6vw, 88px); }
.entry-wide .entry-sentence { font-size: clamp(18px, 1.7vw, 23px); max-width: 44ch; }

.entry-tall .entry-head   { padding: 88px 0 80px; }
.entry-tall .entry-title  { font-size: clamp(30px, 3.4vw, 46px); }
.entry-tall .entry-fold-inner { max-width: 40ch; }

.entry-type .entry-title  { font-size: clamp(44px, 7vw, 104px); font-weight: 750; }
.entry-type .entry-head   { padding: 72px 0 64px; }

.entry-row .entry-head    { padding: 26px 0 24px; }
.entry-row .entry-title   { font-size: clamp(22px, 2.4vw, 30px); }

.entry-right .entry-head  { grid-template-columns: [no] 64px [title] minmax(0, 1fr) [cat] auto; }
/* explicit placement: 'order' alone breaks grid auto-placement (title collapses into the 64px column) */
.entry-right .entry-cat   { grid-column: 1; grid-row: 1; text-align: left; }
.entry-right .entry-title { grid-column: 2 / 4; grid-row: 1; justify-self: end; text-align: right; min-width: 0; max-width: 100%; overflow-wrap: break-word; }
.entry-right .entry-no    { grid-column: 3; grid-row: 2; text-align: right; }
.entry-right .entry-fold-inner { margin-left: auto; }

.entry-compact .entry-head { padding: 20px 0 18px; }
.entry-compact .entry-title { font-size: clamp(19px, 2vw, 26px); }

/* graded whitespace between compositions: dense → open → dense */
.entry-wide     { padding-bottom: 40px; }
.entry-tall     { padding-bottom: 160px; }
.entry-type     { padding-bottom: 120px; }
.entry-row      { padding-bottom: 40px; }
.entry-right    { padding-bottom: 128px; }
.entry-compact  { padding-bottom: 136px; }
.entry-reserved { padding-bottom: 168px; }

/* milepost tick on the spine */
.entry::before {
  content: '';
  position: absolute;
  top: -1px;
  left: calc(var(--spine-x) - var(--pad-l) - 5px);
  width: 11px;
  height: 1px;
  background: var(--ink-faint);
}

.entry-head {
  all: unset;
  display: grid;
  grid-template-columns: [no] 64px [title] minmax(0, 1fr) [cat] auto;
  align-items: baseline;
  gap: 24px;
  width: 100%;
  padding: 32px 0 28px;
  cursor: pointer;
}

.entry-no {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  transition: color 200ms var(--ease);
}

.entry-title {
  font-weight: 700;
  font-size: clamp(28px, 4.2vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
  transition: color 200ms var(--ease);
}

.entry-cat {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  text-align: right;
  padding-left: 32px;
  transition: color 200ms var(--ease);
}

/* ink states: resting → pressed */
.entry-head:hover .entry-title,
.entry-head:focus-visible .entry-title { color: var(--ink-90); }
.entry-head:hover .entry-no,
.entry-head:focus-visible .entry-no { color: var(--ink-90); }
.entry-head[aria-expanded='true'] .entry-no { color: var(--correction); }

/* typography changing on hover: title grows and gains weight */
.entry-title {
  transition: color 200ms var(--ease), font-variation-settings 200ms var(--ease), font-size 200ms var(--ease);
  font-variation-settings: 'wght' 700;
}
.entry-head:hover .entry-title,
.entry-head:focus-visible .entry-title {
  font-variation-settings: 'wght' 850;
}
.entry-wide:hover .entry-title  { font-size: clamp(42px, 6.4vw, 94px); }
.entry-tall:hover .entry-title  { font-size: clamp(32px, 3.7vw, 50px); }
.entry-type:hover .entry-title  { font-size: clamp(46px, 7.4vw, 110px); }
.entry-row:hover .entry-title   { font-size: clamp(24px, 2.6vw, 33px); }
.entry-compact:hover .entry-title { font-size: clamp(20px, 2.2vw, 29px); }

/* ═══ THE FOLD — clip from the spine outward, page never jumps ═══ */
.entry-fold {
  overflow: hidden;
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 240ms var(--ease),
    opacity 240ms var(--ease);
}
.entry-fold.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
}
.entry-fold-inner {
  min-height: 0;
  /* detail block hangs right of the spine, indented under the title */
  padding: 0 0 36px calc(64px + 24px + clamp(0px, 6vw, 96px));
  max-width: 72ch;
}

.entry-sentence {
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.5;
  color: var(--ink-90);
  max-width: 52ch;
}

.entry-constraint {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  line-height: 1.7;
  color: var(--ink);
  background: rgba(20, 18, 16, 0.05);   /* faint ink block, like a ledger balance column */
  padding: 12px 16px;
  margin-top: 24px;
  max-width: 60ch;
}

.entry-meta {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px 28px;
}

.entry-meta-year {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

/* ═══ 9.9 — the reserved row ═══ */
.entry-reserved {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 32px 0 28px;
  cursor: default;
}
.entry-title-reserved {
  color: var(--ink-ghost);
  font-weight: 400;
}
.entry-reserved .entry-no,
.entry-reserved .entry-cat { color: var(--ink-ghost); }

/* ═══ LIVE EMBED — the shipped product, framed like a plate ═══ */
.entry-live {
  margin-top: 32px;
  border: 1px solid var(--ink);
  background: var(--paper);
}

.entry-live-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

.entry-live-bar a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 1px;
}
.entry-live-bar a:hover { border-color: var(--ink); }

.entry-live iframe {
  display: block;
  width: 100%;
  height: clamp(360px, 62vh, 640px);
  border: 0;
  background: var(--paper);
}

/* compact tools get a shorter viewport, game gets a taller one */
.entry-tall .entry-live iframe { height: clamp(480px, 78vh, 760px); }

/* sites that refuse embedding: a designed plate instead of a broken frame */
.entry-live-blocked .entry-live-plate {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  padding: clamp(48px, 10vw, 96px) 24px;
  text-decoration: none;
  color: var(--ink);
  transition: background 200ms var(--ease);
}
.entry-live-blocked .entry-live-plate:hover { background: rgba(20, 18, 16, 0.04); }
.entry-live-plate-title {
  font-family: var(--grotesk);
  font-weight: 800;
  font-size: clamp(28px, 4.5vw, 56px);
  letter-spacing: -0.025em;
}
.entry-live-plate-note {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: var(--ink-faint);
  max-width: 48ch;
}

/* ═══ FOOTER — a closing rule, nothing more ═══ */
.ledger-end {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 64px var(--pad-r) 72px var(--pad-l);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.ledger-end a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 2px;
}
.ledger-end a:hover { border-color: var(--ink); }

/* ═══
   MOBILE — same document, spine at the edge.
   Simplified, never removed.
   ═══ */
@media (max-width: 720px) {
  :root { --spine-x: 8px; --pad-l: 28px; --pad-r: 20px; }

  .masthead { padding: 14px 20px 12px 28px; flex-direction: column; gap: 6px; }
  .masthead-name { margin-left: 6px; }

  .brand-anchor { margin-top: 40px; min-height: 220px; }
  .brand-meta { font-size: 10px; }
  .brand-meta-left { left: 14px; bottom: 12px; }
  .brand-meta-right { right: 14px; bottom: 12px; }

  .hero-copy { padding: 64px 0 24px; }
  .eb-line-2, .eb-desc { margin-left: 0; }
  .eb-title { font-size: clamp(44px, 13vw, 72px); }
  .eb-desc { margin-top: 32px; }

  .work-head { padding-top: 72px; }

  .entry-head {
    grid-template-columns: 44px 1fr;
    grid-template-areas:
      'no title'
      'no cat';
    row-gap: 10px;
    padding: 26px 0 22px;
  }
  .entry-no { grid-area: no; }
  .entry-title { grid-area: title; font-size: clamp(26px, 8vw, 40px); }
  .entry-cat { grid-area: cat; text-align: left; padding-left: 0; min-width: 0; }

  /* compositions compress but keep their distinct bodies */
  .entry-wide .entry-head   { padding: 40px 0 36px; }
  .entry-wide .entry-title  { font-size: clamp(32px, 10vw, 48px); }
  .entry-tall .entry-head   { padding: 56px 0 48px; }
  .entry-type .entry-head   { padding: 44px 0 40px; }
  .entry-type .entry-title  { font-size: clamp(34px, 11vw, 56px); }
  .entry-right .entry-head  { grid-template-columns: 44px minmax(0, 1fr); }
  .entry-right .entry-no,
  .entry-right .entry-title,
  .entry-right .entry-cat   { grid-column: auto; grid-row: auto; }
  .entry-right .entry-no    { grid-area: no; text-align: left; }
  .entry-right .entry-title { grid-area: title; justify-self: start; text-align: left; min-width: 0; }
  .entry-right .entry-cat   { grid-area: cat; text-align: left; }
  .entry-compact .entry-head { padding: 18px 0 16px; }

  .entry-tall     { padding-bottom: 96px; }
  .entry-type     { padding-bottom: 80px; }
  .entry-right    { padding-bottom: 88px; }
  .entry-compact  { padding-bottom: 80px; }
  .entry-reserved {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 16px;
    row-gap: 6px;
    padding-bottom: 120px;
  }
  .entry-reserved .entry-no   { flex: 0 0 auto; }
  .entry-title-reserved       { flex: 1 1 auto; min-width: 0; }
  .entry-reserved .entry-cat  { flex: 0 0 auto; }

  .entry-fold-inner { padding-left: 44px; padding-right: 20px; }
  .entry::before { left: 2px; width: 8px; }
}

/* Reduced motion: the law bends for accessibility */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .entry-fold { transition: none; }
}
