/* OpenSourdough app — the same flour, crust and ember palette as the site, tuned
 * for a phone on a floury counter: big targets, high contrast, nothing that
 * moves unless the dough did. */

@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../assets/fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --crust: #a8491f;
  --crust-hover: #8e3b16;
  --on-crust: #fff8ef;
  --ember: #e7a24a;
  --olive: #6f7d3c;
  --ember-soft: #f6e3c7;
  --rye-container: #efe2cb;
  --ember-red: #b3261e;

  --bg: #fbf6ee;
  --ink: #1f1611;
  --muted: #5f4f43;
  --surface: #fffdf9;
  --surface-high: #f3eadc;
  --outline: #e6d8c4;
  --shadow: 0 1px 2px rgb(31 22 17 / 0.05), 0 8px 24px -14px rgb(31 22 17 / 0.28);

  --char: #140e0a;
  --char-2: #231811;
  --on-char: #f6ecdf;
  --on-char-muted: #c9b79f;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --crust: #eb9a52;
    --crust-hover: #f2b070;
    --on-crust: #1f1611;
    --ember-soft: #3a2a1c;
    --rye-container: #33261b;
    --ember-red: #ffb4ab;
    --olive: #b7c486;

    --bg: #120d0a;
    --ink: #f3e9da;
    --muted: #c4b19c;
    --surface: #1d1510;
    --surface-high: #281d16;
    --outline: #3a2c22;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 26px -16px rgb(0 0 0 / 0.7);

    --char: #231811;
    --char-2: #2f2118;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px calc(104px + env(safe-area-inset-bottom));
}

/* ------------------------------------------------------------ header */

.app-top {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.app-brand svg { width: 26px; height: 26px; }
.app-brand b { font-weight: 500; opacity: 0.6; }
.app-top a.site-link { font-size: 0.8rem; color: var(--muted); text-decoration: none; }

/* -------------------------------------------------------------- type */

h1 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-size: 2.3rem;
  font-weight: 420;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 18px 0 8px;
}
h2 { font-size: 1.02rem; font-weight: 650; margin: 0 0 6px; letter-spacing: -0.005em; }
h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 460;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}
p { margin: 0 0 8px; }
.sub { color: var(--muted); font-size: 0.92rem; }
.accent { color: var(--crust); font-weight: 500; }
.error { color: var(--ember-red); font-size: 0.9rem; }

/* ------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 20px;
  padding: 18px;
  margin: 0 0 12px;
  box-shadow: var(--shadow);
}
.card.flat { background: transparent; border: 0; box-shadow: none; padding: 0; }
.card img.hero {
  width: calc(100% + 36px);
  margin: -18px -18px 14px;
  height: 168px;
  object-fit: cover;
  display: block;
  border-radius: 19px 19px 0 0;
}
.card.pick { cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.card.pick:active { transform: scale(0.99); }
.card.pick .accent { font-size: 0.9rem; }

/* The step you are on: the one card that should be readable from across the kitchen. */
.now {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 100% 0%, rgb(231 162 74 / 0.28), transparent 60%),
    var(--char);
  color: var(--on-char);
  border-color: transparent;
  box-shadow: 0 18px 40px -20px rgb(20 14 10 / 0.8);
}
.now .label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--ember);
  margin-bottom: 6px;
}
.now .label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0 4px rgb(231 162 74 / 0.22);
}
.now h3 { font-size: 1.7rem; color: #fff6ea; }
.now h2 { color: #fff6ea; }
.now .detail { white-space: pre-line; color: #eadccb; }
.now .sub { color: var(--on-char-muted) !important; opacity: 1 !important; }
.now hr { border-top-color: rgb(246 236 223 / 0.14); }
.now .value .k { color: var(--on-char-muted); }
.now .value.big .v,
.now .value .v { color: #fff6ea; }
.now button { background: var(--ember); color: #1a110b; }
.now button.ghost,
.now button.chip { background: transparent; color: var(--on-char); border-color: rgb(246 236 223 / 0.28); }
.now button.ghost { border-color: transparent; color: var(--ember); }

/* ------------------------------------------------------------ inputs */

label.field { display: block; margin: 0 0 12px; }
label.field > span { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input,
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--outline);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 48px;
  font-variant-numeric: tabular-nums;
}
select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%23846b58' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 38px;
}
input:focus,
select:focus,
textarea:focus { outline: 2px solid var(--crust); outline-offset: -1px; }
textarea { min-height: 88px; resize: vertical; }
.help { font-size: 0.8rem; color: var(--muted); margin: -4px 0 12px; line-height: 1.45; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

button {
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 12px 20px;
  min-height: 46px;
  cursor: pointer;
  background: var(--crust);
  color: var(--on-crust);
  transition: background 0.2s ease, transform 0.1s ease;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--crust); border-color: transparent; padding: 12px 12px; }
button.outline { background: transparent; color: var(--ink); border-color: var(--outline); }
button.chip {
  padding: 8px 15px;
  min-height: 38px;
  background: transparent;
  color: var(--ink);
  border-color: var(--outline);
  font-size: 0.88rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
button.chip[aria-pressed="true"] { background: var(--ember-soft); border-color: transparent; color: var(--ink); }
button.danger { background: transparent; color: var(--ember-red); }
button.wide { width: 100%; }
button.wide + button.wide { margin-top: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ------------------------------------------------------------- lists */

.values { margin-top: 8px; }
.value {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--outline) 60%, transparent);
}
.value:last-child { border-bottom: 0; }
.value .k { color: var(--muted); font-size: 0.92rem; }
.value .v { font-variant-numeric: tabular-nums; font-weight: 500; }
.value.big .v { color: var(--crust); font-weight: 700; font-size: 1.05rem; }
hr { border: 0; border-top: 1px solid var(--outline); margin: 12px 0; }

.step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 14px;
  cursor: pointer;
}
.step.current { background: var(--ember-soft); }
.step .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--outline);
  margin-top: 6px;
  flex: none;
}
.step.done .dot { background: var(--olive); border-color: var(--olive); }
.step.due .dot { background: var(--crust); border-color: var(--crust); box-shadow: 0 0 0 4px color-mix(in srgb, var(--crust) 20%, transparent); }
.step .body { flex: 1; min-width: 0; }
.step .title { font-weight: 600; }
.step.done .title { color: var(--muted); }
.step.skipped .title { text-decoration: line-through; }
.step .when { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.step .detail { margin-top: 8px; white-space: pre-line; font-size: 0.95rem; }
.step button.ghost { min-height: 38px; padding: 6px 10px; }

.bar { height: 6px; background: var(--surface-high); border-radius: 3px; overflow: hidden; margin: 4px 0 14px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--crust), var(--ember)); border-radius: 3px; }

.stars { font-size: 1.4rem; letter-spacing: 2px; color: var(--ember); }
.stars button { background: none; border: 0; padding: 0 3px; min-height: 0; font-size: 1.8rem; color: var(--ember); cursor: pointer; }

/* ----------------------------------------------------------- tab bar */

nav#tabs {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: 536px;
  margin: 0 auto;
  display: flex;
  padding: 6px;
  gap: 2px;
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  backdrop-filter: saturate(1.5) blur(18px);
  border: 1px solid var(--outline);
  box-shadow: 0 12px 30px -14px rgb(31 22 17 / 0.45);
  z-index: 10;
}
nav#tabs button {
  flex: 1;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 7px 0 6px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-radius: 16px;
  letter-spacing: 0.01em;
}
nav#tabs button[aria-current="page"] { color: var(--crust); background: var(--ember-soft); }
nav#tabs svg { width: 22px; height: 22px; }

/* ------------------------------------------------------------ dialog */

dialog {
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  padding: 22px;
  width: min(420px, calc(100vw - 32px));
  box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.45);
}
dialog::backdrop { background: rgb(20 14 10 / 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

details.entry {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 8px;
}
details.entry summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.entry summary::after { content: "+"; color: var(--crust); font-weight: 400; font-size: 1.3rem; line-height: 1; }
details.entry[open] summary::after { content: "–"; }
details.entry summary::-webkit-details-marker { display: none; }
details.entry p { margin: 10px 0 0; }
details.entry p.fix { color: var(--ink); padding-left: 12px; border-left: 2px solid var(--crust); }
.glossary dt { font-family: var(--font-display); font-size: 1.1rem; margin-top: 14px; }
.glossary dd { margin: 2px 0 0; color: var(--muted); }

.note {
  background: var(--rye-container);
  color: var(--ink);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

/* An offer to install, shown in the browser only. */
.install-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--char);
  color: var(--on-char);
  border-radius: 20px;
  padding: 14px 14px 14px 16px;
  margin: 14px 0 6px;
}
.install-card img { width: 44px; height: 44px; border-radius: 12px; flex: none; }
.install-card div { flex: 1; min-width: 0; }
.install-card strong { display: block; font-size: 0.95rem; }
.install-card span { display: block; font-size: 0.8rem; color: var(--on-char-muted); line-height: 1.35; }
.install-card button { background: var(--ember); color: #1a110b; min-height: 40px; padding: 8px 16px; }
.install-card button.x { background: transparent; color: var(--on-char-muted); padding: 8px; min-height: 36px; font-size: 1.1rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* A text button right under a heading lines up with the heading, not its own padding. */
h1 + button.ghost { margin: -4px 0 6px -12px; }

/* A long recipe name wraps inside its own space; the bake menu stays top right. */
.actions > h1 { flex: 1 1 0; min-width: 0; }
