*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { font-family: var(--font-heading); line-height: 1.15; margin: 0 0 var(--space-3); }
h1 { font-size: clamp(2rem, 7vw, 3.4rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 4.5vw, 2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 var(--space-3); }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--text-muted); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--gutter); top: var(--space-2); background: var(--surface); padding: var(--space-2); z-index: 10; }

/* Top bar */
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); padding: var(--space-4) 0; }
.bar-actions { display: flex; align-items: center; gap: var(--space-3); }
.nav-link { color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.nav-link:hover { color: var(--primary); }
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-heading); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.02em; color: var(--text); text-decoration: none; }
.wordmark-mark { flex: none; width: 30px; height: 30px; }
.wordmark-mark .mark-w2 { fill: var(--accent); opacity: 0.9; }
.wordmark-mark .mark-w1 { fill: var(--primary); }
.wordmark .tow { color: var(--primary); }
.wordmark small { font-weight: 500; font-size: 0.75em; color: var(--text-muted); margin-left: 0.35em; letter-spacing: 0; }
.theme-toggle { background: transparent; color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 0.85rem; cursor: pointer; }
.theme-toggle:hover { color: var(--text); }
.foot-tools { margin-bottom: var(--space-3); }

/* Account control in the header: a Log in button, or the member's initial and name */
.login-link { display: inline-block; background: linear-gradient(135deg, var(--primary), var(--accent)); color: var(--on-primary); border-radius: 999px; padding: 8px 18px; font-weight: 700; font-size: 0.9rem; text-decoration: none; white-space: nowrap; }
.login-link:hover { filter: brightness(1.08); }
.acct { display: inline-flex; align-items: center; gap: 8px; max-width: 12rem; border: 1px solid var(--border); border-radius: 999px; padding: 4px 14px 4px 4px; color: var(--text); font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.acct:hover { border-color: var(--primary); }
.acct-avatar { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-family: var(--font-heading); font-weight: 700; font-size: 0.85rem; }
.acct-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) { .acct { padding-right: 4px; } .acct-name { display: none; } }

/* Hero with wave fill */
.hero { position: relative; overflow: hidden; padding: var(--space-6) 0 var(--space-7); }
.hero .wrap { position: relative; z-index: 1; display: grid; gap: var(--space-6); }
.eyebrow { display: inline-block; font-size: 0.85rem; font-weight: 600; color: var(--primary); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: var(--space-3); }
.lede { font-size: 1.15rem; color: var(--text-muted); max-width: 34rem; }
.wave { position: absolute; left: 0; right: 0; bottom: 0; height: 70%; z-index: 0; pointer-events: none; transform: translateY(0); animation: wave-rise 0.9s ease-out both; -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%); mask-image: linear-gradient(to bottom, black 85%, transparent 100%); }
.wave svg { position: absolute; left: 0; bottom: 0; width: 200%; height: 100%; }
.wave .w1 { fill: var(--primary); opacity: 0.22; animation: wave-drift 18s linear infinite; }
.wave .w2 { fill: var(--primary); opacity: 0.13; animation: wave-drift 28s linear infinite reverse; }
.wave .w3 { fill: var(--accent); opacity: 0.16; animation: wave-drift 34s linear infinite; }
@keyframes wave-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes wave-drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Signup card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); }
.card h2 { font-size: 1.35rem; }
.field { display: grid; gap: var(--space-1); margin-bottom: var(--space-4); }
label { font-weight: 600; font-size: 0.95rem; }
input[type="email"], input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; min-height: 48px;
}
input::placeholder { color: var(--text-muted); opacity: 1; }
.check { display: flex; gap: var(--space-3); align-items: flex-start; font-weight: 400; font-size: 0.9rem; color: var(--text-muted); }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--primary); }
.err { color: var(--negative); font-size: 0.9rem; margin: 0; }
.alert { background: color-mix(in srgb, var(--negative) 14%, var(--surface)); border: 1px solid var(--negative); border-radius: var(--radius-sm); padding: var(--space-3); margin-bottom: var(--space-4); }
.btn { display: inline-block; width: 100%; min-height: 52px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: var(--on-primary); border: 0; border-radius: var(--radius-sm); font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; padding: 12px 20px; text-align: center; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.fine { font-size: 0.8rem; color: var(--text-muted); margin: var(--space-3) 0 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Sections */
section.block { padding: var(--space-6) 0; }
.steps { display: grid; gap: var(--space-4); list-style: none; padding: 0; margin: var(--space-5) 0 0; counter-reset: step; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); counter-increment: step; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-family: var(--font-heading); font-weight: 700; margin-bottom: var(--space-3); }
.steps p { color: var(--text-muted); margin: 0; }
.step-date { display: inline-block; background: color-mix(in srgb, var(--primary) 16%, var(--surface)); color: var(--primary); font-size: 0.78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin: 0 0 var(--space-2); }
.step-date.accent { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); color: var(--accent); }

/* App screenshots: a one-at-a-time slideshow. Swipe, or use the arrows/dots below. */
.shots-frame { max-width: 300px; margin: var(--space-5) auto 0; }
.shots { list-style: none; margin: 0; padding: var(--space-2) 0 var(--space-4); display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.shots::-webkit-scrollbar { display: none; }
.shots li { flex: none; width: 100%; scroll-snap-align: start; }
.shots figure { margin: 0; }
.shots img { display: block; width: 100%; height: auto; border-radius: 26px; border: 1px solid var(--border); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35); background: var(--surface); }
.shots figcaption { margin-top: var(--space-3); display: grid; gap: 2px; font-size: 0.88rem; text-align: center; }
.shots figcaption strong { font-family: var(--font-heading); font-size: 1rem; }
.shots figcaption span { color: var(--text-muted); }
.shots-controls { display: flex; align-items: center; justify-content: center; gap: var(--space-4); margin-top: var(--space-2); }
.shots-nav { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.shots-nav:hover { color: var(--primary); border-color: var(--primary); }
.shots-nav:disabled { opacity: 0.35; cursor: default; }
.shots-nav:disabled:hover { color: var(--text); border-color: var(--border); }
.shots-dots { display: flex; }
/* 24x24 tap target (WCAG 2.5.8) around an 8px visual dot */
.dot { width: 24px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; display: inline-grid; place-items: center; }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--border); }
.dot[aria-current="true"]::before { background: var(--primary); width: 20px; }
@media (min-width: 640px) {
  .shots-frame { max-width: 340px; }
}

details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-3); }
summary { cursor: pointer; font-weight: 600; min-height: 32px; }
details p { margin: var(--space-2) 0 0; color: var(--text-muted); }

/* Footer */
footer { border-top: 1px solid var(--border); padding: var(--space-5) 0 var(--space-6); font-size: 0.85rem; color: var(--text-muted); }
footer p { margin-bottom: var(--space-2); }

/* Simple text pages */
.page { padding-top: var(--space-5); padding-bottom: var(--space-6); max-width: 40rem; }
.page ul { padding-left: 1.2em; }
.page table { width: 100%; border-collapse: collapse; margin: var(--space-3) 0 var(--space-4); }
.page th, .page td { padding: 8px 10px; text-align: left; font-size: 0.92rem; border-bottom: 1px solid var(--border); }
.page th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.page td.num, .page th.num { text-align: right; }
.page .crumb-back { display: block; margin-bottom: var(--space-3); font-size: 0.9rem; }
.page h2 { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.page h2:first-of-type { margin-top: var(--space-4); padding-top: 0; border-top: 0; }

/* A plain table of contents for long reference pages (Fantasy 101) */
.toc { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: var(--space-3) 0; margin: var(--space-4) 0; font-size: 0.92rem; line-height: 2; }
.toc-label { display: block; font-weight: 600; margin-bottom: var(--space-1); }
.toc a { margin-right: var(--space-4); white-space: nowrap; }

/* About page: profile photo (or initials) beside the bio */
.profile { display: flex; gap: var(--space-4); align-items: flex-start; margin-top: var(--space-4); }
.profile-pic { flex: none; display: inline-grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; background: color-mix(in srgb, var(--primary) 22%, var(--surface-2)); border: 1px solid var(--border); color: var(--text); font-family: var(--font-heading); font-weight: 700; font-size: 2.2rem; overflow: hidden; }
.profile-pic img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 480px) {
  .profile { flex-direction: column; align-items: center; text-align: center; }
}

@media (min-width: 800px) {
  .hero .wrap { grid-template-columns: 1.15fr 1fr; align-items: center; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .btn { width: auto; }
  .card .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .wave, .wave .w1, .wave .w2 { animation: none; }
}


/* Signed-in home: progress strip, link list, share card */
.progress { display: grid; gap: var(--space-2); list-style: none; padding: 0; margin: var(--space-5) 0; }
.progress li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.progress li::before { content: "○"; color: var(--text-muted); }
.progress li.done::before { content: "✓"; color: var(--positive, var(--primary)); font-weight: 700; }
.progress li.now { border-color: var(--primary); }
.progress li.now::before { content: "●"; color: var(--primary); }
.progress .step-name { font-weight: 600; }
.progress small { color: var(--text-muted); margin-left: auto; }
.links { padding-left: var(--space-5); }
.links li { margin-bottom: var(--space-2); }
.big { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; margin: 0 0 var(--space-2); }
.share { margin-top: var(--space-6); }
.share-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.share-row input { flex: 1 1 14rem; width: auto; }
.btn-copy { min-height: 48px; padding: 8px 18px; border-radius: var(--radius-sm); border: 1px solid var(--primary); background: transparent; color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; }
.btn-copy:hover { background: color-mix(in srgb, var(--primary) 12%, transparent); }
.btn-copy[hidden] { display: none; }
