/*
 * The tutorials (F26): plain pages next to the app like the imprint, one style for KellerLog and
 * Vorratsbuch in the colours of the app (styles.css, APPS in packages/core/src/apps.ts), light and dark.
 * KellerLog wine red by default; a page of Vorratsbuch says <html data-app="vorratsbuch">.
 * Taken over from SpeiseKarte (packages/web/public/tutorials/tutorials.css there).
 */
:root {
  --bg: #f6f0e4;
  --surface: #fffdf8;
  --text: #2b2222;
  --muted: #7a6e68;
  --line: #e4dccd;
  --accent: #6b1f2a;
  --accent-soft: #f1e0e0;
  --pic: #ece4d6;
  --mark: #2563eb;
  --mark-soft: #e6eefc;
  --shadow: 0 1px 2px rgb(60 40 20 / 0.06), 0 6px 20px rgb(60 40 20 / 0.08);
  color-scheme: light dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}
:root[data-app="vorratsbuch"] {
  --accent: #2d5236;
  --accent-soft: #dfeadf;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1a18;
    --surface: #2a2522;
    --text: #f1ebe4;
    --muted: #b3a79e;
    --line: #3d3631;
    --accent: #e39aa4;
    --accent-soft: #3d2328;
    --pic: #342e2a;
    --mark: #7aa5ff;
    --mark-soft: #1f2a40;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px rgb(0 0 0 / 0.3);
  }
  :root[data-app="vorratsbuch"] {
    --accent: #8cc79a;
    --accent-soft: #233528;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  max-width: 980px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 1rem) max(1rem, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 3rem) max(1rem, env(safe-area-inset-left));
}
a { color: var(--accent); }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
p { margin: 0.6rem 0; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

/* Top: the app, the way back to all tutorials. */
.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.4rem; }
.top .app { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; color: var(--text); text-decoration: none; }
.top img { width: 32px; height: 32px; border-radius: 8px; }
.top .back { font-size: 0.95rem; text-decoration: none; }

/* The overview. */
.hero { margin: 0.5rem 0 2rem; }
.hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); margin: 0 0 0.6rem; }
.hero p { font-size: 1.1rem; color: var(--muted); max-width: 44rem; }
.group-title { font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 2.2rem 0 0.8rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 1rem; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgb(60 40 20 / 0.08), 0 12px 28px rgb(60 40 20 / 0.12); }
.card .pic { background: var(--pic); aspect-ratio: 4 / 3; overflow: hidden; display: flex; justify-content: center; align-items: flex-start; padding: 1rem 1rem 0; }
.card .pic img { width: 82%; box-shadow: 0 2px 12px rgb(0 0 0 / 0.18); }
.card .pic.wide img { width: 100%; border-radius: 6px 6px 0 0; }
.card .body { padding: 0.9rem 1rem 1.1rem; }
.card h3 { margin: 0 0 0.3rem; font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.card .meta { margin-top: 0.6rem; font-size: 0.82rem; color: var(--accent); font-weight: 600; }

/* A tutorial: the story and the result beside it. */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 1.6rem; align-items: start; margin-bottom: 1.8rem; }
.intro h1 { font-size: clamp(1.6rem, 4.2vw, 2.3rem); margin: 0 0 0.6rem; }
.intro .lead { font-size: 1.08rem; }
.facts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.facts li { background: var(--accent-soft); border-radius: 999px; padding: 0.2rem 0.75rem; font-size: 0.86rem; }
.result { margin: 0; }
.result img { box-shadow: var(--shadow); border-radius: 3px; }
.result figcaption { text-align: center; }
@media (max-width: 720px) {
  .intro { grid-template-columns: 1fr; }
  .result { max-width: 320px; margin: 0 auto; }
}

/* The steps. */
.step { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.2rem 1.3rem 1.3rem; margin: 1.2rem 0; box-shadow: var(--shadow); }
.step h2 { display: flex; align-items: center; gap: 0.7rem; font-size: 1.3rem; margin: 0 0 0.4rem; }
.step h2 .n { flex: none; display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent); color: var(--surface); font-size: 1.05rem; }
.step figure { margin: 1rem 0 0.2rem; }
.step figure img { border-radius: 10px; border: 1px solid var(--line); }
figcaption { font-size: 0.86rem; color: var(--muted); margin-top: 0.4rem; }
/* The blue numbers of the pictures, in the text. */
.m { display: inline-grid; place-items: center; width: 1.35em; height: 1.35em; border-radius: 50%; background: var(--mark); color: #fff; font-size: 0.78em; font-weight: 700; vertical-align: 0.08em; }
kbd { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9em; background: var(--bg); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0.05rem 0.35rem; }
.ui { font-weight: 600; }
.tip { margin: 1rem 0 0; padding: 0.75rem 1rem; border-radius: 10px; background: var(--mark-soft); border-left: 4px solid var(--mark); font-size: 0.95rem; }
.tip b:first-child { color: var(--mark); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 0.8rem; margin-top: 1rem; }
.row figure { margin: 0; }
.row img { box-shadow: 0 1px 8px rgb(0 0 0 / 0.14); border-radius: 3px; border: none; }
.row.phones img { box-shadow: none; }
/* A picture of the app on the drawn iPhone: not wider than a phone, no frame around the frame. */
.step figure.phone { max-width: 300px; margin-inline: auto; }
.step figure.phone img, .result.phone img { width: 300px; max-width: 100%; margin: 0 auto; border: none; box-shadow: none; border-radius: 0; }
.row.phones { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 240px)); justify-content: center; }
.row.phones figure img { width: 100%; border: none; border-radius: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.pair figure { margin: 0; }
.pair img { box-shadow: 0 1px 8px rgb(0 0 0 / 0.14); border-radius: 3px; border: none !important; }
table.sizes { width: 100%; border-collapse: collapse; margin: 0.8rem 0 0; font-size: 0.93rem; }
table.sizes th, table.sizes td { text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); }
table.sizes th { color: var(--muted); font-weight: 600; }
table.sizes td.v { font-variant-numeric: tabular-nums; white-space: nowrap; }
.styles-list { columns: 2 14rem; margin: 0.6rem 0 0; padding-left: 1.2rem; font-size: 0.93rem; }

/* The end: done, and where to go on. */
.done { text-align: center; margin: 2.4rem 0 0; }
.done h2 { font-size: 1.5rem; margin: 0 0 0.4rem; }
.next { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 0.8rem; margin-top: 1.2rem; text-align: left; }
.next a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.next a b { display: block; color: var(--accent); }
.next a span { font-size: 0.9rem; color: var(--muted); }
footer { margin-top: 2.5rem; text-align: center; font-size: 0.88rem; color: var(--muted); }

/* Häufige Fragen: each a question to open. */
.faq { display: grid; gap: 0.5rem; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 1rem; box-shadow: var(--shadow); }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details[open] summary { color: var(--accent); }
.faq details p { margin: 0.6rem 0 0.2rem; }
.card .pic.phone { padding: 0.8rem 0 0; }
.card .pic.phone img { width: 52%; box-shadow: none; }

/* A table of the app in the text (a stock list, a count). */
table.grid { width: 100%; border-collapse: collapse; margin: 0.8rem 0 0; font-size: 0.93rem; }
table.grid th, table.grid td { text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid th { color: var(--muted); font-weight: 600; }
table.grid td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* A picture over the page (tutorials.js): fitted, a tap shows it at full size. */
.zoom-open, .zoom-open body { overflow: hidden; }
.zoom { position: fixed; inset: 0; z-index: 10; display: flex; overflow: auto; background: rgb(20 16 14 / 0.92); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.zoom img { margin: auto; max-width: calc(100% - 2rem); max-height: calc(100% - 5rem); width: auto; height: auto; border-radius: 8px; background: #fff; cursor: zoom-in; }
.zoom.full img { max-width: none; max-height: none; margin: 1rem; border-radius: 0; cursor: zoom-out; }
.zoom-close { position: fixed; top: calc(env(safe-area-inset-top) + 0.8rem); right: max(0.8rem, env(safe-area-inset-right)); width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: rgb(255 255 255 / 0.92); color: #2b2222; font-size: 1.2rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgb(0 0 0 / 0.3); }
.zoom-hint { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 0.8rem); transform: translateX(-50%); margin: 0; padding: 0.3rem 0.8rem; border-radius: 999px; background: rgb(0 0 0 / 0.55); color: #fff; font-size: 0.85rem; pointer-events: none; white-space: nowrap; }
