@font-face { font-family: 'Mowafy Sans'; font-weight: 500; font-display: swap; src: url('/fonts/MowafySans-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Mowafy Sans'; font-weight: 700; font-display: swap; src: url('/fonts/MowafySans-Bold.woff2') format('woff2'); }
@font-face { font-family: 'Fragment Mono'; font-weight: 400; font-display: swap; src: url('/fonts/FragmentMono-Regular.woff2') format('woff2'); }

:root {
  --bg: #0b0b0a;
  --panel: #121211;
  --line: #2a2a27;
  --text: #ececea;
  --dim: #9a9a95;
  --faint: #5c5c58;
  --mono: 'Fragment Mono', ui-monospace, Consolas, monospace;
  --sans: 'Mowafy Sans', Arial, sans-serif;
  --pad: clamp(16px, 4vw, 48px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.65 var(--mono); }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 4px; transition: text-decoration-color .2s; }
a:hover { text-decoration-color: var(--text); }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
::selection { background: var(--text); color: var(--bg); }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--text); color: var(--bg); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dim { color: var(--dim); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--pad); }

/* logo, set like the brand mark */
.logo { display: inline-flex; align-items: flex-start; gap: .075em; font-family: var(--sans); line-height: .8; text-decoration: none; }
.logo b { font-weight: 700; letter-spacing: -0.058em; }
.logo i { font-style: normal; font-weight: 500; font-size: .3em; letter-spacing: -0.02em; line-height: 1; padding: .14em .42em .2em; border: .09em solid currentColor; border-radius: 999px; margin-top: -.1em; }

/* top bar */
.bar { position: sticky; top: 0; z-index: 5; background: rgba(11, 11, 10, .92); border-bottom: 1px solid var(--line); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 56px; }
.bar .logo { font-size: 26px; }
.bar nav { display: flex; gap: clamp(14px, 2.4vw, 32px); font-size: 14px; }
.bar nav a { text-decoration: none; color: var(--dim); transition: color .2s; }
.bar nav a:hover, .bar nav a:focus-visible, .bar nav a[aria-current="page"] { color: var(--text); }
.bar nav a::before { content: './'; color: var(--faint); }

/* hero */
.hero { padding: clamp(40px, 7vw, 88px) 0 clamp(48px, 7vw, 96px); }
.mark { position: relative; height: clamp(260px, 42vw, 480px); margin-bottom: clamp(28px, 4vw, 48px); }
.ascii { position: absolute; inset: 0; margin: 0; font: 400 12px/12px var(--mono); white-space: pre; overflow: hidden; color: var(--text); user-select: none; -webkit-user-select: none; pointer-events: none; font-variant-ligatures: none; }
.ascii-measure { position: absolute; visibility: hidden; white-space: pre; }
.hero h1 { font-family: var(--mono); font-weight: 400; font-size: clamp(26px, 3.6vw, 46px); line-height: 1.2; letter-spacing: -0.02em; max-width: 24ch; }
.hero .status { margin-top: 20px; color: var(--dim); font-size: clamp(16px, 1.4vw, 18px); }
.caret { display: inline-block; width: .6em; height: 1.05em; background: currentColor; vertical-align: -0.15em; margin-left: .15em; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* sections, each opened by a command */
.cmd { padding: clamp(48px, 7vw, 96px) 0; border-top: 1px solid var(--line); scroll-margin-top: 56px; }
.area { scroll-margin-top: 72px; }
.prompt { color: var(--dim); font-size: 15px; margin-bottom: 28px; }
.prompt .u { color: var(--text); }
.cmd h2 { font-family: var(--mono); font-weight: 400; font-size: clamp(24px, 2.8vw, 34px); line-height: 1.25; letter-spacing: -0.015em; max-width: 30ch; }
.cmd .body { margin-top: 24px; max-width: 62ch; font-size: 17px; }
.cmd .body p + p { margin-top: 1em; }

/* a page of its own */
.page { border-top: 0; min-height: calc(100svh - 56px - 96px); }
.page h1 { font-family: var(--mono); font-weight: 400; font-size: clamp(30px, 4.2vw, 54px); line-height: 1.15; letter-spacing: -0.02em; max-width: 24ch; }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: clamp(56px, 8vw, 104px); padding-top: 20px; border-top: 1px solid var(--line); font-size: 15px; }

/* home: the directory */
.dir { border-top: 1px solid var(--line); }
.dir a { display: grid; grid-template-columns: minmax(140px, 260px) 1fr; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-size: clamp(18px, 1.8vw, 22px); transition: padding-left .25s; }
.dir a:hover, .dir a:focus-visible { padding-left: 12px; }
.dir a:hover span:first-child::before { content: '> '; }

/* research */
.areas { margin-top: 40px; border-top: 1px solid var(--line); }
.area { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(20px, 4vw, 56px); padding: 32px 0; border-bottom: 1px solid var(--line); align-items: center; }
.area h2 { font-family: var(--mono); font-weight: 400; font-size: 22px; letter-spacing: 0; }
.area p { margin-top: 12px; max-width: 46ch; color: var(--dim); }
.screen { position: relative; height: 230px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.screen .ascii { inset: 14px 16px; }

/* output rows */
.out { margin-top: 28px; font-size: 17px; }
.out li { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 24px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.out li > :first-child { color: var(--dim); }
.spin::after { content: '|'; display: inline-block; width: 1ch; margin-left: 1ch; animation: spin .8s steps(1) infinite; }
@keyframes spin { 0% { content: '|'; } 25% { content: '/'; } 50% { content: '-'; } 75% { content: '\\'; } }

/* the live prompt */
.term { margin-top: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 18px 20px; font-size: 15px; transition: border-color .2s; }
.term:focus-within { border-color: var(--faint); }
.term-log { max-height: 340px; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin-bottom: 6px; }
.term-log:empty { display: none; }
.term-log .in { color: var(--dim); }
.term-log .in::before { content: 'm4labs:~$ '; }
.term-log .gap { height: .8em; }
.term form { display: flex; gap: 1ch; align-items: center; }
.term form label { color: var(--dim); white-space: nowrap; }
.term input { flex: 1; min-width: 0; background: transparent; border: 0; padding: 6px 0; color: var(--text); caret-color: var(--text); }
.term input:focus { outline: 0; }
.hint { margin-top: 12px; font-size: 14px; color: var(--dim); }
.hint button { background: none; border: 0; padding: 2px; color: var(--text); text-decoration: underline; text-decoration-color: var(--faint); text-underline-offset: 4px; cursor: pointer; }
.hint button:hover { text-decoration-color: var(--text); }

/* footer */
.foot { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 14px; color: var(--dim); }
.foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot ul { display: flex; gap: 20px; }

/* typing: the text is in the HTML; the script replays it once on reveal */
.js [data-type].pending { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caret, .spin::after { animation: none; }
}

@media (max-width: 760px) {
  .area { grid-template-columns: 1fr; }
  .screen { height: 200px; }
  .out li { grid-template-columns: 1fr; gap: 2px; }
  .dir a { grid-template-columns: 1fr; gap: 0; }
  .bar nav { display: flex; gap: 12px; font-size: 13px; overflow-x: auto; }
  .bar nav a::before { content: none; }
  .ascii { font-size: 10px; line-height: 10px; }
  .screen .ascii { font-size: 11px; line-height: 11px; inset: 12px; }
  .mark { height: 46vw; min-height: 170px; }
}
