/* Open Hand — shared base CSS across all 5 variants
   Variant-specific styles live in each deck-vN.html file. */

:root {
  --bg:        #F4EFE6;
  --bg-soft:   #EBE4D6;
  --bg-deep:   #E2D9C5;
  --ink:       #1B1916;
  --ink-soft:  #5A544A;
  --ink-mute:  #8A8278;
  --rule:      #1B1916;
  --accent:    #B84A2A;
  --accent-2:  #1F8F5B;
  --display:   "Newsreader", ui-serif, Georgia, serif;
  --body:      "Manrope", system-ui, -apple-system, sans-serif;
  --ar:        "Cairo", "Noto Naskh Arabic", sans-serif;
  --t-dur:     .55s;
  --t-ease:    cubic-bezier(.7,0,.2,1);
}

/* dark mode */
html[data-dark="1"] {
  --bg:       #14110D;
  --bg-soft:  #1C1814;
  --bg-deep:  #251F18;
  --ink:      #F4EFE6;
  --ink-soft: #B8B0A1;
  --ink-mute: #756E62;
  --rule:     #F4EFE6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overscroll-behavior: none; }
html { background: var(--bg) !important; }
body {
  background: var(--bg) !important;
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

/* paper grain — gated by data-grain */
html[data-grain="1"] body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: .35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  z-index: 100;
}
html[data-dark="1"][data-grain="1"] body::after { mix-blend-mode: screen; opacity: .2; }

/* shell */
.shell {
  position: fixed; inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

header.bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px 10px;
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  z-index: 10;
}
.bar .mark {
  color: var(--ink); font-weight: 600; font-size: 12px;
  display: inline-flex; align-items: center; gap: 8px;
}
.bar .mark em { font-family: var(--display); font-style: italic; font-weight: 400; color: var(--accent); }
/* Brand glyph — heart-in-hand. Image is black-on-transparent so we invert
   on dark mode to make it readable. */
.bar .mark .brand-glyph {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
}
html[data-dark="1"] .bar .mark .brand-glyph {
  filter: invert(1);
}
.bar .count { font-variant-numeric: tabular-nums; }

.progress {
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px; background: transparent; z-index: 11;
}
.progress > span {
  display: block; height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width .5s cubic-bezier(.2,.7,.2,1);
}

/* stage */
main {
  position: relative;
  overflow: hidden;
}
.stage {
  position: absolute; inset: 0;
  display: flex;
  transition: transform var(--t-dur) var(--t-ease);
  will-change: transform;
  /* reserve horizontal gestures for the swipe handler;
     vertical scroll inside any overflowing slide still works */
  touch-action: pan-y;
}
.slide {
  flex: 0 0 100%;
  height: 100%;
  padding: clamp(20px, 4.5vw, 64px);
  display: flex; flex-direction: column;
  justify-content: center;
  gap: clamp(12px, 2vw, 22px);
  position: relative;
  overflow: hidden;
}
/* Mobile: allow vertical scroll on slides whose content exceeds the viewport.
   Arrow buttons stay the reliable navigation; swipe may be intermittent on
   overflowing slides due to iOS gesture arbitration, but content is now
   fully reachable. A visible thin scrollbar makes the affordance discoverable. */
@media (max-width: 480px) {
  .slide {
    overflow-y: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    /* reserve horizontal gestures for swipe; vertical handled by browser */
    touch-action: pan-y;
    /* thin visible scrollbar so users see content extends below */
    scrollbar-width: thin;
    scrollbar-color: rgba(184,74,42,.55) transparent;
  }
  .slide::-webkit-scrollbar { width: 4px; }
  .slide::-webkit-scrollbar-track { background: transparent; }
  .slide::-webkit-scrollbar-thumb {
    background: rgba(184,74,42,.55);
    border-radius: 2px;
  }
  html[data-dark="1"] .slide {
    scrollbar-color: rgba(184,74,42,.7) transparent;
  }
  html[data-dark="1"] .slide::-webkit-scrollbar-thumb {
    background: rgba(184,74,42,.7);
  }
}

/* transition variants — applied to .stage */
html[data-trans="fade"] .stage { transition: opacity var(--t-dur) ease; }
html[data-trans="fade"] .slide { opacity: 0; transition: opacity .35s ease; }
html[data-trans="fade"] .slide[data-active="1"] { opacity: 1; }
html[data-trans="fade"] .stage { transform: none !important; }
html[data-trans="fade"] .slide:not([data-active="1"]) { pointer-events: none; }
html[data-trans="fade"] .stage { display: block; }
html[data-trans="fade"] .slide { position: absolute; inset: 0; width: 100%; }

html[data-trans="blur"] .stage { transition: transform var(--t-dur) var(--t-ease), filter var(--t-dur) ease; }
html[data-trans="blur"] .stage[data-moving="1"] { filter: blur(8px); }

/* common type */
.eyebrow {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}
.body {
  font-size: clamp(14px, 1.6vw, 16px);
  color: var(--ink-soft);
  max-width: 52ch;
}
.caveat {
  font-size: clamp(12px, 1.4vw, 14px);
  color: var(--ink-soft);
  font-style: italic;
  max-width: 60ch;
}
.src {
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: .65;
}

.rule {
  width: 38px; height: 1px;
  background: var(--ink);
  opacity: .6;
}

.ar {
  font-family: var(--ar);
  direction: rtl;
  unicode-bidi: isolate;
  font-weight: 500;
}

/* nav */
footer.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  gap: 12px;
  z-index: 10;
}
.dots { display: flex; gap: 6px; }
.dots button {
  width: 18px; height: 3px; border-radius: 999px;
  background: var(--ink); opacity: .2;
  border: none; cursor: pointer; padding: 0;
  transition: opacity .25s, width .25s;
}
.dots button.active { opacity: 1; width: 30px; }
.arrows { display: flex; gap: 8px; }
.arrows button {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .2s, color .2s;
  font-family: var(--display);
}
.arrows button:hover { background: var(--ink); color: var(--bg); }
.arrows button[disabled] { opacity: .25; cursor: not-allowed; }

/* form scaffold (used by all variants) */
.form-slide { justify-content: flex-start; padding-top: clamp(36px, 6vw, 72px); }
.form {
  display: grid;
  gap: 16px;
  max-width: 480px;
  width: 100%;
}
.field { display: grid; gap: 5px; }
.field label {
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
}
.field input, .field textarea, .field select {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink);
  padding: 8px 0 6px;
  border-radius: 0;
  outline: none;
  transition: border-color .2s;
  width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 64px; }

button.submit {
  margin-top: 4px;
  justify-self: start;
  background: var(--ink);
  color: var(--bg);
  border: none;
  padding: 12px 24px;
  font: inherit;
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 999px;
  transition: transform .15s, background .2s;
}
button.submit:hover { background: var(--accent); }
button.submit:active { transform: translateY(1px); }
button.submit[disabled] { opacity: .5; cursor: wait; }

.thanks {
  display: none;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.4;
  max-width: 480px;
}
.thanks.show { display: block; }

/* selection */
::selection { background: var(--accent); color: var(--bg); }

/* accent-2 mode (when data-tone="2tone") swaps some accents to deep green
   on alternating slides */
html[data-tone="2tone"] .slide[data-tone-alt="1"] .eyebrow,
html[data-tone="2tone"] .slide[data-tone-alt="1"] .pillar-num,
html[data-tone="2tone"] .slide[data-tone-alt="1"] h1 em,
html[data-tone="2tone"] .slide[data-tone-alt="1"] h2 em,
html[data-tone="2tone"] .slide[data-tone-alt="1"] .ar-sub {
  color: var(--accent-2);
}
html[data-tone="2tone"] .slide[data-tone-alt="1"] .progress span,
html[data-tone="2tone"] .slide[data-tone-alt="1"] .dot { background: var(--accent-2); }
