/* Sjekk butikk — styles.

   Built for older eyes and thumbs: large type, strong contrast, one column, buttons
   at least 64 px tall. The look borrows from road signs: each answer has its own
   sign shape (round bar, triangle, round tick, square), so colour is never the only cue.

   Themes: light by default, dark when the phone is in dark mode, and either can be
   forced with <html data-theme="light|dark"> (set by theme.js from the saved choice).
   All colours are variables; the dark values appear twice (media query + forced)
   because plain CSS cannot share one block between the two. Keep them in step. */

:root {
  --page: #eef2f4;
  --surface: #ffffff;
  --ink: #12222d;
  --muted: #4a5b67;
  --line: #cdd6dc;
  --brand: #0b5394;        /* the blue of Norwegian information signs */
  --on-brand: #ffffff;
  --focus: #d9480f;

  --red: #b3121d;    --red-bg: #fce9ea;    --red-ink: #7d0c14;
  --yellow: #f5b700; --yellow-bg: #fff4cc; --yellow-ink: #5c4300;
  --green: #1b7a45;  --green-bg: #e1f4e8;  --green-ink: #0f5130;
  --grey: #55636e;   --grey-bg: #e3e9ed;   --grey-ink: #33414b;
  --sign-ink: #1c1c1c;     /* the "!" on the yellow triangle */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0e1920;
    --surface: #172630;
    --ink: #eef3f6;
    --muted: #a9b8c2;
    --line: #2f424f;
    --brand: #7cc0f5;
    --on-brand: #06202f;
    --focus: #ffb347;

    --red: #e5484d;    --red-bg: #3b1519;    --red-ink: #ffc9cc;
    --yellow: #f5b700; --yellow-bg: #3a2e0a; --yellow-ink: #ffe08a;
    --green: #3fb97a;  --green-bg: #11301f;  --green-ink: #a9e8c2;
    --grey: #8496a3;   --grey-bg: #202e38;   --grey-ink: #d5dee4;
  }
}

:root[data-theme="dark"] {
  --page: #0e1920;
  --surface: #172630;
  --ink: #eef3f6;
  --muted: #a9b8c2;
  --line: #2f424f;
  --brand: #7cc0f5;
  --on-brand: #06202f;
  --focus: #ffb347;

  --red: #e5484d;    --red-bg: #3b1519;    --red-ink: #ffc9cc;
  --yellow: #f5b700; --yellow-bg: #3a2e0a; --yellow-ink: #ffe08a;
  --green: #3fb97a;  --green-bg: #11301f;  --green-ink: #a9e8c2;
  --grey: #8496a3;   --grey-bg: #202e38;   --grey-ink: #d5dee4;
}

* { box-sizing: border-box; }

/* `hidden` must win over classes that set display (.button, .quiet, .sheet). */
[hidden] { display: none !important; }

html { font-size: 20px; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 32rem;
  margin: 0 auto;
  padding: 1.6rem 1.15rem 3rem;
}

h1 {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
  text-wrap: balance;
}

.lead { font-size: 1.1rem; margin: 0 0 1.2rem; color: var(--muted); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* --- Sign shapes (the <symbol>s in index.html) --- */
.s-red { fill: var(--red); }
.s-yellow { fill: var(--yellow); }
.s-green { fill: var(--green); }
.s-grey { fill: var(--grey); }
.s-mark { fill: #fff; }
.s-stroke { stroke: #fff; }
.s-ink { fill: var(--sign-ink); }

/* --- Start --- */
.signs { display: flex; gap: 0.5rem; margin: 0.4rem 0 1.4rem; }
.signs svg { width: 2.6rem; height: 2.6rem; }

textarea {
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  padding: 0.95rem;
  border: 2px solid var(--muted);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  resize: vertical;
  word-break: break-all;
}
textarea::placeholder { color: var(--muted); opacity: 1; }

.button {
  display: block;
  width: 100%;
  min-height: 64px;
  margin-top: 0.8rem;
  padding: 0.8rem 1rem;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: 14px;
  border: 2px solid var(--brand);
  cursor: pointer;
}
.button.primary { background: var(--brand); color: var(--on-brand); }
.button.secondary { background: var(--surface); color: var(--brand); }
.button:active { transform: translateY(2px); }

.quiet {
  display: block;
  margin: 2.2rem auto 0;
  min-height: 48px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.button:focus-visible, .quiet:focus-visible, textarea:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.error {
  margin: 1rem 0 0;
  padding: 0.9rem 1rem;
  background: var(--red-bg);
  color: var(--red-ink);
  border-left: 6px solid var(--red);
  border-radius: 6px;
  font-weight: 600;
}

/* --- Install pop-up: a sheet that slides up from the bottom --- */
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 10;
  max-width: 32rem;
  margin: 0 auto;
  padding: 1.3rem 1.15rem calc(1rem + env(safe-area-inset-bottom));
  background: var(--surface);
  color: var(--ink);
  border-radius: 22px 22px 0 0;
  border-top: 4px solid var(--brand);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
  animation: rise 0.35s ease-out both;
}
@keyframes rise { from { transform: translateY(100%); } }
.sheet img { display: block; border-radius: 14px; margin-bottom: 0.8rem; }
.sheet h2 { font-size: 1.35rem; font-weight: 800; line-height: 1.2; margin: 0 0 0.4rem; text-wrap: balance; }
.sheet p { margin: 0; color: var(--muted); }
.sheet ol { margin: 0.8rem 0 0; padding-left: 1.4rem; font-size: 1.05rem; }
.sheet li { padding: 0.25rem 0; }
.sheet .quiet { margin-top: 0.4rem; }
.inline-icon { width: 1.3em; height: 1.3em; vertical-align: -0.3em; color: var(--brand); }

/* --- Waiting --- */
#view-wait { padding-top: 3rem; }
.spinner {
  width: 4.5rem; height: 4.5rem; margin: 0 0 1.5rem;
  border: 0.55rem solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Result ---
   app.js sets data-level on the section; --tone* then colours everything below. */
#view-result { --tone: var(--grey); --tone-bg: var(--grey-bg); --tone-ink: var(--grey-ink); }
#view-result[data-level="red"] { --tone: var(--red); --tone-bg: var(--red-bg); --tone-ink: var(--red-ink); }
#view-result[data-level="yellow"] { --tone: var(--yellow); --tone-bg: var(--yellow-bg); --tone-ink: var(--yellow-ink); }
#view-result[data-level="green"] { --tone: var(--green); --tone-bg: var(--green-bg); --tone-ink: var(--green-ink); }

.verdict {
  padding: 1.3rem 1.2rem 1.4rem;
  border-radius: 22px;
  background: var(--tone-bg);
  color: var(--tone-ink);
}
.verdict .sign {
  display: block;
  width: 5.6rem; height: 5.6rem;
  margin-bottom: 0.9rem;
  /* The one animated moment: the sign lands when the answer arrives. */
  animation: land 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes land { from { transform: scale(0.4); opacity: 0; } }
.verdict h1 { font-size: 2.3rem; margin-bottom: 0.35rem; }
.domain { margin: 0; font-size: 1.05rem; font-weight: 600; word-break: break-all; }
#view-wait .domain { color: var(--ink); }

.reasons { list-style: none; margin: 0.9rem 0 0; padding: 0; }
.reasons li {
  position: relative;
  padding: 0.9rem 0 0.9rem 1.5rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.1rem;
}
.reasons li::before {
  content: "";
  position: absolute;
  left: 0.1rem; top: 1.38rem;
  width: 0.65rem; height: 0.65rem;
  border-radius: 2px;
  background: var(--tone);
}

.advice { margin: 1.1rem 0 0; font-size: 1.1rem; font-weight: 700; }
.extra { margin: 1rem 0 0; color: var(--muted); font-size: 0.95rem; }
.facts { margin: 0.8rem 0 0.8rem; padding-left: 1.1rem; color: var(--muted); font-size: 0.95rem; }
.facts:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 4s; }
  .verdict .sign { animation: none; }
  .sheet { animation: none; }
}
