/* styles.css: the overview page in the storefront's design language.
   Tokens copied from ecommerce/src/app/globals.css and the quiz's
   editorial.css so the page reads as a page of the same magazine. */

:root {
  --bg: #f5f2ec;
  --card: #fbfaf6;
  --ink: #141414;
  --muted: #6f685c;        /* the storefront's #8a8478, darkened for small text on cream */
  --accent: #7a6e5a;
  --accent-text: #6e6350;  /* accent as text: the storefront's shade just misses AA on cream */
  --accent-hover: #645a48;
  --blush: #c89e8c;
  --navy: #232b3e;
  --cream: #fbf6ec;
  --line: rgba(61, 58, 46, 0.12);
  --line-soft: rgba(61, 58, 46, 0.06);
  --line-strong: rgba(61, 58, 46, 0.24);
  --green: #4f7a5a;
  --green-text: #476e52;
  --green-soft: #bfd8c2;
  --terracotta: #9a6a5f;
  --terracotta-text: #7d5448;
  --terracotta-soft: #f4ddde;
  --gold: #c9a12e;
  --gold-soft: rgba(201, 161, 46, 0.14);
  --display: "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --body: "Lora", Georgia, serif;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 12px;
  --ease: 0.25s ease;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { margin: 0; font-family: var(--body); font-size: 15px; line-height: 1.5; background: var(--bg); color: var(--ink); min-height: 100vh; }
a { color: var(--accent-text); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* Shared type styles: the eyebrow and the pill are the storefront's own. */
.eyebrow { font-family: var(--ui); font-size: 10.5px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-text); }
.wordmark { font-family: var(--display); font-weight: 500; letter-spacing: 0.01em; line-height: 1; color: var(--ink); margin: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; font-family: var(--ui); font-size: 9.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; line-height: 1.2; }
.pill.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pill.tag { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-text); font-weight: 500; }
.pill.bad { background: var(--terracotta-soft); border-color: color-mix(in srgb, var(--terracotta) 45%, transparent); color: var(--terracotta-text); }
.btn-text { font-family: var(--ui); font-size: 11px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-text); transition: color var(--ease); }
.btn-text:hover { color: var(--accent-hover); }
.btn-primary { display: block; width: 100%; padding: 14px 28px; border-radius: 999px; background: var(--navy); color: var(--cream); font-family: var(--ui); font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; transition: background var(--ease), opacity var(--ease); }
.btn-primary:hover { background: #1a2131; }
.btn-primary:disabled { opacity: 0.55; cursor: default; }

/* Page frame */
.page { max-width: 1240px; margin: 0 auto; padding: 36px clamp(16px, 4vw, 48px) 64px; }
body.auth-needed .page { visibility: hidden; }

/* Header: wordmark left, who and when on the right */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.brand { display: flex; flex-direction: column; gap: 8px; }
.top .wordmark { font-size: 44px; }
.top-right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px; font-family: var(--ui); font-size: 12px; color: var(--muted); padding-bottom: 6px; }
.top-right .who { color: var(--ink); }
.top-right .checked { font-variant-numeric: tabular-nums; }

/* Summary strip */
.summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; margin: 18px 0 0; font-family: var(--body); font-size: 15px; font-style: italic; color: var(--muted); }
.summary b { font-style: normal; font-weight: 500; color: var(--ink); }
.summary .sep { margin: 0 8px; }
.summary .bad { color: var(--terracotta-text); font-weight: 500; font-style: normal; }
.summary .good { color: var(--green-text); font-style: normal; }

/* Notices: the stale warning (gold) and a load failure (terracotta) */
.notice { margin-top: 20px; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); border-radius: 10px; background: var(--gold-soft); font-family: var(--ui); font-size: 13px; color: var(--ink); }
.notice.error { border-color: color-mix(in srgb, var(--terracotta) 45%, transparent); background: var(--terracotta-soft); }
.notice .btn-text { margin-left: 12px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* Card grid: 3 from 1100px, 2 from 720px, 1 below */
.grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 28px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; } }

.card { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 26px 26px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease); }
.card:hover { border-color: var(--line-strong); box-shadow: 0 8px 28px rgba(61, 58, 46, 0.06); transform: translateY(-1px); }
.card-index { position: absolute; top: 22px; right: 24px; font-family: var(--display); font-size: 14px; font-style: italic; color: var(--muted); opacity: 0.6; }
.card-name { margin: 0; font-family: var(--display); font-size: 27px; font-weight: 500; line-height: 1.1; letter-spacing: -0.005em; color: var(--ink); padding-right: 32px; overflow-wrap: anywhere; }
.card-blurb { margin: 8px 0 0; font-family: var(--body); font-size: 14px; line-height: 1.6; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }

/* Environments: one row each under a hairline */
.envs { margin-top: 20px; border-top: 1px solid var(--line); }
.env { padding: 14px 0 12px; border-bottom: 1px solid var(--line-soft); }
.env:last-child { border-bottom: 0; }
.env-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.env-label { min-width: 42px; color: var(--muted); font-size: 10px; }
.state { display: inline-flex; align-items: center; gap: 7px; font-family: var(--ui); font-size: 12.5px; font-weight: 500; color: var(--ink); }
.state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px var(--line-soft); }
.state.online .dot { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green-soft) 70%, transparent); }
.state.offline { color: var(--terracotta-text); }
.state.offline .dot { background: var(--terracotta); box-shadow: 0 0 0 3px var(--terracotta-soft); }
.state.unknown { color: var(--muted); }
.host { margin-left: auto; font-family: var(--ui); font-size: 12px; color: var(--accent-text); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; overflow-wrap: anywhere; transition: color var(--ease), text-decoration-color var(--ease); }
.host:hover { color: var(--accent-hover); text-decoration-color: var(--accent-hover); }
.host-arrow { margin-left: 3px; font-size: 10px; }
.env-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 8px; padding-left: 54px; font-family: var(--ui); font-size: 11.5px; color: var(--muted); }
.env-meta b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.env-meta .sep { color: var(--line-strong); }
.checks { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-family: var(--ui); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.chk::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.chk.ok::before { background: var(--green); }
.chk.bad { color: var(--terracotta-text); }
.chk.bad::before { background: var(--terracotta); }
.env-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; padding-left: 54px; }
.env-note { margin: 0; font-family: var(--body); font-size: 12.5px; font-style: italic; color: var(--muted); }
.env-none { padding: 14px 0 12px; font-family: var(--body); font-size: 13px; font-style: italic; color: var(--muted); }

/* Loading skeleton: quiet blocks in the card's shape, no flash of empty grid */
.skeleton .sk { height: 12px; border-radius: 6px; background: var(--line); }
.skeleton .sk-title { height: 24px; width: 45%; }
.skeleton .sk-line { width: 85%; margin-top: 12px; }
.skeleton .sk-pills { width: 40%; margin-top: 18px; height: 20px; border-radius: 999px; }
.skeleton .sk-row { width: 100%; margin-top: 22px; height: 34px; }
.skeleton .sk { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.foot { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); font-family: var(--ui); font-size: 11.5px; color: var(--muted); }

/* Sign-in overlay: full cream backdrop, one centred card */
.auth-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); overflow: auto; }
.auth-card { width: 100%; max-width: 420px; padding: 44px 36px 36px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.auth-brand .wordmark { font-size: 40px; }
.auth-sub { margin: 14px 0 0; text-align: center; font-family: var(--body); font-size: 14px; font-style: italic; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 7px; margin-top: 22px; }
.field .eyebrow { font-size: 10px; letter-spacing: 0.16em; color: var(--muted); }
.field input { width: 100%; padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-family: var(--body); font-size: 15px; color: var(--ink); transition: border-color var(--ease); }
.field input::placeholder { color: rgba(61, 58, 46, 0.4); font-style: italic; }
.field input:focus { border-color: var(--accent); }
.auth-card .btn-primary { margin-top: 26px; }
.auth-msg { min-height: 1.2em; margin: 14px 0 0; text-align: center; font-family: var(--ui); font-size: 12.5px; color: var(--terracotta-text); }

/* Phone: the header stacks, the host link takes its own line */
@media (max-width: 600px) {
  .page { padding-top: 26px; }
  .top { flex-direction: column; align-items: flex-start; gap: 14px; padding-bottom: 18px; }
  .top .wordmark { font-size: 38px; }
  .top-right { padding-bottom: 0; gap: 6px 18px; }
  .card { padding: 22px 18px 16px; }
  .card-index { top: 18px; right: 18px; }
  .host { margin-left: 0; flex-basis: 100%; }
  .env-meta, .env-extra { padding-left: 0; }
  .checks { margin-left: 0; flex-basis: 100%; }
  .auth-card { padding: 34px 22px 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .card:hover { transform: none; }
}
