/* Maktub — maktub.it landing page
   Design language: paper / ink / serif. "Quiet gravity." */

:root {
  --paper:        #f7f4ee;
  --paper-deep:   #f1ece2;
  --paper-edge:   #ebe4d6;
  --ink:          #111111;
  --ink-soft:     #3a382f;
  --ink-faint:    #6b675b;
  --rule:         rgba(17,17,17,0.14);
  --rule-strong:  rgba(17,17,17,0.28);
  --seal:         #7c1f1a;
  --seal-ink:     #5e1714;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --ui:    "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;

  --max-content: 720px;
  --max-wide:    1080px;
  --gutter: clamp(1.25rem, 5vw, 3rem);

  --s1:.5rem; --s2:1rem; --s3:1.5rem; --s4:2rem; --s5:3rem;
  --s6:4.5rem; --s7:7rem; --s8:10rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-weight: 400;
  /* whisper-faint paper tooth */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3 { font-weight: 400; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }

/* ── helpers ── */
.eyebrow {
  font-family: var(--ui); font-weight: 500; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .14em; color: var(--ink-faint);
  margin-bottom: var(--s3);
}
.center { text-align: center; }
.skip {
  position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper);
  padding: .6rem 1rem; font-family: var(--ui); z-index: 100;
}
.skip:focus { left: var(--s2); top: var(--s2); }

/* ── buttons & links ── */
.btn {
  display: inline-block; font-family: var(--ui); font-weight: 500; font-size: .9375rem;
  padding: .8rem 1.4rem; border-radius: 3px; text-decoration: none;
  border: 1px solid transparent; transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.btn--seal { background: var(--seal); color: #f7f1e6; }
.btn--seal:hover { background: var(--seal-ink); }
.textlink {
  font-family: var(--ui); font-size: .9375rem; color: var(--ink); text-decoration: none;
  background-image: linear-gradient(var(--seal), var(--seal));
  background-size: 0% 1px; background-repeat: no-repeat; background-position: left 90%;
  transition: background-size .2s ease; padding-bottom: 2px;
}
.textlink:hover { background-size: 100% 1px; }

:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }

/* ── nav ── */
.nav {
  position: sticky; top: 0; z-index: 50; background: var(--paper);
  border-bottom: 1px solid transparent; transition: border-color .25s ease;
}
.nav.is-scrolled { border-bottom-color: var(--rule); }
.nav__inner {
  max-width: var(--max-wide); margin: 0 auto; padding: .85rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
}
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.brand__mark { width: 26px; height: 26px; display: block; }
.brand__word { font-family: var(--serif); font-size: 1.15rem; letter-spacing: .01em; }
.nav__links { display: flex; align-items: center; gap: var(--s4); }
.nav__links a { font-family: var(--ui); font-size: .9375rem; text-decoration: none; color: var(--ink-soft); }
.nav__links a:hover { color: var(--ink); }
.nav__links .nav__cta { color: #f7f1e6; }
.nav__cta { padding: .55rem 1rem; }
.nav__toggle {
  display: none; font-family: var(--ui); font-size: .9375rem; background: none;
  border: 1px solid var(--rule); border-radius: 3px; padding: .5rem .85rem; color: var(--ink); cursor: pointer;
}
.nav__sheet { display: none; flex-direction: column; padding: var(--s2) var(--gutter) var(--s4); border-top: 1px solid var(--rule); }
.nav__sheet a { font-family: var(--serif); font-size: 1.25rem; padding: .7rem 0; text-decoration: none; border-bottom: 1px solid var(--rule); }

/* ── layout primitives ── */
.section { max-width: var(--max-wide); margin: 0 auto; padding: var(--s7) var(--gutter); }
.band    { max-width: var(--max-content); margin: 0 auto; padding: var(--s7) var(--gutter); text-align: center; }
.section__title { font-size: clamp(1.9rem, 3.5vw, 2.75rem); line-height: 1.15; max-width: 18ch; }
.section__title.center { margin-inline: auto; }
.band__lead { font-size: clamp(1.05rem,1.4vw,1.25rem); color: var(--ink-soft); max-width: 60ch; margin: var(--s3) auto 0; }
.rule { border: 0; border-top: 1px solid var(--rule); max-width: var(--max-content); margin: 0 auto; }

/* ── hero ── */
.hero {
  min-height: calc(100vh - 64px); display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: var(--s6) var(--gutter) var(--s7);
  position: relative;
}
.hourglass { width: 128px; height: 128px; display: block; margin-bottom: var(--s4); }
.hourglass--sm { width: 84px; height: 84px; margin-bottom: var(--s4); }
.hero__statement {
  font-size: clamp(2.5rem, 6vw, 4.75rem); font-weight: 300; line-height: 1.08;
  letter-spacing: -0.02em; max-width: 16ch;
}
.hero__sub { font-size: clamp(1.15rem,1.6vw,1.4rem); font-weight: 300; color: var(--ink-soft); max-width: 40ch; margin-top: var(--s4); }
.hero__what { font-family: var(--ui); font-size: .95rem; color: var(--ink-faint); max-width: 52ch; margin-top: var(--s3); line-height: 1.6; }
.hero__cta { display: flex; align-items: center; gap: var(--s4); margin-top: var(--s5); flex-wrap: wrap; justify-content: center; }
.scrollcue { position: absolute; bottom: var(--s4); font-family: var(--ui); color: var(--ink-faint); text-decoration: none; font-size: 1.1rem; animation: drift 2.4s ease-in-out infinite; }
@keyframes drift { 0%,100% { transform: translateY(0); opacity:.5 } 50% { transform: translateY(6px); opacity:1 } }

/* the heartbeat: a grain falls, then the glass turns */
.hourglass__grain { animation: fall 9s ease-in-out infinite; }
@keyframes fall {
  0%   { transform: translateY(0);   opacity: 0; }
  8%   { opacity: 1; }
  42%  { transform: translateY(8px); opacity: 1; }
  50%  { transform: translateY(8px); opacity: 0; }
  100% { transform: translateY(8px); opacity: 0; }
}

/* ── one primitive ── */
.equation { font-size: clamp(1.4rem, 3vw, 2.1rem); line-height: 1.3; }
#primitive .eyebrow { margin-bottom: var(--s4); }

/* ── steps ── */
.steps { list-style: none; margin: var(--s6) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s5); }
.step { padding: 0 var(--s2); border-left: 1px solid var(--rule); }
.step:first-child { border-left: 0; }
.step__num { font-family: var(--serif); color: var(--seal); font-size: 1rem; letter-spacing: .1em; }
.step__title { font-size: 1.4rem; font-weight: 600; margin: var(--s2) 0 var(--s2); }
.step p { color: var(--ink-soft); }

/* ── stories ── */
.section--stories { background: var(--paper-deep); max-width: none; }
.section--stories > .eyebrow,
.section--stories > .section__title { max-width: var(--max-wide); margin-inline: auto; }
.cards {
  max-width: var(--max-wide); margin: var(--s6) auto 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s5);
}
.card {
  position: relative; background: var(--paper); border: 1px solid var(--rule-strong);
  border-radius: 2px; padding: var(--s5);
  transition: transform .24s ease, border-color .24s ease, box-shadow .24s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 1px 0 var(--rule-strong); }
.card__mark { position: absolute; top: var(--s3); right: var(--s3); color: var(--seal); font-size: 1rem; opacity: .8; }
.card__label { font-family: var(--ui); font-weight: 500; font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--seal); margin-bottom: var(--s3); }
.card__scene { font-size: 1.1875rem; line-height: 1.6; }
.card__rule { border: 0; border-top: 1px solid var(--rule); width: 42%; margin: var(--s3) 0; }
.card__out { color: var(--ink-soft); }
.card__for { font-family: var(--ui); font-size: .8125rem; color: var(--ink-faint); margin-top: var(--s3); line-height: 1.5; }

.invite { max-width: var(--max-wide); margin: var(--s6) auto 0; text-align: center; }
.invite__q { font-family: var(--serif); font-size: clamp(1.4rem,2.4vw,1.9rem); margin-bottom: var(--s4); }

/* ── use cases ── */
.uses { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s5); margin-top: var(--s6); }
.use__title { font-size: 1.35rem; font-weight: 600; margin-bottom: var(--s2); }
.use p { color: var(--ink-soft); }

/* ── trust ── */
.promises { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s5) var(--s6); margin-top: var(--s6); }
.promise h3 { font-size: 1.25rem; font-weight: 600; margin-bottom: var(--s2); }
.promise p { color: var(--ink-soft); }
.honesty {
  max-width: var(--max-content); margin: var(--s6) auto var(--s4); padding: var(--s4);
  background: var(--paper-edge); border-left: 2px solid var(--seal); border-radius: 2px;
  font-size: .98rem; color: var(--ink-soft); line-height: 1.65;
}
.honesty strong { color: var(--ink); }

/* ── build / links ── */
.links { list-style: none; margin: var(--s6) auto 0; padding: 0; max-width: var(--max-content); }
.links li { border-top: 1px solid var(--rule); }
.links li:last-child { border-bottom: 1px solid var(--rule); }
.links a { display: block; padding: var(--s3) 0; text-decoration: none; }
.links a:hover .links__name { color: var(--seal); }
.links__name { display: block; font-family: var(--ui); font-weight: 500; font-size: 1rem; transition: color .18s ease; }
.links__desc { display: block; color: var(--ink-faint); font-size: .95rem; margin-top: 3px; }

/* ── closing ── */
.closing { text-align: center; padding: var(--s8) var(--gutter); display: flex; flex-direction: column; align-items: center; }
.arabic { font-family: "Amiri", var(--serif); font-weight: 400; font-size: clamp(2.5rem, 6.5vw, 4rem); line-height: 1; color: var(--ink); margin: var(--s2) 0 var(--s4); }
.closing__line { font-family: var(--serif); font-weight: 300; font-size: clamp(1.6rem,3.5vw,2.6rem); line-height: 1.15; max-width: 18ch; margin-bottom: var(--s5); }

/* ── footer ── */
.footer { background: var(--paper-deep); border-top: 1px solid var(--rule); padding: var(--s6) var(--gutter) var(--s5); }
.footer__inner { max-width: var(--max-wide); margin: 0 auto; display: flex; flex-wrap: wrap; gap: var(--s5); justify-content: space-between; }
.footer__brand { display: flex; align-items: center; gap: .5rem; font-family: var(--serif); font-size: 1.1rem; }
.footer__brand .brand__mark { width: 22px; height: 22px; }
.footer__cols { display: flex; gap: var(--s6); flex-wrap: wrap; }
.footer__h { font-family: var(--ui); font-weight: 500; font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-faint); margin-bottom: var(--s2); }
.footer__cols a { display: block; font-family: var(--ui); font-size: .9rem; color: var(--ink-soft); text-decoration: none; padding: .25rem 0; }
.footer__cols a:hover { color: var(--ink); }
.footer__tag { max-width: var(--max-wide); margin: var(--s5) auto 0; font-family: var(--serif); font-style: italic; color: var(--ink-soft); }
.footer__tag .ar { font-family: "Amiri", var(--serif); font-style: normal; font-size: 1.12em; vertical-align: -0.04em; }
.footer__note { max-width: var(--max-wide); margin: var(--s2) auto 0; font-family: var(--ui); font-size: .8125rem; color: var(--ink-faint); line-height: 1.6; }

/* ── reveal on scroll ── */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ── responsive ── */
@media (max-width: 820px) {
  .nav__links { display: none; }
  .nav__toggle { display: inline-block; }
  .nav.is-open .nav__sheet { display: flex; }
  .steps, .uses, .promises, .cards { grid-template-columns: 1fr; }
  .step { border-left: 0; border-top: 1px solid var(--rule); padding: var(--s3) 0 0; }
  .step:first-child { border-top: 0; }
  .section, .band { padding-top: var(--s6); padding-bottom: var(--s6); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hourglass__grain, .scrollcue { animation: none; }
  .card { transition: border-color .2s ease; }
}
