/*
 * Afniah-CAD landing page.
 *
 * Layout: the page is one engineering drawing sheet lying on a desk. A bordered
 * sheet with grid references along its edges, the content inside the border, a
 * title block at the bottom carrying the credits, and a CAD status bar fixed
 * below the sheet with live coordinates and the paper/model toggle.
 *
 * Light is paper space, dark is model space. Every colour is a token below; the
 * three brand greys are --g1, --g2 and --g3, the rest are tints derived from them.
 */
:root {
  --desk: #e9eaec;
  --sheet: #fdfdfd;
  --ink: #3c3d40;
  --text: #5a5b5e;
  --g1: #757679;
  --g2: #8c8e90;
  --g3: #b6b8ba;
  --rule: #dadbdd;
  --rule-soft: #ecedef;
  --show-light: block;
  --show-dark: none;
  --logo-blend: multiply;

  --hairline-plate: var(--sheet);
  --hairline-hi: var(--ink);
  --hairline-edge: var(--g2);
  --hairline-mid: var(--g3);
  --hairline-lo: var(--rule);

  --font-sans: "Fedra Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --font-arabic: "29LT Azer", "Fedra Sans", "Segoe UI", system-ui, sans-serif;

  --pad: clamp(1.25rem, 4.5vw, 4rem);
  --ease: cubic-bezier(0.5, 0, 0.1, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #131416;
    --sheet: #1d1e22;
    --ink: #e4e5e7;
    --text: #b4b5b8;
    --g1: #b6b8ba;
    --g2: #8c8e90;
    --g3: #66686c;
    --rule: #34353a;
    --rule-soft: #27282c;
    --show-light: none;
    --show-dark: block;
    --logo-blend: normal;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #131416;
  --sheet: #1d1e22;
  --ink: #e4e5e7;
  --text: #b4b5b8;
  --g1: #b6b8ba;
  --g2: #8c8e90;
  --g3: #66686c;
  --rule: #34353a;
  --rule-soft: #27282c;
  --show-light: none;
  --show-dark: block;
  --logo-blend: normal;
  color-scheme: dark;
}

@font-face { font-family: "Fedra Sans"; font-weight: 300; font-style: normal; font-display: swap; src: url("assets/fonts/FedraSans-Light.woff2") format("woff2"), url("assets/fonts/FedraSans-Light.otf") format("opentype"); }
@font-face { font-family: "Fedra Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("assets/fonts/FedraSans-Book.woff2") format("woff2"), url("assets/fonts/FedraSans-Book.otf") format("opentype"); }
@font-face { font-family: "Fedra Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("assets/fonts/FedraSans-Bold.woff2") format("woff2"), url("assets/fonts/FedraSans-Bold.otf") format("opentype"); }
/* DM Mono (SIL Open Font License, see assets/fonts/OFL-DMMono.txt), Latin subset, served with the page. */
@font-face { font-family: "DM Mono"; font-weight: 300; font-style: normal; font-display: swap; src: url("assets/fonts/DMMono-Light.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "DM Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("assets/fonts/DMMono-Regular.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "29LT Azer"; font-weight: 300; font-style: normal; font-display: swap; src: url("assets/fonts/Azer-Light.woff2") format("woff2"), url("assets/fonts/Azer-Light.otf") format("opentype"); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--text);
  font: 400 1.0625rem/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 3px; }

/* ---------- the desk and the sheet ---------- */
.desk { padding: 12px 12px 56px; }
.sheet {
  position: relative;
  max-width: 1360px;
  margin: 0 auto;
  background: var(--sheet);
  padding: 2.25rem var(--pad) 2.75rem;
  isolation: isolate;
}
.sheet-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 3;
}
.sheet-frame rect {
  fill: none;
  stroke: var(--g2);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.sheet-frame .inner { stroke: var(--rule); }

/* grid references along the sheet's edges, as on a drawing sheet */
.refs {
  position: absolute;
  display: flex;
  justify-content: space-around;
  font: 300 0.625rem/1 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--g3);
  pointer-events: none;
  z-index: 2;
  user-select: none;
}
.refs-top, .refs-bottom { left: 0; right: 0; height: 1rem; align-items: center; }
.refs-top { top: 0.4rem; }
.refs-bottom { bottom: 0.4rem; }
.refs-left, .refs-right { top: 0; bottom: 0; width: 1.1rem; flex-direction: column; align-items: center; }
.refs-left { left: 0.3rem; }
.refs-right { right: 0.3rem; }

/* ---------- masthead ---------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-block: 0.25rem 0;
}
.brand { display: block; text-decoration: none; }
.logo { height: 46px; width: auto; }
.logo-light { display: var(--show-light); mix-blend-mode: var(--logo-blend); }
.logo-dark { display: var(--show-dark); }
.nav { display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 2rem); flex-wrap: wrap; }
.nav a { font: 400 0.9375rem/1 var(--font-sans); text-decoration: none; color: var(--text); position: relative; padding-block: 0.4rem; }
.nav a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: var(--ink);
  transition: right 320ms var(--ease);
}
.nav a:not(.btn):hover::after, .nav a:not(.btn):focus-visible::after { right: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.95rem 1.5rem;
  background: var(--ink); color: var(--sheet);
  font: 700 0.875rem/1 var(--font-sans); letter-spacing: 0.04em; text-decoration: none;
  border: 1px solid var(--ink);
  transition: background 220ms var(--ease), color 220ms var(--ease), border-color 220ms var(--ease);
}
.btn:hover, .btn:focus-visible { background: var(--g1); border-color: var(--g1); color: var(--sheet); }
.btn-small { padding: 0.65rem 1.1rem; font-size: 0.8125rem; }
.nav a.btn { color: var(--sheet); font-weight: 700; padding-block: 0.65rem; }
.nav a.btn:hover, .nav a.btn:focus-visible { color: var(--sheet); }
.link { font: 400 0.9375rem/1 var(--font-sans); color: var(--text); text-decoration: underline; text-underline-offset: 0.3em; text-decoration-color: var(--g3); }
.link:hover { color: var(--ink); text-decoration-color: var(--ink); }

/* ---------- type ---------- */
.eyebrow {
  margin: 0;
  font: 700 0.6875rem/1.4 var(--font-sans);
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--g2);
}
.eyebrow .sep { color: var(--g3); padding-inline: 0.35em; }
h1, h2, h3 { margin: 0; color: var(--ink); font-weight: 300; text-wrap: balance; }
h1 { font-size: clamp(2.75rem, 6.4vw, 5.25rem); line-height: 1.02; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.15; letter-spacing: -0.005em; }
h3 { font-size: 1.25rem; font-weight: 400; line-height: 1.3; }
p { margin: 0; }
.lede { font-size: clamp(1.0625rem, 1.5vw, 1.25rem); line-height: 1.5; max-width: 32em; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ar { font-family: var(--font-arabic); font-weight: 300; direction: rtl; unicode-bidi: isolate; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding-block: clamp(2.5rem, 6vw, 5.5rem) clamp(2rem, 5vw, 4.5rem);
}
.curves {
  position: absolute;
  left: calc(-1 * var(--pad)); right: calc(-1 * var(--pad));
  bottom: -4%;
  width: calc(100% + 2 * var(--pad));
  height: 72%;
  pointer-events: none;
  z-index: 0;
}
.curves path {
  fill: none; stroke: var(--g3); stroke-width: 1; vector-effect: non-scaling-stroke;
  stroke-dasharray: 1; stroke-dashoffset: 0;
}
.hero-copy { position: relative; z-index: 1; display: grid; gap: 1.5rem; max-width: 36rem; }
.hero-copy h1 { margin-top: -0.25rem; }
.actions { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.hint { font: 400 0.8125rem/1.5 var(--font-sans); color: var(--g2); max-width: 28em; }

/* ---------- figures ---------- */
.fig { margin: 0; position: relative; display: grid; gap: 0.9rem; min-width: 0; }
.fig-hero { z-index: 1; justify-self: end; width: 100%; max-width: 640px; }
.stage {
  display: block; position: relative; width: 100%; aspect-ratio: 5 / 4; max-width: 100%;
  border: 1px solid var(--rule-soft);
  touch-action: pan-y;
}
.stage:hover { border-color: var(--rule); }
.read {
  position: absolute; top: 0.6rem; right: 0.75rem;
  font: 400 0.6875rem/1 var(--font-mono); letter-spacing: 0.04em; color: var(--g2);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.fig:hover .read { color: var(--ink); }
.fig figcaption { display: grid; gap: 0.4rem; }
.fig figcaption p { font-size: 0.9375rem; line-height: 1.5; max-width: 30em; }

/* ---------- sections ---------- */
.section { padding-block: clamp(3rem, 6.5vw, 5.5rem); border-top: 1px solid var(--rule); }
.sec-head { display: grid; gap: 0.85rem; max-width: 40rem; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
.fig-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5rem clamp(1.5rem, 3vw, 2.5rem); }

/* the schedule, set like a door or finish schedule on a drawing */
.schedule { width: 100%; border-collapse: collapse; border-top: 1px solid var(--g2); border-bottom: 1px solid var(--g2); }
.schedule th, .schedule td { text-align: left; vertical-align: top; padding: 0.95rem 1rem 0.95rem 0; border-top: 1px solid var(--rule); }
.schedule tr:first-child th, .schedule tr:first-child td { border-top: 0; }
.schedule th { width: 11rem; font: 700 0.6875rem/1.9 var(--font-sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--g2); }
.schedule td { font-size: 1rem; line-height: 1.5; color: var(--ink); }
.spec-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.notes { margin: 0; padding: 0; list-style: none; counter-reset: note; display: grid; gap: 1rem; border-top: 1px solid var(--g2); padding-top: 1.25rem; }
.notes li { counter-increment: note; display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: 0.5rem; font-size: 0.9375rem; line-height: 1.5; }
.notes li::before { content: counter(note, decimal-leading-zero); font: 400 0.75rem/1.9 var(--font-mono); color: var(--g2); }
.notes-title { margin-bottom: 1rem; }

/* ---------- title block ---------- */
.title-block {
  margin-top: clamp(2.5rem, 6vw, 5rem);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  border: 1px solid var(--g2);
}
.tb-logo { display: grid; place-items: center; padding: 1.25rem 1.5rem; border-right: 1px solid var(--rule); }
.tb-logo .logo { height: 40px; }
.tb-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.tb-grid > div { padding: 0.7rem 0.9rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); min-width: 0; }
.tb-grid > div:nth-child(5n) { border-right: 0; }
.tb-grid > div:nth-last-child(-n + 5) { border-bottom: 0; }
.tb-grid dt { font: 700 0.625rem/1.6 var(--font-sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--g2); }
.tb-grid dd { margin: 0; font-size: 0.9375rem; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.tb-grid .num dd { font: 400 0.8125rem/1.6 var(--font-mono); font-variant-numeric: tabular-nums; }
.tb-cta { display: grid; place-items: center; padding: 1.25rem 1.5rem; border-left: 1px solid var(--rule); }

/* ---------- crosshair and status bar ---------- */
.crosshair { position: fixed; inset: 0; pointer-events: none; z-index: 40; display: none; --x: -100px; --y: -100px; }
.has-pointer .crosshair { display: block; }
.crosshair i { position: absolute; display: block; background: var(--g2); opacity: 0.55; }
.ch-x { left: 0; right: 0; top: 0; height: 1px; transform: translateY(var(--y)); }
.ch-y { top: 0; bottom: 0; left: 0; width: 1px; transform: translateX(var(--x)); }
.ch-box {
  left: 0; top: 0; width: 9px; height: 9px; margin: -5px 0 0 -5px;
  background: transparent !important; border: 1px solid var(--g1); opacity: 0.9;
  transform: translate(var(--x), var(--y));
}
.has-pointer .sheet { cursor: crosshair; }
.has-pointer .sheet a, .has-pointer .sheet button { cursor: pointer; }
.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: calc(32px + env(safe-area-inset-bottom, 0px));
  padding: 0 14px env(safe-area-inset-bottom, 0px);
  background: var(--sheet); border-top: 1px solid var(--rule);
  font: 400 0.6875rem/1 var(--font-mono); letter-spacing: 0.04em; color: var(--g2);
  font-variant-numeric: tabular-nums;
}
.coords { display: flex; gap: 0.5rem 0.75rem; align-items: center; }
.coords output { color: var(--ink); min-width: 5.5ch; display: inline-block; }
.status-right { display: flex; align-items: center; gap: 1.25rem; }
.space {
  font: inherit; letter-spacing: inherit; text-transform: uppercase;
  color: var(--ink); background: transparent; border: 1px solid var(--rule);
  padding: 0.35rem 0.7rem; cursor: pointer;
}
.space:hover { border-color: var(--ink); }

/* ---------- the plot-in on load ---------- */
@media (prefers-reduced-motion: no-preference) {
  .sheet-frame rect, .curves path { stroke-dashoffset: 1; animation: plot 1.5s var(--ease) forwards; }
  .sheet-frame .inner { animation-delay: 0.25s; }
  .curves path:nth-child(1) { animation-duration: 1.9s; animation-delay: 0.35s; }
  .curves path:nth-child(2) { animation-duration: 1.9s; animation-delay: 0.6s; }
  .hero-copy > * { animation: rise 0.7s var(--ease) both; }
  .hero-copy > :nth-child(1) { animation-delay: 0.25s; }
  .hero-copy > :nth-child(2) { animation-delay: 0.35s; }
  .hero-copy > :nth-child(3) { animation-delay: 0.45s; }
  .hero-copy > :nth-child(4) { animation-delay: 0.55s; }
  .hero-copy > :nth-child(5) { animation-delay: 0.65s; }
  .fig-hero { animation: rise 0.9s var(--ease) 0.5s both; }
}
@keyframes plot { to { stroke-dashoffset: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- widths ---------- */
@media (max-width: 1000px) {
  .fig-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec-grid { grid-template-columns: minmax(0, 1fr); }
  .tb-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tb-grid > div:nth-child(5n) { border-right: 1px solid var(--rule); }
  .tb-grid > div:nth-last-child(-n + 5) { border-bottom: 1px solid var(--rule); }
  .tb-grid > div:nth-child(3n) { border-right: 0; }
  .tb-grid > div:nth-last-child(-n + 1) { border-bottom: 0; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .fig-hero { justify-self: stretch; max-width: none; }
  .curves { height: 48%; bottom: 0; }
  .title-block { grid-template-columns: minmax(0, 1fr); }
  .tb-logo { border-right: 0; border-bottom: 1px solid var(--rule); justify-items: start; }
  .tb-cta { border-left: 0; border-top: 1px solid var(--rule); justify-items: start; }
  .refs-left, .refs-right { display: none; }
}
@media (max-width: 600px) {
  .desk { padding: 8px 8px 52px; }
  .sheet { padding-top: 1.75rem; }
  .fig-grid { grid-template-columns: minmax(0, 1fr); }
  .tb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-grid > div:nth-child(3n) { border-right: 1px solid var(--rule); }
  .tb-grid > div:nth-child(2n) { border-right: 0; }
  .tb-grid > div:nth-last-child(-n + 1) { border-bottom: 1px solid var(--rule); }
  .tb-grid > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .schedule th { width: 7.5rem; }
  .coords { display: none; }
  .nav a:not(.btn) { display: none; }
}

/* Into the app, the two pages cross-fade where the browser can (the app opts in too). */
@view-transition { navigation: auto; }
