/* ==========================================================
   Base styles (shared by every page)
   ----------------------------------------------------------
   1. Theme variables (light / dark)
   2. Reset & page
   3. Typography
   4. Buttons
   5. Form fields
   ========================================================== */


/* ---------- 1. Theme variables ---------- */

:root {
  --bg: #fff3e6;
  --fg: #3b1f4a;
  --card: #ffffff;
  --muted: rgba(59, 31, 74, 0.65);
  --ac: #ff4d8d;   /* main accent (each template overrides it) */
  --ac2: #ffb703;  /* secondary accent */

  /* Design tokens: change these to restyle the whole site */
  --radius-card: 24px;
  --radius-pill: 999px;
  --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.2);

  box-sizing: border-box;

  /* Keep content clear of phone notches / system bars */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark mode: follows the device setting */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1030;
    --fg: #fbeaff;
    --card: #2c1a45;
    --muted: rgba(251, 234, 255, 0.7);
  }
}


/* ---------- 2. Reset & page ---------- */

* {
  box-sizing: border-box;
}

/* The HTML "hidden" attribute must always hide the element */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh; /* accounts for the mobile address bar */

  background: var(--bg);
  color: var(--fg);
  font-family: 'Trebuchet MS', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}


/* ---------- 3. Typography ---------- */

h1 {
  margin: 0.3em 0;
  font-size: clamp(1.5rem, 6vw, 2rem);
  color: var(--ac);
}

p {
  font-size: clamp(1rem, 3.5vw, 1.1rem);
  line-height: 1.5;
}

.small {
  font-size: 0.85rem;
  opacity: 0.7;
}


/* ---------- 4. Buttons ---------- */

.btn {
  display: inline-block;
  min-height: 44px; /* comfortable tap target */
  margin-top: 8px;
  padding: 12px 22px;

  background: var(--ac);
  color: #ffffff;
  font: inherit;
  font-weight: bold;
  text-decoration: none;
  border: 2px solid var(--ac);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform 100ms ease, filter 120ms ease, background-color 120ms ease,
    color 120ms ease;
}

.btn--outline {
  background: transparent;
  color: var(--ac);
}

@media (hover: hover) {
  .btn:hover:not(:disabled) {
    filter: brightness(1.05);
  }
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
  filter: brightness(0.96);
}

.btn:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 3px;
}

.btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.btn.is-loading::before {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.55em;
  vertical-align: -0.08em;
  content: "";
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spinner 700ms linear infinite;
}

@keyframes button-spinner {
  to {
    transform: rotate(360deg);
  }
}

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


/* ---------- 5. Form fields ---------- */

.field label {
  display: block;
  margin-top: 10px;

  font-size: 0.85rem;
  font-weight: bold;
  text-align: left;
  opacity: 0.8;
}

.field input,
.field textarea {
  width: 100%;
  max-width: 100%;
  margin-top: 6px;
  padding: 10px 14px;

  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  border: 2px solid var(--ac);
  border-radius: 14px;
}

.field input[type="color"] {
  width: 60px;
  height: 44px;
  padding: 2px;
}
