/* ====================================================================
   Dantastic Hats — minimalist, warm, black & white (for now)

   THEMING: all colors live in the custom properties below. When the
   brand palette arrives, swap the token values — nothing else in the
   stylesheet references raw colors.
==================================================================== */

:root {
  /* ---- palette tokens (light) — replace with brand palette later ---- */
  --bg: #faf8f3;          /* warm paper white */
  --surface: #ffffff;     /* cards & inputs */
  --ink: #1c1a16;         /* soft black, matches the logo */
  --muted: #6f6a60;       /* secondary text */
  --line: #e3ddd0;        /* hairlines & borders */
  --accent: #1c1a16;      /* buttons; will become a brand color */
  --accent-contrast: #faf8f3;  /* text on accent */

  --font: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* ---- palette tokens (dark) ---- */
[data-theme="dark"] {
  --bg: #161510;
  --surface: #201e17;
  --ink: #ece7dd;
  --muted: #a39c8d;
  --line: #383428;
  --accent: #ece7dd;
  --accent-contrast: #161510;
  color-scheme: dark;
}

/* system preference applies only when no explicit choice was made */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #161510;
    --surface: #201e17;
    --ink: #ece7dd;
    --muted: #a39c8d;
    --line: #383428;
    --accent: #ece7dd;
    --accent-contrast: #161510;
    color-scheme: dark;
  }
}

/* ============================ base ============================ */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  background: var(--bg);
  color: var(--ink);
  transition: background-color 0.25s ease, color 0.25s ease;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

.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;
}

/* ========================= theme toggle ========================= */

.site-header {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.25rem;
}

.theme-toggle {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.theme-toggle button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.theme-toggle svg .half {
  fill: currentColor;
  stroke: none;
}

/* ============================ hero ============================ */

.hero {
  text-align: center;
  padding: 3.5rem 0 5rem;
}

.hero-logo {
  /* the SVG is a single-color drawing; masking lets it follow var(--ink) */
  width: min(20rem, 78vw);
  aspect-ratio: 174 / 163.2;   /* logo.svg viewBox ratio */
  margin: 0 auto 2.25rem;
  background-color: var(--ink);
  -webkit-mask: url("../assets/logo.svg") no-repeat center / contain;
  mask: url("../assets/logo.svg") no-repeat center / contain;
}

.tagline {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  font-weight: 700;
}

.subtext {
  margin: 0 0 2.5rem;
  color: var(--muted);
}

/* ========================== sections ========================== */

section {
  padding-bottom: 5rem;
}

/* small-caps heading flanked by dashes, echoing the "— HATS —" lockup */
.section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin: 0 0 1.75rem;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.section-title::before,
.section-title::after {
  content: "";
  width: 2.25rem;
  height: 0.2rem;
  border-radius: 0.1rem;
  background: currentColor;
  flex: none;
}

/* from "Our Story" down, body text reads one size bigger
   (form inputs inherit; footer keeps its small print) */
.story,
.contact {
  font-size: 1.1875rem;
}

.story {
  text-align: center;
}

.story p {
  margin: 0 0 1rem;
}

/* ============================ form ============================ */

#hat-form {
  max-width: 28rem;
  margin: 0 auto;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.field .optional {
  font-weight: 400;
  color: var(--muted);
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.65em 0.85em;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 0.7rem;
  transition: border-color 0.15s ease;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.field textarea {
  resize: vertical;
}

/* honeypot — visually removed, still in the DOM for bots */
.hp {
  position: absolute;
  left: -9999px;
}

/* ============================ buttons ============================ */

.button {
  display: inline-block;
  padding: 0.7em 1.8em;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  color: var(--accent-contrast);
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

#hat-form .button {
  width: 100%;
  margin-top: 0.5rem;
}

/* ====================== form messages ====================== */

.form-error {
  margin: 0 0 1rem;
  font-weight: 700;
}

.confirmation {
  max-width: 28rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  border: 2px dashed var(--line);
  border-radius: 1rem;
}

.confirmation span {
  font-size: 3.25rem;
  line-height: 1.2;
}

/* ============================ footer ============================ */

.site-footer {
  padding: 2.5rem 1.5rem 3rem;
  border-top: 2px solid var(--line);
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0.25rem 0;
}

/* ============================ misc ============================ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  body,
  .button,
  .field input,
  .field textarea {
    transition: none;
  }
}
