/* randomst7.com — built on the Randoms by T7 design system.
   Night = dark, Day = light. Every pair below is checked in tests/run.mjs. */

@font-face { font-family: "Jost"; src: url("/fonts/Jost-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Jost"; src: url("/fonts/Jost-Italic-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Tajarib"; src: url("/fonts/Tajarib-Light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Tajarib"; src: url("/fonts/Tajarib-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Tajarib"; src: url("/fonts/Tajarib-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Tajarib"; src: url("/fonts/Tajarib-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Tajarib"; src: url("/fonts/Tajarib-Black.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root {
  /* Fixed brand colours */
  --void: #000000;
  --fog: #dadada;
  --roll-tomato: #ff5a36;
  --roll-yolk: #ffc21f;
  --roll-mint: #2fd68f;
  --roll-sky: #5c8dff;
  --roll-lilac: #b69bff;
  --roll-bubble: #ff8ac9;
  --on-roll: #000000;
  --roll: var(--roll-tomato);

  /* Night (default) */
  --ground: #000000;
  --ground-raised: #111111;
  --paper: #161616;
  --line: #2a2a2a;
  --text: #dadada;
  --text-muted: #8a8a8a;
  --focus: #dadada;
  --tape: rgba(218, 218, 218, 0.16);
  --grain-opacity: 0.035;
  --grid: rgba(218, 218, 218, 0.055);
  color-scheme: dark;

  --font-sans: "Jost", "Tajarib", "Futura", "Century Gothic", system-ui, sans-serif;
  --font-ar: "Tajarib", "Jost", "Geeza Pro", "Segoe UI", system-ui, sans-serif;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px;
  --space-8: 32px; --space-12: 48px; --space-16: 64px; --space-24: 96px;
  --radius-sm: 6px; --radius-md: 14px; --radius-lg: 28px; --radius-pill: 999px;
  --stroke-icon: 2.25px;
  --max: 1200px;
}

/* Day: follows the device unless the visitor picked a theme */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground: #dadada; --ground-raised: #ebebeb; --paper: #f2f2f2; --line: #bdbdbd;
    --text: #000000; --text-muted: #5e5e5e; --focus: #000000;
    --tape: rgba(0, 0, 0, 0.10); --grain-opacity: 0.09; --grid: rgba(0, 0, 0, 0.07);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --ground: #dadada; --ground-raised: #ebebeb; --paper: #f2f2f2; --line: #bdbdbd;
  --text: #000000; --text-muted: #5e5e5e; --focus: #000000;
  --tape: rgba(0, 0, 0, 0.10); --grain-opacity: 0.09; --grid: rgba(0, 0, 0, 0.07);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--ground);
  /* Grid paper: the desk everything is pinned to */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 400;
  overflow-x: hidden;
}
/* Paper grain: the mixed-media base layer. Decorative only. */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--roll); color: var(--on-roll); }

[lang="ar"] { font-family: var(--font-ar); letter-spacing: 0 !important; }
.ar { font-family: var(--font-ar); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-4); top: -100px; z-index: 100;
  background: var(--text); color: var(--ground); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill); font-weight: 500; text-decoration: none;
}
.skip-link:focus { top: var(--space-4); }

.wrap { width: min(100% - 2 * var(--space-4), var(--max)); margin-inline: auto; }
@media (min-width: 720px) { .wrap { width: min(100% - 2 * var(--space-8), var(--max)); } }

/* Type scale (from tokens) */
.display-xl { font-size: clamp(56px, 11vw, 112px); line-height: 0.9; font-weight: 500; letter-spacing: -0.035em; margin: 0; }
.display { font-size: clamp(44px, 8vw, 72px); line-height: 0.95; font-weight: 500; letter-spacing: -0.03em; margin: 0; }
.headline { font-size: clamp(32px, 5vw, 44px); line-height: 1.05; font-weight: 500; letter-spacing: -0.02em; margin: 0; }
.title { font-size: 26px; line-height: 1.2; font-weight: 500; letter-spacing: -0.01em; margin: 0; }
.body-lg { font-size: 19px; line-height: 1.5; }
.label { font-size: 12px; line-height: 1.35; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; }
.caption { font-size: 13px; line-height: 1.4; letter-spacing: 0.01em; }
.muted { color: var(--text-muted); }
.ar-display { font-family: var(--font-ar); font-size: clamp(40px, 7vw, 72px); line-height: 1.15; font-weight: 700; margin: 0; }
.ar-headline { font-family: var(--font-ar); font-size: clamp(28px, 4.5vw, 44px); line-height: 1.3; font-weight: 700; margin: 0; }
.ar-title { font-family: var(--font-ar); font-size: 24px; line-height: 1.45; font-weight: 500; margin: 0; }
.ar-body { font-family: var(--font-ar); font-size: 18px; line-height: 1.8; }

/* ===== Tumble and Capsule (Brand Guidelines 05) — markup from src/fx.mjs =====
   Landed state first, so it shows with no script and with reduced motion. */
.tb { display: inline-block; transform-origin: 50% 60%; }
.tb-w { display: inline-block; white-space: nowrap; }
.tb-u { display: inline-block; transform: translateY(var(--y, 0em)) rotate(var(--t, 0deg)); transform-origin: 50% 60%; }
.tb-u + .tb-u { margin-inline-start: 0.02em; }
.cap {
  display: inline-block; white-space: nowrap;
  padding: 0.02em 0.32em 0.1em; margin-inline: 0.04em;
  border-radius: 999px; /* round ends, never outlined */
  background: var(--c, var(--roll)); color: var(--on-roll);
  transform: rotate(var(--ct, -6deg)); transform-origin: 50% 55%;
  line-height: 1.05;
}
[dir="rtl"] .cap { padding: 0.02em 0.36em 0.14em; line-height: 1.35; }

/* Header */
.site-header { padding-block: var(--space-6); position: relative; z-index: 30; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: var(--space-3); text-decoration: none; color: var(--text); }
.brand svg { width: auto; height: 46px; }
.brand-name { font-weight: 500; letter-spacing: -0.01em; }
.nav { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.nav a, .settings summary {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-4);
  border-radius: var(--radius-pill); border: 1.5px solid var(--line);
  background: transparent; color: var(--text); font: inherit; font-weight: 500;
  text-decoration: none; cursor: pointer;
}
.nav a:hover, .settings summary:hover { border-color: var(--text); }
.nav a[aria-current="page"] { background: var(--text); color: var(--ground); border-color: var(--text); }

/* Settings menu (theme + language) */
.settings { position: relative; }
.settings summary { list-style: none; }
.settings summary::-webkit-details-marker { display: none; }
.settings summary svg { width: 20px; height: 20px; }
.settings summary .icon-chevron { width: 16px; height: 16px; transition: transform 200ms ease; }
.settings[open] summary { border-color: var(--text); }
.settings[open] summary .icon-chevron { transform: rotate(180deg); }
.settings-panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 50;
  width: 240px; padding: var(--space-3); display: grid; gap: var(--space-3);
  background: var(--ground-raised); color: var(--text);
  border: 1.5px solid var(--line); border-radius: var(--radius-md);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
}
.settings-group { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; }
.settings-group legend, .settings-group .legend { padding: 0 var(--space-2) var(--space-1); margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
[dir="rtl"] .settings-group legend, [dir="rtl"] .settings-group .legend { letter-spacing: 0; font-size: 14px; }
.settings .opt {
  display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-3);
  border-radius: var(--radius-pill); border: 1.5px solid transparent; color: var(--text); text-decoration: none; cursor: pointer;
}
.settings .opt svg { width: 18px; height: 18px; flex: none; }
.settings .opt:hover { border-color: var(--line); }
.settings .opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.settings .opt:has(input:checked), .settings .opt[aria-current="true"] { background: var(--text); color: var(--ground); }
.settings .opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Theme choices need JavaScript; hide that group if it isn't running. */
:root:not([data-theme]) [data-theme-group] { display: none; }
@media (max-width: 520px) { .settings-text { display: none; } .settings summary { padding: 0 var(--space-3); } }
/* Phones: the panel spans the header instead of hanging off one button */
@media (max-width: 700px) {
  .site-header .wrap { position: relative; }
  .settings { position: static; }
  .settings-panel { inset-inline: 0; width: auto; }
}

/* Right-to-left (Arabic) */
[dir="rtl"] body { font-family: var(--font-ar); }
[dir="rtl"] .icon-arrow { transform: scaleX(-1); }
[dir="rtl"] .label { letter-spacing: 0.04em; }
[dir="rtl"] .desk-intro, [dir="rtl"] .ar-body { line-height: 1.8; }
[dir="rtl"] .prose { font-size: 17px; line-height: 1.85; }
[dir="rtl"] .prose h2 { font-family: var(--font-ar); font-weight: 700; }

/* Buttons: the capsule */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0 var(--space-6); border-radius: var(--radius-pill);
  font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; border: 2px solid transparent;
}
.btn svg { width: 20px; height: 20px; }
.btn-roll { background: var(--roll); color: var(--on-roll); }
.btn-roll:hover { border-color: var(--text); }
.btn-line { background: transparent; color: var(--text); border-color: var(--text); }
.btn-line:hover { background: var(--text); color: var(--ground); }
.btn[disabled] { opacity: .6; cursor: progress; }

/* Seed tag */
.seed {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 6px 12px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--line); color: var(--text-muted);
}
.seed .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--roll); flex: none; }

/* Mixed media: stickers, tape, paper */
.sticker {
  display: inline-grid; place-items: center;
  background: var(--paper); color: var(--text);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 0 0 3px var(--ground), 0 0 0 4.5px var(--line), 0 10px 24px rgba(0, 0, 0, .18);
}
.sticker--s { width: 76px; }
.sticker--m { width: 112px; }
.sticker--l { width: 168px; }
.sticker--xl { width: 220px; }
.sticker .sticker-art { width: 100%; height: auto; }
.tape {
  position: absolute; width: 92px; height: 26px; background: var(--tape);
  transform: rotate(var(--tilt, -6deg)); border-radius: 2px;
  -webkit-mask: linear-gradient(90deg, transparent 0 3px, #000 3px calc(100% - 3px), transparent calc(100% - 3px));
          mask: linear-gradient(90deg, transparent 0 3px, #000 3px calc(100% - 3px), transparent calc(100% - 3px));
  pointer-events: none;
}
.paper {
  position: relative; background: var(--paper); border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .16);
}

/* Sections */
.section { padding-block: var(--space-16); border-top: 1.5px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-8); }
.bi { display: flex; flex-direction: column; gap: var(--space-1); }

/* Work cards */
.work-grid { display: grid; gap: var(--space-8); }
@media (min-width: 760px) { .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.work-card { position: relative; display: block; text-decoration: none; color: var(--text); }
.work-card .frame {
  position: relative; border-radius: var(--radius-md); overflow: hidden;
  background: var(--paper); transform: rotate(var(--tilt, -1deg));
  box-shadow: 0 0 0 1.5px var(--line), 0 14px 30px rgba(0, 0, 0, .18);
  transition: transform 300ms ease;
}
@media (prefers-reduced-motion: reduce) { .work-card .frame { transition: none; } }
.work-card:hover .frame, .work-card:focus-visible .frame { transform: rotate(0deg); }
.work-card .tape { top: -10px; left: 24px; z-index: 2; }
.work-card .meta { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); margin-top: var(--space-4); flex-wrap: wrap; }
.work-card h3 { margin: 0; }

/* Project page */
.project-head { padding-block: var(--space-12) var(--space-8); }
.project-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-6); }
.project-summary { display: grid; gap: var(--space-6); margin-top: var(--space-8); }
@media (min-width: 900px) { .project-summary { grid-template-columns: 1fr 1fr; } }
.project-summary p { margin: 0; }
.figures { display: grid; gap: var(--space-16); padding-block: var(--space-8) var(--space-16); }
figure { margin: 0; }
.figure-frame { position: relative; padding: var(--space-3); }
.figure-frame img { border-radius: var(--radius-md); box-shadow: 0 0 0 1.5px var(--line), 0 18px 40px rgba(0, 0, 0, .22); }
.figure-frame .tape { top: 0; left: 40px; z-index: 2; }
.figure-frame .tape.r { left: auto; right: 40px; }
figcaption { display: grid; gap: var(--space-2); margin-top: var(--space-4); }
figcaption .row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); flex-wrap: wrap; }
figcaption p { margin: 0; max-width: 60ch; }

/* Contact */
.contact-grid { display: grid; gap: var(--space-12); padding-block: var(--space-12) var(--space-16); }
@media (min-width: 960px) { .contact-grid { grid-template-columns: 1fr 1.1fr; align-items: start; } }
.form { display: grid; gap: var(--space-6); padding: var(--space-8); }
@media (max-width: 520px) { .form { padding: var(--space-6) var(--space-4); } }
.field { display: grid; gap: var(--space-2); }
.field label { font-weight: 500; }
.field .hint { font-size: 14px; color: var(--text-muted); }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--ground);
  border: 1.5px solid var(--text-muted); border-radius: var(--radius-sm);
  padding: 12px 14px; min-height: 48px;
}
.field textarea { min-height: 160px; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-color: var(--text); }
.field [aria-invalid="true"] { border-color: var(--text); border-width: 2.5px; }
.error-text { font-size: 14px; font-weight: 500; }
.error-text:empty { display: none; }
.error-text::before { content: "⚠︎ "; }
.check { display: grid; grid-template-columns: 24px 1fr; gap: var(--space-3); align-items: start; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--text); }
.hp { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.form-status { border-radius: var(--radius-md); padding: var(--space-4); border: 1.5px solid var(--line); }
.form-status:empty { display: none; }
.form-status.ok { background: var(--roll-mint); color: var(--on-roll); border-color: transparent; }
.form-status.err { border-color: var(--text); }
.email-card { padding: var(--space-6); margin-top: var(--space-8); }
.email-card a { font-size: 22px; font-weight: 500; word-break: break-all; }

/* Prose (legal pages) */
.prose { max-width: 72ch; padding-block: var(--space-12) var(--space-16); }
.prose h1 { margin-bottom: var(--space-3); }
.prose h2 { font-size: 24px; line-height: 1.25; font-weight: 500; margin: var(--space-12) 0 var(--space-3); letter-spacing: -0.01em; }
.prose h3 { font-size: 18px; font-weight: 500; margin: var(--space-8) 0 var(--space-2); }
.prose p, .prose li { max-width: 70ch; }
.prose ul { padding-inline-start: 1.25em; }
.prose li { margin-bottom: var(--space-2); }
.prose table { width: 100%; border-collapse: collapse; margin: var(--space-4) 0; font-size: 15px; }
.prose th, .prose td { text-align: start; vertical-align: top; padding: 10px 12px; border-bottom: 1.5px solid var(--line); }
.prose th { font-weight: 500; }
.table-scroll { overflow-x: auto; }
.ar-summary { margin-top: var(--space-8); padding: var(--space-6); border-radius: var(--radius-md); background: var(--ground-raised); }
.ar-summary p { margin: 0 0 var(--space-3); }

/* Footer */
.site-footer { border-top: 1.5px solid var(--line); padding-block: var(--space-12); margin-top: var(--space-8); }
.footer-grid { display: grid; gap: var(--space-8); }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 1.4fr 1fr; } }
.footer-grid p { margin: 0 0 var(--space-2); }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); list-style: none; padding: 0; margin: 0; }
.footer-links a { display: inline-block; padding-block: 10px; }
.footer-stickers { display: flex; gap: var(--space-4); margin-top: var(--space-6); }

/* 404 */
.lost { padding-block: var(--space-24); text-align: center; display: grid; justify-items: center; gap: var(--space-6); }

/* ===== The desk: home hero collage ===== */
.desk { position: relative; width: min(100% - 2 * var(--space-4), 1360px); margin: 0 auto; padding-block: var(--space-8) var(--space-12); overflow-x: clip; overflow-y: visible; }
.desk-center { position: relative; z-index: 5; display: grid; justify-items: center; text-align: center; gap: var(--space-3); max-width: 540px; margin: 0 auto; }
.desk-mark { color: var(--text); width: min(70%, 250px); margin-bottom: var(--space-2); }
.desk-mark svg { width: 100%; height: auto; }
.desk-center .display { font-size: clamp(40px, 6vw, 60px); }
.desk-center .ar-headline { margin-bottom: var(--space-2); }
.desk-intro { margin: 0; max-width: 32em; }
.desk-center .hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin-top: var(--space-4); }

.desk-items .it { position: absolute; transform: rotate(var(--r, 0deg)); }
@media (prefers-reduced-motion: no-preference) {
  .desk-items .it { transition: transform 350ms cubic-bezier(.34, 1.56, .64, 1); }
  .desk:hover .desk-items .it.badge { transform: rotate(calc(var(--r) * .5)); }
}
.shadow-paper { box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 14px 28px rgba(0, 0, 0, .22); }

/* Badge on a lanyard */
.badge { --r: -4deg; width: 190px; display: grid; justify-items: center; }
.badge .strap { width: 30px; height: 120px; background: var(--text); color: var(--ground); display: grid; place-items: center; overflow: hidden; border-radius: 2px 2px 0 0; }
.badge .strap span { writing-mode: vertical-rl; font-size: 9px; letter-spacing: .3em; font-weight: 500; white-space: nowrap; }
.badge .clip { width: 46px; height: 16px; border: 3px solid var(--text-muted); border-radius: 8px; margin-top: -2px; }
.badge .card { width: 100%; border-radius: var(--radius-md); overflow: hidden; margin-top: -4px; box-shadow: 0 0 0 1.5px var(--line), 0 16px 32px rgba(0,0,0,.28); }
.badge .card-top { background: var(--void); color: var(--fog); padding: 14px 14px 16px; display: grid; justify-items: center; gap: 4px; text-align: center; position: relative; }
.badge .card-top .label { color: #8a8a8a; font-size: 10px; }
.badge .ar-tag { position: absolute; top: 10px; inset-inline-end: 12px; font-family: var(--font-ar); font-size: 13px; color: #8a8a8a; }
.badge .avatar { width: 78px; margin: 8px 0 4px; border-radius: 50%; box-shadow: 0 0 0 3px var(--c, var(--roll)); }
.badge strong { font-weight: 500; font-size: 15px; }
.badge .small { font-size: 12px; color: #8a8a8a; }
.badge .card-bottom { background: var(--fog); color: var(--void); padding: 12px 14px; display: grid; gap: 10px; justify-items: center; }
.seed-mini { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; letter-spacing: .14em; font-weight: 500; border: 1.5px solid #5e5e5e; border-radius: var(--radius-pill); padding: 4px 10px; }
.seed-mini i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--roll)); }
.barcode { display: block; width: 120px; height: 26px; background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 4px, currentColor 4px 5px, transparent 5px 8px, currentColor 8px 11px, transparent 11px 12px); }
.barcode.wide { width: 100%; height: 30px; }

/* Torn paper strip with taped stickers */
.strip { --r: -3deg; width: 330px; height: 150px; background: var(--paper); display: flex; align-items: center; justify-content: space-around; padding: 0 16px;
  clip-path: polygon(0% 8%, 4% 2%, 9% 7%, 14% 1%, 20% 6%, 26% 0%, 31% 5%, 37% 1%, 43% 7%, 49% 2%, 55% 6%, 61% 0%, 67% 5%, 73% 1%, 79% 7%, 85% 2%, 91% 6%, 96% 1%, 100% 5%, 100% 94%, 96% 99%, 90% 94%, 84% 100%, 78% 95%, 72% 99%, 66% 93%, 60% 99%, 54% 94%, 48% 100%, 42% 95%, 36% 99%, 30% 93%, 24% 99%, 18% 94%, 12% 100%, 6% 95%, 0% 99%);
  filter: drop-shadow(0 12px 14px rgba(0,0,0,.22)); }
.strip-sticker { width: 78px; color: var(--text); }
.strip-sticker svg { width: 100%; height: auto; }
.strip .s1 { transform: rotate(-6deg); } .strip .s2 { transform: rotate(6deg) translateY(-6px); } .strip .s3 { transform: rotate(-16deg); }
.strip .tape-a { top: 8px; left: 120px; }

/* Postage stamp: perforated edge drawn with a dotted ring in the ground colour */
.stamp { --r: 8deg; width: 132px; padding: 9px; background: var(--fog); position: absolute; box-shadow: 0 10px 18px rgba(0,0,0,.25); }
.stamp::before { content: ""; position: absolute; inset: -4px; border: 6px dotted var(--ground); border-radius: 2px; pointer-events: none; }
.stamp-inner { border: 1.5px solid var(--void); color: var(--void); background: var(--c, var(--roll)); padding: 8px 6px 6px; display: grid; justify-items: center; gap: 2px; }
.stamp-inner svg { width: 92px; height: auto; }
.stamp-name { font-weight: 600; font-size: 11px; letter-spacing: .16em; line-height: 1.3; }
[dir="rtl"] .stamp-name { font-family: var(--font-ar); font-weight: 700; font-size: 16px; letter-spacing: 0; }
.stamp-year { font-size: 9px; letter-spacing: .16em; font-weight: 500; }

/* The Roll ticket */
.ticket { --r: 5deg; width: 330px; display: flex; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1.5px var(--line), 0 16px 30px rgba(0,0,0,.25); }
.ticket .stub { width: 54px; background: var(--c, var(--roll)); color: var(--on-roll); display: grid; place-items: center; border-inline-end: 2px dashed rgba(0,0,0,.45); }
.ticket .stub span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 10px; letter-spacing: .22em; font-weight: 500; }
.ticket-body { flex: 1; background: var(--fog); color: var(--void); padding: 14px 18px; display: grid; gap: 4px; }
.ticket-body .label { color: #5e5e5e; }
.ticket-title { font-size: 34px; line-height: 1; font-weight: 500; letter-spacing: -0.02em; }
.ticket-line { font-size: 13px; }
.ticket-line.muted { color: #5e5e5e; }

/* Polaroid */
.polaroid { --r: -5deg; width: 250px; margin: 0; background: #f4f4f2; padding: 12px 12px 14px; box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 18px 34px rgba(0,0,0,.3); }
.polaroid img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: 30% 50%; }
.polaroid figcaption { color: #111; font-style: italic; font-size: 14px; margin-top: 10px; text-align: center; letter-spacing: .02em; }
.polaroid .tape-p { top: -12px; left: 80px; }

/* Quote note in the page's roll colour */
.note { --r: 4deg; width: 200px; min-height: 190px; background: var(--c, var(--roll)); color: var(--on-roll); padding: 30px 18px 18px; box-shadow: 0 16px 28px rgba(0,0,0,.25); display: grid; align-content: start; gap: 8px; }
.note p { margin: 0; font-size: 21px; line-height: 1.15; font-weight: 500; letter-spacing: -0.01em; }
.note p[lang="ar"] { font-family: var(--font-ar); font-size: 19px; line-height: 1.4; font-weight: 700; }
.note .tape-n { top: -10px; left: 50px; }

/* Lab window */
.lab { --r: -2deg; width: 290px; background: var(--ground-raised); color: var(--text); border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1.5px var(--line), 0 16px 30px rgba(0,0,0,.25); }
.lab-bar { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-bottom: 1.5px solid var(--line); font-size: 12px; color: var(--text-muted); }
.lab-bar i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--text-muted); }
.lab-bar i:first-child { background: var(--c, var(--roll)); border-color: var(--c, var(--roll)); }
.lab-bar span { margin-inline-start: auto; }
.lab pre { margin: 0; padding: 12px 14px 14px; font: 12.5px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--text); white-space: pre; }

/* Dice */
.dice { --r: 0deg; display: flex; gap: 10px; align-items: flex-end; }
.die { width: 74px; height: 74px; filter: drop-shadow(0 10px 12px rgba(0,0,0,.3)); }
.die.d1 { transform: rotate(-16deg); }
.die.d2 { transform: rotate(16deg) translateY(-14px); width: 62px; height: 62px; }
.die.d1 .die-face { fill: var(--c, var(--roll)); stroke: var(--void); stroke-width: 3; }
.die.d1 .die-pips { fill: var(--on-roll); }
.die.d2 .die-face { fill: var(--fog); stroke: var(--void); stroke-width: 3; }
.die.d2 .die-pips { fill: var(--void); }

/* Capsule word stickers */
.pill { padding: 8px 18px; border-radius: var(--radius-pill); font-weight: 500; font-size: 15px; background: var(--text); color: var(--ground); box-shadow: 0 8px 16px rgba(0,0,0,.2); }
.pill.roll { background: var(--c, var(--roll)); color: var(--on-roll); letter-spacing: .1em; font-size: 13px; }

/* Desktop: everything pinned around the centre */
@media (min-width: 1100px) {
  .desk { height: 900px; padding: 0; }
  .desk-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 460px; }
  .desk-mark { width: 330px; }
  .badge { left: 2%; top: 0; }
  .strip { left: 16%; top: 3%; }
  .p1 { left: 23%; top: 31%; --r: -6deg; }
  .st-towers { left: 3%; top: 53%; --r: -6deg; }
  .st-laban { left: 21%; top: 47%; --r: 16deg; }
  .lab { left: 2%; bottom: 2%; }
  .dice { left: 24%; bottom: 6%; }
  .p3 { left: 25%; bottom: 22%; --r: -16deg; }
  .stamp { right: 27%; top: 1%; }
  .p4 { right: 3%; top: 1%; --r: -6deg; }
  .ticket { right: 1%; top: 7%; }
  .p2 { right: 24%; top: 30%; --r: 6deg; }
  .polaroid { right: 4%; top: 34%; }
  .st-falcon { right: 23%; top: 58%; --r: -6deg; }
  .note { right: 3%; bottom: 2%; }
  .st-palm { right: 22%; bottom: 3%; --r: -16deg; }
}
@media (min-width: 1100px) and (max-width: 1279px) {
  .strip, .st-laban, .p2, .st-falcon, .p3 { display: none; }
}

/* Smaller screens: text first, then a loose pile of a few pieces */
@media (max-width: 1099px) {
  .desk-items { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--space-8) var(--space-6); margin-top: var(--space-12); }
  .desk-items .it { position: relative; }
  .strip, .lab, .st-towers, .st-laban, .st-palm, .p2, .p3, .stamp { display: none; }
  .badge .strap { height: 60px; }
}
@media (max-width: 520px) {
  .ticket { width: 290px; }
  .polaroid { width: 210px; }
  .badge { width: 170px; }
  .st-falcon, .p1 { display: none; }
}

/* Phone pile: two loose columns instead of one long stack */
@media (max-width: 700px) {
  .desk-items { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6) var(--space-4); justify-items: center; align-items: center; }
  .badge { width: 150px; grid-row: span 2; }
  .badge .avatar { width: 60px; }
  .note { width: 150px; min-height: 150px; padding: 26px 14px 14px; }
  .note p { font-size: 17px; } .note p[lang="ar"] { font-size: 16px; }
  .dice .die { width: 58px; height: 58px; } .dice .die.d2 { width: 48px; height: 48px; }
  .ticket { grid-column: 1 / -1; width: min(100%, 300px); }
  .polaroid { width: 160px; }
  .pill.p4 { align-self: start; }
}

@media (max-width: 700px) { .badge .ar-tag { display: none; } }

.desk-center .ar-display { font-size: clamp(36px, 7vw, 50px); line-height: 1.25; }

/* ===== Home: hero name, header without logo, tagline section ===== */
.site-header.is-home .wrap { justify-content: flex-end; }
.desk-mark { width: min(78%, 330px); }
.desk-name { margin: var(--space-4) 0 0; font-size: clamp(30px, 4vw, 40px); font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
[dir="rtl"] .desk-name { font-family: var(--font-ar); font-weight: 700; letter-spacing: 0; line-height: 1.4; }
.desk-name-other { margin: 0; font-size: 18px; }
.desk-name-other[lang="ar"] { font-family: var(--font-ar); }
.intro { padding-block: var(--space-16); }
.intro-grid { display: grid; gap: var(--space-8); align-items: end; }
@media (min-width: 960px) { .intro-grid { grid-template-columns: 1.2fr 1fr; gap: var(--space-16); } }
.intro-text p { margin: 0 0 var(--space-4); max-width: 34em; }
.intro .hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }

/* ===== Tumble-in titles (see /js/motion.js) ===== */
.motion main :is(h1, h2, h3):not(.tt):not(.tt-skip):not(.fx) { opacity: 0; }
.tt-w { display: inline-block; white-space: nowrap; }
.tt-u { display: inline-block; transform-origin: 50% 70%; transform: rotate(var(--t, 0deg)) translateY(0.3em); opacity: 0; }
.tt.tt-in .tt-u {
  transform: none; opacity: 1;
  transition: transform 400ms cubic-bezier(.34, 1.56, .64, 1) var(--d, 0ms), opacity 200ms ease var(--d, 0ms);
}

/* Tumble titles: letters drop already rotated and land on their tilt with a small overshoot, 400ms each, 60ms apart. */
.motion .fx .tb-u { transition: transform 400ms cubic-bezier(.34, 1.56, .64, 1) var(--d, 0ms), opacity 160ms ease var(--d, 0ms); }
.motion .fx:not(.fx-in) .tb-u { opacity: 0; transform: translateY(calc(var(--y, 0em) - 0.7em)) rotate(var(--t, 0deg)); }
/* Capsule: the word sits plain, then the pill fills in the roll colour, tilts and shakes. */
.motion .fx .cap { transition: background-color 260ms ease 150ms, color 260ms ease 150ms, transform 400ms cubic-bezier(.34, 1.56, .64, 1) 150ms; }
.motion .fx:not(.fx-in) .cap { background-color: transparent; color: inherit; transform: rotate(0deg) scale(0.97); }
.motion .fx.fx-in .cap { animation: cap-shake 300ms ease-in-out 600ms 1; }
@keyframes cap-shake {
  0%, 100% { transform: rotate(var(--ct)); }
  17%, 50%, 83% { transform: rotate(calc(var(--ct) + 6deg)); }
  33%, 67% { transform: rotate(calc(var(--ct) - 6deg)); }
}
@keyframes cap-shake-h {
  0%, 100% { transform: rotate(var(--ct)); }
  17%, 50%, 83% { transform: rotate(calc(var(--ct) + 6deg)); }
  33%, 67% { transform: rotate(calc(var(--ct) - 6deg)); }
}
@keyframes tb-shake {
  0%, 100% { transform: rotate(0deg); }
  17%, 50%, 83% { transform: rotate(6deg); }
  33%, 67% { transform: rotate(-6deg); }
}
/* Shake: a ±6° wobble, three times in 300ms, on hover. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .tb-title:hover .tb { animation: tb-shake 300ms ease-in-out 1; }
  .motion .fx.fx-in .cap:hover, .cap:hover { animation: cap-shake-h 300ms ease-in-out 1; }
}
@media (prefers-reduced-motion: reduce) { .tt-u { transform: none; opacity: 1; } }

/* Second-language echo lines sit under their title on the same side */
[dir="ltr"] .bi > [dir="rtl"], [dir="ltr"] .row > [dir="rtl"] { text-align: left; }
[dir="rtl"] .bi > [dir="ltr"], [dir="rtl"] .row > [dir="ltr"] { text-align: right; }

/* ===== The logo (stacked lockup) ===== */
.lockup { display: inline-flex; color: var(--text); }
.lockup svg { height: 100%; width: auto; }
.lockup-en { height: 64px; }
.lockup-ar { flex-direction: column; align-items: flex-start; height: auto; }
.lockup-ar svg { height: 48px; width: auto; }
.lockup-ar-text { display: grid; justify-items: start; line-height: 1.15; font-family: var(--font-ar); }
.lockup-ar-name { font-weight: 700; font-size: 15px; }
.lockup-ar-by { font-weight: 500; font-size: 12px; }
.brand svg { height: auto; }
.brand .lockup-en svg { height: 64px; }

/* Hero size */
.desk-lockup { margin: 0; line-height: 1; }
.lockup-hero.lockup-en { height: auto; width: min(80vw, 360px); }
.lockup-hero.lockup-en svg { width: 100%; height: auto; }
.lockup-hero.lockup-ar { width: min(80vw, 340px); }
.lockup-hero.lockup-ar svg { width: 100%; height: auto; }
.lockup-hero .lockup-ar-text { margin-top: 10px; padding-inline-end: 6%; }
.lockup-hero .lockup-ar-name { font-size: clamp(34px, 5vw, 46px); }
.lockup-hero .lockup-ar-by { font-size: clamp(24px, 3.4vw, 32px); }
@media (min-width: 1100px) { .desk-center { width: 400px; } }

[dir="rtl"] .lab pre { font-family: var(--font-ar); font-size: 14px; line-height: 1.7; }
[dir="rtl"] .badge .strap span { letter-spacing: .05em; font-size: 10px; }
[dir="rtl"] .ticket .stub span { letter-spacing: 0; font-size: 11px; }

/* ===== Lab ===== */
.lab-grid { display: grid; gap: var(--space-6); padding-bottom: var(--space-16); }
@media (min-width: 760px) { .lab-grid { grid-template-columns: 1fr 1fr; } }
.lab-card { display: grid; gap: var(--space-3); padding: var(--space-8); text-decoration: none; color: var(--text); border-radius: 14px; transition: transform 300ms cubic-bezier(.34,1.56,.64,1); }
.lab-card:nth-child(1) { transform: rotate(-1deg); } .lab-card:nth-child(2) { transform: rotate(1deg); }
.lab-card:hover, .lab-card:focus-visible { transform: rotate(0deg) translateY(-4px); }
.lab-card h2, .lab-card p { margin: 0; }
.lab-go { font-weight: 500; }
[dir="rtl"] .lab-go { display: inline-block; transform: scaleX(-1); text-align: end; }
.lab-tool { display: grid; gap: var(--space-8); padding-bottom: var(--space-16); }
@media (min-width: 960px) { .lab-tool[data-tumble] { grid-template-columns: 1.2fr 1fr; align-items: start; } }
.lab-stage { padding: var(--space-4); border-radius: 14px; }
.lab-stage canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 8px; }
.lab-controls { display: grid; gap: var(--space-6); }
.lab-controls fieldset { border: 0; padding: 0; margin: 0; }
.lab-controls legend { font-weight: 500; margin-bottom: var(--space-2); }
.swatches { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.swatches .opt { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer; }
.swatches .opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatches .opt:has(input:checked) { border-color: var(--text); background: var(--ground-raised); }
.swatches .opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.swatches .chip { width: 18px; height: 18px; border-radius: 999px; background: var(--c); }
.lab-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.dice-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); align-items: start; }
.die-slot { display: grid; gap: var(--space-2); justify-items: start; }
.die { width: clamp(84px, 18vw, 170px); height: clamp(84px, 18vw, 170px); box-sizing: border-box; padding: 16%; border-radius: 23%; background: var(--roll); display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); transform: rotate(var(--t, 0deg)); transition: transform 400ms cubic-bezier(.34,1.56,.64,1); filter: drop-shadow(0 12px 14px rgba(0,0,0,.3)); margin-bottom: var(--space-2); }
.die .pip { display: block; width: 64%; height: 64%; place-self: center; border-radius: 999px; background: transparent; }
.die .pip.on { background: #000; }
.rolling .die { animation: dice-shake 240ms ease-in-out infinite; }
@keyframes dice-shake { 0%,100% { transform: rotate(var(--t,0deg)) translateY(0); } 33% { transform: rotate(calc(var(--t,0deg) + 6deg)) translateY(-6px); } 66% { transform: rotate(calc(var(--t,0deg) - 6deg)) translateY(2px); } }
.die-value { margin: 0; }
.brief { padding: var(--space-8); border-radius: 14px; display: grid; gap: var(--space-3); }
.brief p { margin: 0; font-size: clamp(22px, 3vw, 30px); line-height: 1.35; }
.dice-lists summary { cursor: pointer; font-weight: 500; min-height: 44px; display: flex; align-items: center; }
.dice-cols { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.dice-cols ol { margin: 0; padding-inline-start: 1.4em; line-height: 1.8; }
@media (prefers-reduced-motion: reduce) { .lab-card, .die { transition: none; } .rolling .die { animation: none; } }
