/*
 * Shared Tabio page theme. Extracted from the account page so every page on
 * tabio.clorostica.com looks the same: gradient backdrop, translucent card,
 * blue accent. Plain CSS, no build step — same rules as the HTML files next
 * to it.
 *
 * Colour comes only from the custom properties below, so light and dark are
 * the same stylesheet with two palettes. Dark applies either from the OS
 * (auto) or from an explicit choice the toggle stores in localStorage; the
 * two dark blocks must be kept in sync.
 */

:root {
  color-scheme: light;

  --backdrop: linear-gradient(225deg, hsl(330 81% 88%), hsl(262 83% 78%));
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: transparent;
  --card-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-fg: #fff;
  --ink: #111;
  --body: #475569;
  --muted: #64748b;
  --line: #e2e8f0;

  --field-bg: #fff;
  --field-line: #cbd5e1;
  --panel-bg: rgba(248, 250, 252, 0.6);
  --subtle-bg: #f1f5f9;

  --ok: #16a34a;
  --ok-strong: #047857;
  --ok-border: #16a34a;
  --ok-bg: rgba(240, 253, 244, 0.7);

  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-border: rgba(239, 68, 68, 0.4);
  --danger-soft-bg: #fee2e2;
  --danger-block-border: #fecaca;

  --warn: #b45309;
  --warn-solid: #d97706;
  --warn-solid-hover: #b45309;
  --warn-border: rgba(245, 158, 11, 0.4);
  --warn-soft-bg: #fef3c7;
  --warn-block-border: #fde68a;
}

/* Explicit dark, chosen with the toggle. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --backdrop: linear-gradient(225deg, hsl(330 32% 15%), hsl(262 40% 19%));
  --card-bg: rgba(15, 23, 42, 0.86);
  --card-border: rgba(226, 232, 240, 0.1);
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);

  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-fg: #0b1120;
  --ink: #e2e8f0;
  --body: #cbd5e1;
  --muted: #94a3b8;
  --line: rgba(226, 232, 240, 0.14);

  --field-bg: #0f172a;
  --field-line: #334155;
  --panel-bg: rgba(226, 232, 240, 0.04);
  --subtle-bg: rgba(226, 232, 240, 0.08);

  --ok: #4ade80;
  --ok-strong: #34d399;
  --ok-border: #22c55e;
  --ok-bg: rgba(34, 197, 94, 0.12);

  --danger: #f87171;
  --danger-hover: #fca5a5;
  --danger-border: rgba(248, 113, 113, 0.45);
  --danger-soft-bg: rgba(248, 113, 113, 0.15);
  --danger-block-border: rgba(248, 113, 113, 0.35);

  --warn: #fbbf24;
  --warn-solid: #b45309;
  --warn-solid-hover: #92400e;
  --warn-border: rgba(251, 191, 36, 0.45);
  --warn-soft-bg: rgba(251, 191, 36, 0.14);
  --warn-block-border: rgba(251, 191, 36, 0.35);
}

/* Auto: follow the OS unless light was chosen explicitly. Same values as the
   block above — change both together. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;

    --backdrop: linear-gradient(225deg, hsl(330 32% 15%), hsl(262 40% 19%));
    --card-bg: rgba(15, 23, 42, 0.86);
    --card-border: rgba(226, 232, 240, 0.1);
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);

    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-fg: #0b1120;
    --ink: #e2e8f0;
    --body: #cbd5e1;
    --muted: #94a3b8;
    --line: rgba(226, 232, 240, 0.14);

    --field-bg: #0f172a;
    --field-line: #334155;
    --panel-bg: rgba(226, 232, 240, 0.04);
    --subtle-bg: rgba(226, 232, 240, 0.08);

    --ok: #4ade80;
    --ok-strong: #34d399;
    --ok-border: #22c55e;
    --ok-bg: rgba(34, 197, 94, 0.12);

    --danger: #f87171;
    --danger-hover: #fca5a5;
    --danger-border: rgba(248, 113, 113, 0.45);
    --danger-soft-bg: rgba(248, 113, 113, 0.15);
    --danger-block-border: rgba(248, 113, 113, 0.35);

    --warn: #fbbf24;
    --warn-solid: #b45309;
    --warn-solid-hover: #92400e;
    --warn-border: rgba(251, 191, 36, 0.45);
    --warn-soft-bg: rgba(251, 191, 36, 0.14);
    --warn-block-border: rgba(251, 191, 36, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--backdrop);
  background-attachment: fixed;
  color: var(--ink);
  display: flex;
}

/* `margin: auto` centres the card without ever clipping its top the way
   place-items: center does once the content is taller than the viewport. */
.card {
  margin: auto;
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
}

/* Prose pages (policies, support, landing) get a wider card and a larger
   type scale; the compact defaults above suit the app-like forms. */
.card.wide {
  max-width: 720px;
  padding: 2.5rem;
}

h1 { font-size: 1.4rem; margin: 0 0 0.25rem; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0 0 0.5rem; line-height: 1.25; }
h3 { font-size: 0.95rem; margin: 1.25rem 0 0.35rem; line-height: 1.3; }
p { font-size: 0.875rem; color: var(--body); line-height: 1.5; margin: 0 0 0.85rem; }
a { color: var(--accent); }

.card.wide h1 { font-size: 2rem; margin-bottom: 0.75rem; }
.card.wide h2 { font-size: 1.3rem; margin: 2.2rem 0 0.6rem; }
.card.wide h3 { font-size: 1.05rem; margin: 1.6rem 0 0.4rem; }
.card.wide p,
.card.wide li { font-size: 0.95rem; line-height: 1.7; }
.card.wide ul, .card.wide ol { color: var(--body); padding-left: 1.2rem; }
.card.wide li { margin: 0.3rem 0; }

.small { font-size: 0.78rem; }
.card.wide .small { font-size: 0.85rem; }
.muted { color: var(--muted); font-size: 0.78rem; }
.card.wide .muted { font-size: inherit; }
.lead { font-size: 1.1rem; color: var(--body); }
.card.wide .lead { font-size: 1.15rem; }

address { font-style: normal; color: var(--body); font-size: 0.95rem; line-height: 1.7; }
code { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 0.95em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
strong { color: var(--ink); }

/* ----- Card header: back link on the left, theme toggle on the right --- */

.cardtop {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cardtop .back { margin: 0; }
.cardtop .theme-toggle { margin-left: auto; }

.back a { color: var(--muted); text-decoration: none; font-size: 0.85rem; }
.back a:hover { color: var(--body); }

/* ----- Theme toggle --------------------------------------------------- */

.theme-toggle {
  display: inline-flex;
  border: 1px solid var(--field-line);
  border-radius: 999px;
  padding: 2px;
  background: var(--field-bg);
}
.theme-toggle button {
  width: auto;
  margin: 0;
  padding: 0.2rem 0.6rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.6;
  cursor: pointer;
}
.theme-toggle button:hover { color: var(--ink); }
.theme-toggle button[aria-pressed="true"] {
  /* The deeper accent, not the base one: the label is small, and white on
     the base blue lands just under the AA contrast floor. */
  background: var(--accent-hover);
  color: var(--accent-fg);
}
/* Without JS the toggle can't do anything, so it stays hidden; the OS
   preference still applies through the media query above. */
.theme-toggle[hidden] { display: none; }

/* ----- Forms ----------------------------------------------------------- */

label { display: block; font-size: 0.85rem; font-weight: 500; margin: 0.85rem 0 0.35rem; }
.card.wide label { font-size: 0.95rem; font-weight: 600; margin-top: 1rem; }

input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--field-line);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--field-bg);
  color: var(--ink);
}
textarea { font: inherit; padding: 0.5rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

input[type="radio"], input[type="checkbox"] { width: auto; }

fieldset { border: 0; padding: 0; margin: 1.2rem 0 0; }
legend { font-weight: 600; padding: 0; }

label.choice {
  font-weight: 400;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-top: 0.5rem;
}
label.choice input { margin-top: 0.45rem; }

/* ----- Buttons --------------------------------------------------------- */

button {
  width: 100%;
  padding: 0.6rem;
  border: 0;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.5rem;
}
button:disabled, button[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-primary:not(:disabled):hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--body); border: 1px solid var(--field-line); }
.btn-ghost:not(:disabled):hover { background: var(--subtle-bg); }
.btn-amber { background: transparent; color: var(--warn); border: 1px solid var(--warn-border); }
.btn-amber:not(:disabled):hover { background: var(--warn-soft-bg); }
.btn-red { background: transparent; color: var(--danger); border: 1px solid var(--danger-border); }
.btn-red:not(:disabled):hover { background: var(--danger-soft-bg); }
.btn-amber-solid { background: var(--warn-solid); color: #fff; }
.btn-amber-solid:not(:disabled):hover { background: var(--warn-solid-hover); }
.btn-red-solid { background: #dc2626; color: #fff; }
.btn-red-solid:not(:disabled):hover { background: #b91c1c; }

/* Inline (auto-width) button or link styled as a button. */
.btn {
  display: inline-block;
  width: auto;
  padding: 0.6rem 1.2rem;
  border: 0;
  border-radius: 8px;
  background: #dc2626;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
}
.btn[disabled] { opacity: 0.6; cursor: default; }

.cta {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.7rem 1.3rem;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.cta:hover { background: var(--accent-hover); }

.row { display: flex; gap: 0.5rem; }
.row > * { flex: 1; }
.actions { display: grid; gap: 0.6rem; margin-top: 1.25rem; }

/* ----- Status and blocks ----------------------------------------------- */

.err { color: var(--danger); font-size: 0.8rem; margin: 0.5rem 0; }
.card.wide .err { font-size: 0.95rem; font-weight: 600; }
.ok { color: var(--ok); font-size: 0.85rem; margin: 0.5rem 0; }

.danger-block { border: 1px solid var(--danger-block-border); border-radius: 8px; padding: 0.85rem; margin-top: 0.85rem; }
.danger-block.amber { border-color: var(--warn-block-border); }

.box, form.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.4rem;
  margin: 1.4rem 0;
  background: var(--panel-bg);
}
.done {
  border: 2px solid var(--ok-border);
  border-radius: 10px;
  padding: 1.4rem;
  margin-top: 1.4rem;
  background: var(--ok-bg);
}

.email-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: var(--subtle-bg);
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--body);
}

.receipt { border-collapse: collapse; margin: 1rem 0; width: 100%; font-size: 0.95rem; }
.receipt td { border-bottom: 1px solid var(--line); padding: 0.45rem 0.6rem 0.45rem 0; vertical-align: top; }

/* ----- Footer ---------------------------------------------------------- */

.footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.footer a { color: var(--body); }
.card.wide .footer {
  text-align: left;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

/* ----- Short confirmation pages (billing returns) ---------------------- */

.card.center { text-align: center; max-width: 560px; padding: 2.25rem; }
.card.center .cardtop { text-align: left; }
.card.center h1 { font-size: 1.6rem; margin-bottom: 0.75rem; }
.card.center h1.success { color: var(--ok-strong); }
.card.center p { font-size: 0.95rem; line-height: 1.6; }

/* The confirmation pages use a plain <footer> element. */
footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}
footer a { color: var(--body); }
.card.wide footer { margin-top: 2.5rem; font-size: 0.85rem; }

/* ----- Landing page ---------------------------------------------------- */

ul.stores { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
ul.stores li a {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--field-line);
  border-radius: 6px;
  text-decoration: none;
}
ul.stores li span.soon {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border: 1px dashed var(--field-line);
  border-radius: 6px;
  color: var(--muted);
  cursor: default;
}
ul.stores li span.soon small { opacity: 0.8; }

ul.features { padding-left: 1.2rem; margin: 1.25rem 0; }
ul.features li { padding: 0.35rem 0; }
ul.features li strong { font-weight: 600; color: var(--ink); }
.price { color: var(--muted); margin-top: 0.75rem; }

/* ----- Print (the cancellation receipt is meant to be printable) -------- */

@media print {
  /* Force the light palette: a dark card prints as an unreadable slab. */
  :root {
    color-scheme: light;
    --ink: #111;
    --body: #333;
    --muted: #555;
    --line: #ccc;
    --card-bg: #fff;
    --field-bg: #fff;
    --panel-bg: transparent;
    --ok-bg: transparent;
  }
  body { background: #fff; color: #111; padding: 0; display: block; }
  .card { box-shadow: none; background: #fff; border: 0; max-width: none; padding: 0; }
  .no-print, .theme-toggle { display: none; }
}

@media (max-width: 560px) {
  .card.wide { padding: 1.5rem; }
  .card.wide h1 { font-size: 1.6rem; }
}
