:root {
  --bg: #F6F6F3;
  --surface: #FFFFFF;
  --ink: #17171B;
  --text: #3A3A42;
  --muted: #5C5C64;
  --line: #E4E4DF;
  --field: #CFCFC9;
  --accent: #2F3FB5;
  --accent-ink: #1E2A85;
  --tint: #E9E8FB;
  /* one typeface everywhere: Poppins; hierarchy comes from size and weight */
  --display: 'Poppins', system-ui, sans-serif;
  --sans: 'Poppins', system-ui, sans-serif;
  --typed: 'Poppins', system-ui, sans-serif;
  --type: 'Poppins', system-ui, sans-serif;
  --hand: 'Poppins', system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; }

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

.wrap { width: 100%; max-width: 628px; margin: 0 auto; padding-inline: 24px; } /* 580px column for everything */

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* header / footer */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-block: 28px;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.logo:hover { color: var(--ink); text-decoration: none; }
.logo span { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; }
.site-header nav { display: flex; gap: 20px; }

.site-footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-block: 24px 40px; font-size: 14px; color: var(--muted);
}
.site-footer a { color: var(--muted); }

main.wrap { flex: 1; padding-block: 48px 64px; display: flex; flex-direction: column; gap: 56px; }

/* today's check */
.check { display: flex; flex-direction: column; gap: 28px; }

.eyebrow {
  margin: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
}
.eyebrow .muted { color: var(--muted); }
/* "Today's check": a handwritten note, like "Remember this…" */
.eyebrow > span:first-child { font-family: var(--hand); font-size: 26px; font-weight: 500; letter-spacing: 0; text-transform: none; line-height: 1; }
.dot { width: 4px; height: 4px; border-radius: 50%; background: #9A9AA2; }

h1 {
  margin: 0; font-family: var(--typed); font-weight: 500;
  font-size: clamp(38px, 7.5vw, 58px); line-height: 1.12; letter-spacing: -0.01em;
}

.body { display: flex; flex-direction: column; gap: 16px; max-width: 580px; font-family: var(--type); font-size: 21px; line-height: 1.55; color: var(--text); }
.body p { margin: 0; }

.quote {
  margin: 0; padding: 28px; border-radius: 20px; background: var(--tint);
  display: flex; flex-direction: column; gap: 14px;
}
.quote svg { fill: var(--accent); }
.quote blockquote {
  margin: 0; font-family: var(--typed); font-weight: 400;
  font-size: clamp(24px, 4.5vw, 28px); line-height: 1.3; letter-spacing: 0; color: var(--ink);
}
.quote figcaption { font-family: var(--type); font-size: 15px; font-weight: 500; color: var(--text); }

.move {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px; display: flex; flex-direction: column; gap: 8px;
}
.move-label { font-family: var(--hand); font-size: 24px; font-weight: 500; line-height: 1.1; color: var(--accent); }
.move p { margin: 0; font-family: var(--type); font-size: 22px; line-height: 1.45; font-weight: 600; color: var(--ink); }

.actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

/* buttons */
.btn {
  min-height: 48px; padding: 0 24px; border-radius: 999px; border: none;
  background: var(--ink); color: #fff; font: 600 16px/1 var(--sans);
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  transition: background-color .2s ease;
}
.btn:hover { background: #2C2C33; }
.btn[disabled] { opacity: .6; cursor: default; }

[data-check] .icon-done { display: none; }
[data-check][aria-pressed="true"] { background: var(--accent); }
[data-check][aria-pressed="true"]:hover { background: var(--accent-ink); }
[data-check][aria-pressed="true"] .icon-open { display: none; }
[data-check][aria-pressed="true"] .icon-done { display: block; }

.draw-check { stroke-dasharray: 12; stroke-dashoffset: 0; }
[data-check].just-checked .draw-check { animation: draw .45s ease-out .05s both; }
@keyframes draw { from { stroke-dashoffset: 12; } to { stroke-dashoffset: 0; } }

.share, .link-btn {
  background: none; border: none; padding: 8px 0; min-height: 44px; cursor: pointer;
  font: 500 15px/1 var(--sans); color: var(--accent);
  display: inline-flex; align-items: center; gap: 8px;
}
.share:hover, .link-btn:hover { color: var(--accent-ink); text-decoration: underline; }
.site-header .link-btn { color: var(--ink); }

/* newsletter */
.newsletter { border-top: 1px solid var(--line); padding-top: 40px; }
.newsletter > div { display: flex; flex-direction: column; gap: 16px; }
.newsletter h2, .signin h2 {
  margin: 0; font-family: var(--typed); font-weight: 400; font-size: 28px; letter-spacing: 0;
}
.newsletter p { margin: 0; font-size: 17px; line-height: 1.55; color: #45454D; max-width: 520px; }
.newsletter form { display: flex; gap: 12px; flex-wrap: wrap; max-width: 520px; }

input[type="email"] {
  flex: 1 1 240px; min-height: 48px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--field); background: var(--surface);
  font: 16px var(--sans); color: var(--ink); width: 100%;
}
input[type="email"]::placeholder { color: #7A7A80; }
input[type="email"]:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.fine { font-size: 14px !important; color: var(--muted) !important; }
.fine.error { color: #A3261B !important; }

/* sign-in dialog */
.signin {
  border: none; border-radius: 20px; padding: 0; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(23, 23, 27, .18);
}
.signin::backdrop { background: rgba(23, 23, 27, .35); }
.signin form { padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.signin p { margin: 0; color: var(--text); }
.signin label { font-size: 14px; font-weight: 600; }
.signin .consent { display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 15px; color: var(--text); min-height: 44px; }
.signin .consent input { width: 18px; height: 18px; accent-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 8px; flex-wrap: wrap; }

.notfound { padding-block: 96px; }

/* language menu */
.site-header nav { align-items: center; }
.lang-menu { position: relative; }
.lang-menu summary {
  list-style: none; cursor: pointer; min-height: 44px; padding: 0 4px;
  display: inline-flex; align-items: center; gap: 8px;
  font: 500 15px/1 var(--sans); color: var(--ink);
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover span { text-decoration: underline; }
.lang-menu ul {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 20;
  margin: 0; padding: 6px; list-style: none; min-width: 168px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(23, 23, 27, .12);
}
.lang-menu a {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 10px;
  color: var(--ink); font-size: 16px;
}
.lang-menu a:hover { background: var(--bg); text-decoration: none; }
.lang-menu a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.tr-note { color: var(--muted); font-weight: 400; }
.newsletter .note { font-size: 15px; color: var(--muted); }

/* scripts the brand fonts don't cover: fall back per glyph to a matching face */
:root:lang(hi) {
  --display: 'Poppins', system-ui, sans-serif;
  --sans: 'Poppins', system-ui, sans-serif;
  --typed: 'Poppins', system-ui, sans-serif;
  --type: 'Poppins', system-ui, sans-serif;
  --hand: 'Poppins', system-ui, sans-serif;
}
:root:lang(ar) {
  --display: 'IBM Plex Sans Arabic', 'Poppins', system-ui, sans-serif;
  --sans: 'IBM Plex Sans Arabic', 'Poppins', system-ui, sans-serif;
  --typed: 'IBM Plex Sans Arabic', 'Poppins', system-ui, sans-serif;
  --type: 'IBM Plex Sans Arabic', 'Poppins', system-ui, sans-serif;
  --hand: 'IBM Plex Sans Arabic', 'Poppins', system-ui, sans-serif;
}
/* Letter-spacing breaks Arabic joining and crowds Devanagari; these scripts also need taller lines. */
:lang(hi) h1, :lang(ar) h1, :lang(hi) h2, :lang(ar) h2,
:lang(hi) .eyebrow, :lang(ar) .eyebrow, :lang(hi) .move-label, :lang(ar) .move-label,
:lang(hi) .quote blockquote, :lang(ar) .quote blockquote { letter-spacing: normal; }
:lang(hi) h1, :lang(ar) h1 { line-height: 1.35; font-weight: 700; }
:lang(hi) .quote blockquote, :lang(ar) .quote blockquote { line-height: 1.6; }
:lang(hi) .body, :lang(ar) .body { line-height: 1.75; }
:lang(ar) h1 { font-size: clamp(34px, 7vw, 54px); }
:lang(ar) .eyebrow, :lang(ar) .move-label { font-size: 15px; }

/* email addresses always read left to right */
input[type="email"] { direction: ltr; }
[dir="rtl"] input[type="email"]:placeholder-shown { text-align: right; }

/* mirror the quote mark for right-to-left */
[dir="rtl"] .quote svg { transform: scaleX(-1); }

@media (max-width: 520px) {
  main.wrap { padding-block: 24px 48px; gap: 44px; }
  .check { gap: 22px; }
  .body { font-size: 19px; }
  .quote { padding: 22px; }
  .move p { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* typewriter entrance */
.tw-pending .check h1, .tw-pending .check .body, .tw-pending .check .quote blockquote,
.tw-pending .check .quote figcaption, .tw-pending .check .move p {
  visibility: hidden;
  /* safety net: show the text even if the script never runs */
  animation: tw-reveal 0s 5s forwards;
}
@keyframes tw-reveal { to { visibility: visible; } }
.tw-w { opacity: 0; }
.tw-w.on { opacity: 1; transition: opacity 0.32s ease-out; }

/* Boxes sit inside the column: their edges line up with the text above and below. */

/* previous / next, and the link to every past check */
.past { display: flex; flex-direction: column; gap: 16px; margin-top: -16px; }
.check-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.check-nav a {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink);
}
.check-nav a:hover { border-color: var(--ink); text-decoration: none; }
.check-nav .next { text-align: end; }
.nav-label { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.nav-title { font-family: var(--typed); font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.all-checks { align-self: flex-start; font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; }
@media (max-width: 520px) {
  .check-nav { grid-template-columns: 1fr; }
  .check-nav span.prev, .check-nav span.next { display: none; }
  .check-nav .next { text-align: start; }
}

/* past checks page */
.archive { gap: 32px; }
.archive-head { display: flex; flex-direction: column; gap: 10px; }
.archive-head p { margin: 0; color: var(--text); font-size: 18px; }
.archive-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.archive-list li { border-bottom: 1px solid var(--line); }
.archive-list a { display: flex; flex-direction: column; gap: 6px; padding-block: 18px; color: var(--ink); }
.archive-list a:hover { text-decoration: none; }
.archive-list a:hover .archive-title { color: var(--accent); }
.archive-date { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.archive-title { font-family: var(--typed); font-size: 24px; line-height: 1.25; overflow-wrap: anywhere; }
.badge { font-size: 11px; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: #fff; }
:lang(hi) .nav-label, :lang(ar) .nav-label, :lang(hi) .archive-date, :lang(ar) .archive-date { letter-spacing: normal; }

/* highlighter: a soft, slightly uneven yellow stroke behind key words */
mark.hl {
  color: inherit;
  background-color: transparent;
  background-image:
    linear-gradient(100deg, rgba(255, 221, 64, 0) 0.6%, rgba(255, 221, 64, 0.85) 2.2%, rgba(255, 221, 64, 0.62) 7%, rgba(255, 221, 64, 0.52) 90%, rgba(255, 221, 64, 0.8) 96.5%, rgba(255, 221, 64, 0) 99.4%),
    linear-gradient(183deg, rgba(255, 221, 64, 0) 0%, rgba(255, 221, 64, 0.32) 12%, rgba(255, 221, 64, 0) 26%);
  background-repeat: no-repeat;
  background-size: 100% 64%;
  background-position: 0 88%;
  padding-inline: 0.14em;
  margin-inline: -0.14em;
  border-radius: 0.35em 0.6em 0.45em 0.7em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 0.65s cubic-bezier(0.3, 0.7, 0.25, 1);
}
[dir="rtl"] mark.hl { background-position: 100% 88%; }
/* hidden while the text types; the sweep starts when typing ends */
.tw-pending mark.hl, .tw-typing mark.hl { background-size: 0% 64%; transition: none; }
/* a part's highlight sweeps in as soon as that part has been typed */
.tw-typing mark.hl.hl-on { background-size: 100% 64%; transition: background-size 0.65s cubic-bezier(0.3, 0.7, 0.25, 1); }

/* script fonts have no handwritten style: keep their labels a little smaller */
:lang(hi) .eyebrow > span:first-child, :lang(ar) .eyebrow > span:first-child { font-size: 16px; font-weight: 600; }
:lang(hi) .move-label, :lang(ar) .move-label { font-size: 16px; font-weight: 600; }

/* ---- Poppins sizing: one family, hierarchy by size and weight ---- */
.logo span { font-weight: 600; font-size: 19px; letter-spacing: -0.02em; }
h1 { font-weight: 600; font-size: clamp(32px, 6.4vw, 48px); line-height: 1.18; letter-spacing: -0.025em; }
.eyebrow > span:first-child, .move-label {
  font-family: var(--sans); font-size: 13px; font-weight: 600; line-height: 1.3;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
}
.body { font-size: 18px; line-height: 1.7; }
.quote blockquote { font-weight: 500; font-size: clamp(20px, 3.8vw, 23px); line-height: 1.45; letter-spacing: -0.01em; }
.quote figcaption { font-size: 14px; font-weight: 400; }
.move p { font-size: 18px; line-height: 1.6; font-weight: 600; }
.newsletter h2, .signin h2 { font-weight: 600; font-size: 24px; letter-spacing: -0.02em; }
.nav-title { font-size: 16px; font-weight: 500; line-height: 1.4; }
.archive-title { font-size: 20px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
@media (max-width: 520px) { .body { font-size: 17px; } .move p { font-size: 17px; } }
:lang(hi) h1, :lang(ar) h1 { letter-spacing: normal; line-height: 1.45; }
:lang(hi) .eyebrow > span:first-child, :lang(ar) .eyebrow > span:first-child, :lang(hi) .move-label, :lang(ar) .move-label { letter-spacing: normal; font-size: 14px; }

/* the day's stick-figure scene (drawn and animated by scene.js) */
.scene { margin: 0; width: 100%; max-width: 560px; aspect-ratio: 560 / 190; }
.scene svg { display: block; width: 100%; height: 100%; overflow: visible; }
.scene .ground, .scene .fig path, .scene .fig circle, .scene .prop path {
  fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
}
.scene .fig circle { fill: var(--bg); }
.scene .prop { opacity: 0; transition: opacity 0.4s ease; }
.scene .prop.on, .scene .bench, .scene .laptop { opacity: 1; }
.scene .trail { opacity: 1; }
.scene .trail circle { fill: var(--accent); opacity: 0; transition: opacity 0.2s ease; }
.scene .trail.on circle { opacity: 1; }
.scene .bulb .glow {
  fill: rgba(255, 221, 64, 0.75); opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0.4);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.scene .bulb .filament { stroke: var(--accent); }
.scene .bulb .rays path { stroke: #E0B000; stroke-width: 3.5; opacity: 0; transition: opacity 0.3s ease 0.25s; }
.scene .bulb.lit .glow { opacity: 1; transform: scale(1); }
.scene .bulb.lit .rays path { opacity: 1; }
.scene .question { font: 600 26px var(--sans); fill: var(--accent); transition: opacity 0.25s ease; }
[dir="rtl"] .scene svg { transform: scaleX(-1); }
/* waits for its turn in the typing sequence */
.tw-pending .scene, .tw-typing .scene:not(.play) { visibility: hidden; }
/* Bob's ball */
.scene .ball circle { fill: var(--surface); stroke: var(--ink); stroke-width: 2.6; }
.scene .ball .seam { stroke-width: 2; }
/* boxes wait for their text to start typing */
.tw-pending .check .quote, .tw-pending .check .move,
.tw-typing .check .quote:not(.tw-on), .tw-typing .check .move:not(.tw-on) { visibility: hidden; }

/* Bob pulls the title in on a rope */
html, body { overflow-x: clip; }
@supports not (overflow: clip) { html, body { overflow-x: hidden; } }
.check { position: relative; }
.check h1 { will-change: transform; }
.rope-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; transition: opacity 0.35s ease; }
.rope-layer path { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.rope-layer circle { fill: var(--accent); }
.rope-layer.gone { opacity: 0; }

@media (prefers-reduced-motion: reduce) { [data-replay] { display: none; } }
