/* Pupside site styles.
   One stylesheet, no framework, no web fonts. The page is mostly text and four
   screenshots, and a font download would cost more than the whole document. */

:root {
  --cream: #FBF4E8;
  --card: #FFFBF3;
  --ink: #3A2E22;
  --ink-soft: #6B5A47;
  --sage: #7D9471;
  --sage-deep: #5C7352;
  --honey: #D9A441;
  --line: rgba(58, 46, 34, 0.12);
  --shadow: rgba(58, 46, 34, 0.10);
  --radius: 18px;
  --wrap: 1060px;
}

/* Light is the default, deliberately. The app is a warm, sunlit room and the
   site should read the same way on first load. Dark is available through the
   toggle in the header and is remembered per visitor; it is not taken from the
   system, because a cosy cream page is the intended first impression. */
:root[data-theme="dark"] {
  --cream: #1B1510;
  --card: #241C15;
  --ink: #F3E9DA;
  --ink-soft: #BCAA94;
  --line: rgba(243, 233, 218, 0.14);
  --shadow: rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(var(--wrap), 100% - 2.5rem); margin-inline: auto; }

a { color: var(--sage-deep); }
:root[data-theme="dark"] a { color: #A8C39C; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: clamp(2rem, 5.2vw, 3.3rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.45rem, 3.2vw, 2.1rem); margin: 0 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 0 0 0.4rem; }
p { margin: 0 0 1rem; }

/* Header */
.site-head {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(140%) blur(12px);
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 0; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; text-decoration: none; color: var(--ink); }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.nav { display: flex; gap: 1.1rem; font-size: 0.93rem; }
.nav a { text-decoration: none; color: var(--ink-soft); }
.nav a:hover { color: var(--ink); }
@media (max-width: 620px) { .nav { display: none; } }

/* Hero */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 2rem; }
.hero-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; } }
.lede { font-size: clamp(1.05rem, 2.2vw, 1.2rem); color: var(--ink-soft); max-width: 46ch; }

.badge {
  display: inline-block; padding: 0.3rem 0.7rem; border-radius: 999px;
  background: color-mix(in srgb, var(--sage) 22%, transparent);
  color: var(--sage-deep); font-size: 0.8rem; font-weight: 600;
  margin-bottom: 1rem; border: 1px solid var(--line);
}
:root[data-theme="dark"] .badge { color: #A8C39C; }

.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.shots img {
  width: 100%; height: auto; border-radius: 14px; display: block;
  border: 1px solid var(--line); box-shadow: 0 10px 30px var(--shadow);
}
.shots img:nth-child(2) { transform: translateY(1.4rem); }
@media (max-width: 480px) { .shots img:nth-child(2) { transform: none; } }

/* Buttons and the signup form */
.cta { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1.4rem 0 0.6rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.8rem 1.3rem; border-radius: 12px; font-weight: 600; font-size: 1rem;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--sage); color: #1D2A18; }
.btn-primary:hover { background: var(--sage-deep); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }

.signup { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.1rem; }
.signup input[type="email"] {
  flex: 1 1 15rem; padding: 0.8rem 1rem; border-radius: 12px; font-size: 1rem;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
}
.form-note { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.5rem; }
.form-status { font-size: 0.9rem; margin-top: 0.6rem; min-height: 1.3em; }
.form-status[data-state="ok"] { color: var(--sage-deep); }
.form-status[data-state="error"] { color: #B4542F; }

/* Sections */
section { padding: clamp(2.2rem, 5vw, 3.6rem) 0; }
.section-head { max-width: 58ch; margin-bottom: 1.8rem; }
.section-head p { color: var(--ink-soft); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.3rem; box-shadow: 0 2px 10px var(--shadow);
}
.card h3 { color: var(--ink); }
.card p { color: var(--ink-soft); margin: 0; font-size: 0.95rem; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: center; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.split img { width: 100%; max-width: 330px; height: auto; border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 10px 30px var(--shadow); }

/* FAQ */
details {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 1rem 1.2rem; margin-bottom: 0.7rem;
}
details summary { cursor: pointer; font-weight: 600; list-style: none; }
details summary::-webkit-details-marker { display: none; }
/* The open state rotates the plus into a cross. The obvious alternative is a
   dash glyph, and this site has none anywhere, on purpose. */
details summary::after {
  content: "+"; float: right; color: var(--ink-soft);
  display: inline-block; transition: transform 0.18s ease;
}
details[open] summary::after { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) {
  details summary::after { transition: none; }
}
details p { margin: 0.8rem 0 0; color: var(--ink-soft); }

/* Footer */
.site-foot { border-top: 1px solid var(--line); padding: 2rem 0 3rem; color: var(--ink-soft); font-size: 0.9rem; }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-foot a { color: var(--ink-soft); }

/* Cookie consent. Analytics does not load until this is answered. */
.consent {
  position: fixed; inset-inline: 1rem; bottom: 1rem; z-index: 50;
  max-width: 34rem; margin-inline: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 1rem 1.2rem; box-shadow: 0 14px 40px var(--shadow);
}
.consent p { font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 0.8rem; }
.consent .row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.consent .btn { padding: 0.55rem 1rem; font-size: 0.9rem; }
.consent[hidden] { display: none; }

/* Prose pages: support, privacy */
.prose { max-width: 70ch; padding-bottom: 3rem; }
.prose h2 { margin-top: 2.2rem; }
.prose ul { color: var(--ink-soft); padding-left: 1.2rem; }
.prose li { margin-bottom: 0.4rem; }
.prose code { background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 0.1rem 0.35rem; border-radius: 5px; font-size: 0.9em; }

/* Admin dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem; }
.stat .label { font-size: 0.82rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0.6rem 1rem; }
.muted { color: var(--ink-soft); font-size: 0.9rem; }

/* Labels that screen readers need and sighted users do not. Clipped rather
   than display:none, which would hide them from assistive tech too. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------- the puppy */

/* One sprite sheet, 14 frames of 220px: idle 0-3, walk 4-7, bark 8-13.
   Frames were composited onto a shared ground line with the app's own
   measured values, so switching state does not make the puppy jump. */
.puppy {
  --cell: 220px;
  width: var(--cell);
  height: var(--cell);
  background-image: url('/assets/puppy-sprite.png');
  background-repeat: no-repeat;
  background-size: calc(var(--cell) * 14) var(--cell);
  background-position: 0 0;
  border: 0; padding: 0;
  background-color: transparent;
  cursor: pointer;
  position: relative;
  image-rendering: -webkit-optimize-contrast;
  touch-action: manipulation;
}
.puppy:focus-visible { outline: 3px solid var(--sage-deep); outline-offset: 6px; border-radius: 12px; }

/* Idle: a slow blink cycle. Four frames held unevenly in the app, which a
   steps() keyframe cannot express, so the frame is set from script instead
   and this only carries the resting pose. */
.puppy[data-state="idle"] { background-position: 0 0; }

.puppy-stage {
  position: relative;
  min-height: 240px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

/* The ground the puppy stands on. */
.puppy-stage::after {
  content: "";
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  width: min(280px, 70%); height: 14px; border-radius: 50%;
  background: radial-gradient(ellipse at center,
    color-mix(in srgb, var(--ink) 16%, transparent), transparent 70%);
}

.speech {
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%) scale(0.8);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.35rem 0.9rem; font-size: 0.9rem; font-weight: 600; color: var(--ink);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 6px 18px var(--shadow); white-space: nowrap;
}
.speech[data-show="1"] { opacity: 1; transform: translateX(-50%) scale(1); }

.puppy-hint { text-align: center; font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.4rem; }

@media (prefers-reduced-motion: reduce) {
  .speech { transition: none; }
}

/* ------------------------------------------------------- theme switching */

/* Light is the default. Dark is opt in through the toggle, and the system
   preference is honoured only until someone chooses for themselves. */
.theme-toggle {
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  width: 36px; height: 36px; cursor: pointer; color: var(--ink-soft);
  font-size: 1rem; line-height: 1; display: inline-flex;
  align-items: center; justify-content: center;
}
.theme-toggle:hover { color: var(--ink); }
