/* Jinimon — Sadu loom world. Tokens first, then surfaces, then components.
   Hard pixel steps everywhere: no border-radius, no blur, no soft shadows. */

:root {
  --black: #0B0708;        /* goat-hair ground */
  --black-2: #17090D;      /* warp shadow */
  --crimson: #B3122B;      /* Sadu red, the committed field */
  --ivory: #F3E9D6;        /* undyed wool */
  --ivory-2: #E6D7BB;
  --ochre: #E39A2B;        /* the single hot accent */
  --indigo: #2B3A9E;       /* one cool thread */
  --thread: var(--crimson);

  --font-display: "Changa", "Alexandria", system-ui, sans-serif;
  --font-text: "Alexandria", "Changa", system-ui, sans-serif;

  --cell: 12px;            /* loom cell at desktop; the canvas derives its own */
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --max: 1360px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 160ms;
  --t-slow: 700ms;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(64px + env(safe-area-inset-top)); }
body {
  margin: 0;
  background: var(--black);
  color: var(--ivory);
  font-family: var(--font-text);
  font-weight: 300;
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
[lang="ar"], [dir="rtl"] body { font-weight: 300; }
[dir="rtl"] body { line-height: 1.85; }
img, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); line-height: 1; }

[dir="rtl"] :is(.btn, .pane h3, .world__title, .h2, .hero__title), .wordmark__arabic { letter-spacing: 0; }

/* browser surfaces belong to the world */
::selection { background: var(--ochre); color: var(--black); }
::-moz-selection { background: var(--ochre); color: var(--black); }
:root { caret-color: var(--ochre); accent-color: var(--crimson); scrollbar-color: var(--crimson) var(--black); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--crimson); border: 2px solid var(--black); }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 1rem; top: -4rem; z-index: 100; background: var(--ochre); color: var(--black); padding: .6rem 1rem; font-weight: 600; }
.skip:focus { top: 1rem; }

/* ---------- nav band ---------- */
.band--nav {
  position: sticky; top: 0; z-index: 50;
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 1rem;
  min-height: 64px; padding: 0 var(--gutter);
  background: var(--black);
  border-bottom: 1px solid color-mix(in srgb, var(--ivory) 14%, transparent);
  padding-top: env(safe-area-inset-top);
}
.wordmark { display: inline-flex; align-items: baseline; gap: .6rem; font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; }
.wordmark__pixel { width: 14px; height: 14px; align-self: center; background:
  linear-gradient(var(--crimson), var(--crimson)) 50% 0/ 4px 4px no-repeat,
  linear-gradient(var(--crimson), var(--crimson)) 50% 50%/ 14px 6px no-repeat,
  linear-gradient(var(--crimson), var(--crimson)) 50% 100%/ 4px 4px no-repeat,
  linear-gradient(var(--ochre), var(--ochre)) 50% 50%/ 4px 4px no-repeat; }
.wordmark__latin { font-size: 1.25rem; }
.wordmark__arabic { font-size: 1.15rem; font-weight: 700; color: var(--ivory-2); }
.nav { display: flex; gap: clamp(1rem, 2.5vw, 2.25rem); justify-content: center; font-weight: 500; font-size: .95rem; }
.nav a { position: relative; padding: .5rem 0; }
.nav a::after { content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: var(--ochre); transform: scaleX(0); transform-origin: var(--origin, left); transition: transform var(--t-fast) var(--ease-out); }
[dir="rtl"] .nav a::after { --origin: right; }
.nav a:hover::after, .nav a:focus-visible::after { transform: scaleX(1); }

.lang { display: inline-flex; border: 1px solid var(--ivory); background: transparent; padding: 0; cursor: pointer; font: inherit; color: var(--ivory); min-height: 40px; }
.lang__opt { padding: .45rem .8rem; font-weight: 600; font-size: .85rem; line-height: 1.2; }
.lang__opt.is-active { background: var(--ivory); color: var(--black); }

.menu { display: none; width: 44px; height: 44px; background: transparent; border: 1px solid var(--ivory); cursor: pointer; padding: 10px; flex-direction: column; justify-content: space-between; }
.menu span { display: block; height: 3px; background: var(--ivory); }
.mobile-nav { position: sticky; top: calc(64px + env(safe-area-inset-top)); z-index: 49; display: grid; background: var(--crimson); border-bottom: 1px solid var(--black); }
.mobile-nav[hidden] { display: none; }
.mobile-nav a { padding: 1rem var(--gutter); font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; border-top: 1px solid color-mix(in srgb, var(--black) 35%, transparent); }

/* ---------- hero ---------- */
.hero { position: relative; min-height: calc(100dvh - 64px); display: grid; align-items: end; overflow: hidden; background: var(--black); isolation: isolate; }
.loom { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.hero__inner { position: relative; z-index: 2; width: 100%; max-width: var(--max); margin-inline: auto; padding: clamp(6rem, 18vh, 10rem) var(--gutter) clamp(2rem, 6vh, 4rem); }
.hero__inner::before {
  /* the band the type sits on: a full-bleed crimson field with a hard ivory
     selvedge, the committed colour. No fade: thread edges are steps. */
  content: ""; position: absolute; inset-inline: calc(50% - 50vw); bottom: 0; height: calc(100% - 4.5rem); z-index: -1;
  background: var(--crimson);
  border-top: 6px solid var(--ivory);
  box-shadow: 0 -12px 0 0 var(--black);
}
.hero__title { max-width: 12ch; font-size: clamp(3.2rem, 9.5vw, 8.5rem); font-weight: 800; letter-spacing: -0.04em; line-height: .92; color: var(--ivory); text-wrap: balance; }
[dir="rtl"] .hero__title { letter-spacing: 0; line-height: 1.15; max-width: 14ch; }
.hero__echo { margin-top: .5rem; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.4rem, 1rem + 2vw, 2.6rem); line-height: 1.2; color: var(--ivory-2); }
/* The echo carries the other script's direction, so align it to the page's
   edge explicitly: start/end would follow the echo's own dir and drift. */
[dir="ltr"] .hero__echo { text-align: left; }
[dir="rtl"] .hero__echo { text-align: right; letter-spacing: -0.02em; }
.hero__hook { max-width: 34ch; margin-top: 1.25rem; font-size: clamp(1.1rem, 1rem + .6vw, 1.5rem); font-weight: 400; line-height: 1.35; color: var(--ivory); }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.hero__status { display: inline-flex; align-items: center; gap: .55rem; margin-top: 1.5rem; font-size: .9rem; font-weight: 500; }
.dot { width: 10px; height: 10px; background: var(--ochre); box-shadow: 0 0 0 3px var(--black); animation: pulse 2.4s var(--ease-out) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.hero__shuttle { position: absolute; z-index: 3; top: 0; bottom: 0; width: 6px; background: var(--ivory); inset-inline-end: 0; opacity: 0; animation: shuttle 1.9s var(--ease-out) .1s both; }
@keyframes shuttle { 0% { transform: translateX(0); opacity: 1; } 95% { opacity: 1; } 100% { transform: translateX(calc(-100vw * var(--dirx, 1))); opacity: 0; } }
[dir="rtl"] .hero__shuttle { --dirx: -1; inset-inline-end: 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: .7rem 1.4rem; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; border: 2px solid currentColor; transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease-out); }
.btn:active { transform: translateY(2px); }
.btn--primary { background: var(--ivory); color: var(--black); border-color: var(--ivory); }
.btn--primary:hover, .btn--primary:focus-visible { background: var(--ochre); border-color: var(--ochre); }
.btn--ghost { color: var(--ivory); background: transparent; }
.btn--ghost:hover, .btn--ghost:focus-visible { background: var(--ivory); color: var(--black); }

/* ---------- sections ---------- */
.section { padding: clamp(4rem, 10vh, 8rem) var(--gutter); }
.section__head, .players__inner, .duo, .studio__grid { max-width: var(--max); margin-inline: auto; }
.h2 { font-size: clamp(2.4rem, 2rem + 3vw, 5rem); font-weight: 800; letter-spacing: -0.03em; line-height: .95; text-wrap: balance; }
[dir="rtl"] .h2 { letter-spacing: 0; line-height: 1.15; }
.h2--small { font-size: clamp(1.8rem, 1.5rem + 1.5vw, 2.8rem); }
.lede { margin-top: 1.25rem; max-width: 60ch; font-size: clamp(1.05rem, 1rem + .4vw, 1.35rem); font-weight: 400; line-height: 1.45; }

/* two worlds */
.worlds { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: clamp(2rem, 5vh, 3.5rem); max-width: var(--max); margin-inline: auto; border: 3px solid var(--ivory); background: var(--ivory); }
.world { --thread: var(--crimson); display: grid; grid-template-rows: auto 1fr; background: var(--black-2); transition: background var(--t-slow) var(--ease-out); }
.world[data-thread="indigo"] { --thread: var(--indigo); }
.world:hover { background: color-mix(in srgb, var(--thread) 22%, var(--black)); }
.world__art { aspect-ratio: 16 / 7; background: var(--black); overflow: hidden; }
.world__art canvas { width: 100%; height: 100%; }
.world__body { padding: clamp(1.25rem, 3vw, 2.25rem); display: grid; gap: .75rem; align-content: start; }
.world__title { font-size: clamp(1.8rem, 1.4rem + 1.6vw, 3rem); font-weight: 800; letter-spacing: -0.02em; }
.world__body p { font-weight: 400; max-width: 46ch; }
.bridge { display: grid; place-items: center; background: var(--ivory); min-height: 3px; }
.bridge span { display: block; width: 100%; height: 3px; background: var(--ivory); }
.worlds__bridge-line { max-width: var(--max); margin: 1.25rem auto 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.15rem, 1rem + .8vw, 1.7rem); line-height: 1.3; color: var(--ochre); text-wrap: balance; }

/* studio: the ivory wool band */
.section--studio { background: var(--ivory); color: var(--black); }
.studio__grid { display: grid; gap: clamp(2rem, 5vw, 4rem); grid-template-columns: 1fr; }
.studio__text p + p { margin-top: 1rem; max-width: 60ch; }
.panes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; background: var(--black); border: 3px solid var(--black); }
.pane { --thread: var(--crimson); background: var(--ivory); padding: clamp(1.25rem, 3vw, 2rem); min-height: 160px; display: grid; align-content: space-between; gap: 1rem; transition: background var(--t-slow) var(--ease-out), color var(--t-slow); }
.pane[data-thread="ochre"] { --thread: var(--ochre); }
.pane[data-thread="indigo"] { --thread: var(--indigo); }
.pane[data-thread="black"] { --thread: var(--black); }
.pane h3 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; }
.pane p { font-weight: 400; }
.pane:hover { background: var(--thread); color: var(--ivory); }
.pane[data-thread="black"]:hover { color: var(--ivory); }

/* players: the crimson field */
.section--players { background: var(--crimson); color: var(--ivory); }
.players__inner { max-width: 760px; }
.follow { display: grid; grid-template-columns: 1fr; gap: .75rem; margin-top: 2rem; }
.follow__input { min-height: 48px; padding: .7rem 1rem; font: inherit; font-weight: 400; color: var(--black); background: var(--ivory); border: 2px solid var(--ivory); min-width: 0; }
.follow__input::placeholder { color: color-mix(in srgb, var(--black) 55%, transparent); }
.follow__input:focus-visible { outline-color: var(--black); }
.follow__note { min-height: 1.6em; margin-top: .75rem; font-weight: 500; }
.social { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-top: 2.5rem; font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; }
.social a { padding: .35rem 0; border-bottom: 3px solid transparent; cursor: default; }
.social a[href] { cursor: pointer; }
.social a:hover, .social a:focus-visible { border-bottom-color: var(--ochre); }

/* partners / careers */
.duo { display: grid; gap: 3px; background: var(--ivory); border: 3px solid var(--ivory); }
.duo__pane { --thread: var(--crimson); background: color-mix(in srgb, var(--thread) 22%, var(--black)); padding: clamp(1.5rem, 4vw, 3rem); display: grid; gap: 1rem; align-content: start; }
.duo__pane[data-thread="ochre"] { --thread: var(--ochre); }
.duo__pane p { max-width: 48ch; font-weight: 400; }
.duo__pane .btn { justify-self: start; }

/* footer */
.footer { position: relative; background: var(--black); border-top: 1px solid color-mix(in srgb, var(--ivory) 14%, transparent); }
.footer__weave { height: 28px; background: repeating-conic-gradient(from 45deg, var(--crimson) 0 25%, var(--black) 0 50%) 0 0 / 14px 14px; }
.footer__inner { max-width: var(--max); margin-inline: auto; padding: 2.5rem var(--gutter) max(2.5rem, env(safe-area-inset-bottom)); display: grid; gap: .75rem; }
.wordmark--footer .wordmark__latin { font-size: 1.6rem; }
.footer__line { font-weight: 400; }
.footer__contact { font-weight: 400; color: var(--ivory-2); }
.footer__mail { border-bottom: 2px solid var(--ochre); }
.footer__legal { font-size: .85rem; color: var(--ivory-2); margin-top: 1rem; }

/* ---------- breakpoints ---------- */
@media (min-width: 768px) {
  .follow { grid-template-columns: 1fr auto; }
  .duo { grid-template-columns: 1fr 1fr; }
  .worlds { grid-template-columns: 1fr 3px 1fr; }
  .panes { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .studio__grid { grid-template-columns: 1.1fr 1fr; align-items: center; }
  .panes { grid-template-columns: repeat(2, 1fr); }
  .hero__inner::before { height: calc(100% - 6rem); }
}
@media (max-width: 767.98px) {
  .nav { display: none; }
  .menu { display: flex; }
  .band--nav { grid-template-columns: 1fr auto auto; }
  .hero { min-height: calc(100svh - 64px); }
  .hero__inner { padding-top: 5rem; }
  .hero__hook { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__shuttle, .dot { animation: none; }
  .hero__shuttle { display: none; }
  * { transition-duration: 1ms !important; }
}

/* legal pages (jinns-night/privacy) — long-form reading, same hard-edged world */
.legal__inner { max-width: 72ch; margin-inline: auto; }
.legal__eyebrow { font-family: var(--font-display); font-weight: 700; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ochre); margin-bottom: 1.25rem; }
.legal__updated { margin-top: 1rem; font-size: .9rem; color: var(--ivory-2); }
.legal h2 { margin-top: 3rem; padding-top: 1.25rem; border-top: 2px solid var(--crimson); font-size: clamp(1.4rem, 1.2rem + .8vw, 1.9rem); font-weight: 800; line-height: 1.1; }
.legal h3 { margin-top: 1.75rem; font-size: 1.15rem; font-weight: 700; line-height: 1.2; color: var(--ivory-2); }
.legal p, .legal ul { margin-top: .9rem; }
.legal p, .legal li { font-weight: 400; max-width: 68ch; }
.legal li { position: relative; padding-inline-start: 1.25rem; margin-top: .55rem; }
.legal li::before { content: ""; position: absolute; inset-inline-start: 0; top: .62em; width: 8px; height: 8px; background: var(--ochre); }
.legal strong { font-weight: 600; color: var(--ivory); }
.legal a:not(.btn) { border-bottom: 2px solid var(--ochre); }
.legal a:not(.btn):hover { color: var(--ochre); }
.legal__back { margin-top: 3.5rem; }
.footer__links a { border-bottom: 2px solid var(--ochre); font-weight: 400; color: var(--ivory-2); }
