:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6b6862;
  --line: #e6e3dc;
  --accent: #b8531f;
  --fox: #e07a3a;
  --fox-cream: #fff3e4;
  --fox-ink: #2b1d14;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* Dark colors: used when the toggle picks dark (js/theme.js sets data-theme), or
   when the system is dark and nothing has been picked. Keep both blocks in sync. */
:root[data-theme="dark"] {
  --bg: #161615;
  --surface: #1d1d1b;
  --text: #ecebe7;
  --muted: #9b9890;
  --line: #2d2c29;
  --accent: #ec9a62;
  --fox: #e07a3a;
  --fox-cream: #f6e6d2;
  --fox-ink: #1a120c;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161615;
    --surface: #1d1d1b;
    --text: #ecebe7;
    --muted: #9b9890;
    --line: #2d2c29;
    --accent: #ec9a62;
  --fox: #e07a3a;
  --fox-cream: #f6e6d2;
  --fox-ink: #1a120c;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s ease;
}

/* home.js adds this once the page is scrolled */
.site-header.scrolled {
  border-bottom-color: var(--line);
}

/* Faint drifting dots behind the home page (drawn by js/home.js) */
.dot-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

html {
  scroll-padding-top: 76px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: var(--text);
}

/* Intro */

.intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(78vh - 60px);
  padding-top: 48px;
  padding-bottom: 48px;
}

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 40px;
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.scroll-cue:hover {
  color: var(--text);
}

.scroll-cue svg {
  width: 16px;
  height: 16px;
  animation: cueBob 2s ease-in-out infinite;
}

@keyframes cueBob {
  50% { transform: translateY(4px); }
}

/* Reveal on scroll: hidden until home.js marks it shown. Only applies when scripts run
   (theme.js adds .js), so the page still reads fine without them. */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.shown {
  opacity: 1;
  transform: none;
}

.tool.reveal:nth-child(2) { transition-delay: 0.05s; }
.tool.reveal:nth-child(3) { transition-delay: 0.1s; }
.tool.reveal:nth-child(4) { transition-delay: 0.15s; }
.tool.reveal:nth-child(5) { transition-delay: 0.2s; }
.tool.reveal:nth-child(6) { transition-delay: 0.25s; }
.why-item.reveal:nth-child(2) { transition-delay: 0.1s; }
.why-item.reveal:nth-child(3) { transition-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .scroll-cue svg {
    animation: none;
  }
}

.intro h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.25rem, 7vw, 3.75rem);
  line-height: 1.15;
  margin: 0 0 12px;
}

.intro p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 34em;
  margin: 0;
}

/* Sections */

section + section {
  margin-top: 96px;
}

.section-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.section-head h2 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}

/* Tool list */

.tool-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tool {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  align-items: baseline;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.tool-name {
  font-weight: 500;
}

.tool-desc {
  color: var(--muted);
}

.tool-status {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* A finished tool: wrap the row contents in <a class="tool-link" href="tools/name/">. */
.tool-link {
  display: contents;
  text-decoration: none;
}

.tool-status.tool-ready {
  color: var(--accent);
  font-weight: 500;
}

.tool-link:hover .tool-name {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Why */

.why-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-top: 24px;
}

.why-item h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.why-item p {
  color: var(--muted);
  margin: 0;
}

/* About */

.about p {
  color: var(--muted);
  margin: 16px 0 0;
}

/* Footer */

.site-footer {
  margin-top: 96px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .intro {
    min-height: calc(70vh - 60px);
    padding-top: 32px;
  }

  .why-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .tool {
    grid-template-columns: 1fr auto;
    gap: 4px 16px;
  }

  .tool-desc {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* Account */

.extra-links {
  display: contents;
}

.extra-links a,
.link-button {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.extra-links a:hover,
.link-button:hover {
  color: var(--text);
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}

.account {
  display: inline-flex;
  gap: 12px;
  align-items: baseline;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.account-name {
  font-size: 0.95rem;
  font-weight: 500;
}

[hidden] {
  display: none !important;
}

/* Theme toggle: shows the moon in light mode and the sun in dark mode. */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
}

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

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-toggle .icon-sun,
:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}


.auth-dialog {
  width: min(360px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.auth-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.auth-tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0 0 10px;
  font: inherit;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.auth-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.auth-form label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.auth-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.auth-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.auth-error {
  min-height: 1.2em;
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: #b3412e;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.button-primary,
.button-secondary {
  padding: 8px 14px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.button-primary {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--surface);
}

.button-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.button-secondary {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
}

@media (max-width: 600px) {
  .site-nav {
    gap: 14px;
  }

  .site-nav > a[href^="#"] {
    display: none;
  }
}

.account-name {
  color: var(--text);
}

.account-dialog-title {
  margin: 0 0 16px;
  font-size: 1.1rem;
}

.account-section-title {
  margin: 20px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

/* Fox bits: the logo mark, the hero fox, and the footer paw trail. */

.fox-fur { fill: var(--fox); }
.fox-cream { fill: var(--fox-cream); }
.fox-ink { fill: var(--fox-ink); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fox-mark {
  width: 26px;
  height: 26px;
  flex: none;
}

.eyebrow {
  margin: 0 0 6px !important;
  color: var(--accent) !important;
  font-size: 0.85rem !important;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.intro-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  align-items: center;
  gap: 32px;
}

.hero-fox {
  width: 220px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.hero-fox:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 12px;
}

.hero-fox svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.fox-shadow {
  fill: var(--line);
}

.fox-glasses {
  fill: none;
  stroke: var(--fox-ink);
  stroke-width: 3.5;
  stroke-linecap: round;
}

.fox-book-cover {
  fill: var(--accent);
}

.fox-book-spine {
  stroke: var(--fox-cream);
  stroke-width: 2;
}

.fox-tail {
  transform-origin: 146px 170px;
  animation: foxTail 4s ease-in-out infinite;
}

.fox-ear-l { transform-origin: 60px 60px; }
.fox-ear-r { transform-origin: 140px 60px; animation: foxEar 7s ease-in-out infinite; }

.fox-eyes {
  transform-origin: 100px 88px;
  animation: foxBlink 5s ease-in-out infinite;
}

/* home.js adds .wink when the fox is clicked */
.hero-fox.wink .fox-head {
  animation: foxNod 0.6s ease;
  transform-origin: 100px 140px;
}

.hero-fox.wink .fox-ear-l {
  animation: foxEar 0.6s ease;
}

@keyframes foxTail {
  50% { transform: rotate(-7deg); }
}

@keyframes foxEar {
  0%, 92%, 100% { transform: none; }
  95% { transform: rotate(8deg); }
}

@keyframes foxBlink {
  0%, 94%, 100% { transform: none; }
  97% { transform: scaleY(0.1); }
}

@keyframes foxNod {
  40% { transform: rotate(-6deg) translateY(-4px); }
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-inner > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-inner .fox-mark {
  width: 20px;
  height: 20px;
}

.paw-trail {
  width: 120px;
  height: 20px;
  background: var(--accent);
  opacity: 0.45;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 20'%3E%3Cg%3E%3Cellipse cx='8' cy='13' rx='3.2' ry='2.6'/%3E%3Ccircle cx='4.5' cy='9' r='1.3'/%3E%3Ccircle cx='7' cy='7.2' r='1.3'/%3E%3Ccircle cx='9.8' cy='7.4' r='1.3'/%3E%3Ccircle cx='12' cy='9.4' r='1.3'/%3E%3C/g%3E%3Cg transform='translate(14 -5)'%3E%3Cellipse cx='8' cy='13' rx='3.2' ry='2.6'/%3E%3Ccircle cx='4.5' cy='9' r='1.3'/%3E%3Ccircle cx='7' cy='7.2' r='1.3'/%3E%3Ccircle cx='9.8' cy='7.4' r='1.3'/%3E%3Ccircle cx='12' cy='9.4' r='1.3'/%3E%3C/g%3E%3C/svg%3E") repeat-x left center / 30px 20px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 20'%3E%3Cg%3E%3Cellipse cx='8' cy='13' rx='3.2' ry='2.6'/%3E%3Ccircle cx='4.5' cy='9' r='1.3'/%3E%3Ccircle cx='7' cy='7.2' r='1.3'/%3E%3Ccircle cx='9.8' cy='7.4' r='1.3'/%3E%3Ccircle cx='12' cy='9.4' r='1.3'/%3E%3C/g%3E%3Cg transform='translate(14 -5)'%3E%3Cellipse cx='8' cy='13' rx='3.2' ry='2.6'/%3E%3Ccircle cx='4.5' cy='9' r='1.3'/%3E%3Ccircle cx='7' cy='7.2' r='1.3'/%3E%3Ccircle cx='9.8' cy='7.4' r='1.3'/%3E%3Ccircle cx='12' cy='9.4' r='1.3'/%3E%3C/g%3E%3C/svg%3E") repeat-x left center / 30px 20px;
}

@media (max-width: 600px) {
  .intro-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .hero-fox {
    order: -1;
    width: 130px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fox-tail,
  .fox-ear-r,
  .fox-eyes,
  .hero-fox.wink .fox-head,
  .hero-fox.wink .fox-ear-l {
    animation: none;
  }
}

/* "Save to my account" bar for tools (js/tool-sync.js) */

.sync {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 10px;
  font-size: 0.9rem;
}

.sync-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  cursor: pointer;
}

.sync-toggle input {
  accent-color: var(--accent);
}

.sync-status {
  color: var(--muted);
}

.sync-status a {
  color: var(--accent);
}

.sync-status.sync-warn {
  color: #b3412e;
}
