/* =====================================================================
   filipcooks.com
   ===================================================================== */

/* --- tokens ---------------------------------------------------------- */

:root {
  --paper:        #fdfaf5;
  --surface:      #ffffff;
  --surface-alt:  #f6efe4;
  --border:       #e6dccb;
  --border-strong:#d5c7ae;

  --ink:          #2c2419;
  --ink-soft:     #6b5f4d;
  --ink-faint:    #9a8d78;

  --ember:        #c2410c;
  --ember-dark:   #9a3412;
  --ember-wash:   #fdf0e7;
  --herb:         #4d7c46;
  --star:         #e8a33d;

  --radius:       14px;
  --radius-sm:    9px;
  --shadow:       0 1px 2px rgba(44, 36, 25, .06), 0 8px 24px -12px rgba(44, 36, 25, .18);
  --shadow-lift:  0 2px 4px rgba(44, 36, 25, .07), 0 18px 40px -16px rgba(44, 36, 25, .28);

  --btn-solid-fg: #fff;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:        #1a1713;
    --surface:      #232019;
    --surface-alt:  #2b271f;
    --border:       #3a352b;
    --border-strong:#4b4538;

    --ink:          #f2ece1;
    --ink-soft:     #b8ae9c;
    --ink-faint:    #8a8071;

    --ember:        #fb923c;
    --ember-dark:   #fdba74;
    --ember-wash:   #33251a;
    --herb:         #86bd7c;
    --star:         #f0b458;

    --btn-solid-fg: #241a12;

    --shadow:       0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --shadow-lift:  0 2px 4px rgba(0, 0, 0, .45), 0 18px 40px -16px rgba(0, 0, 0, .7);

    color-scheme: dark;
  }
}

/* --- reset ----------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

/* A class like `.toolbar { display: flex }` outranks the UA rule for
   [hidden], so make the attribute win everywhere. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--ember); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -.015em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }

:focus-visible {
  outline: 2.5px solid var(--ember);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- layout ---------------------------------------------------------- */

.wrap { width: min(100% - 2.5rem, 1080px); margin-inline: auto; }
.wrap-narrow { width: min(100% - 2.5rem, 760px); margin-inline: auto; }

.site-header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.site-header > .wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 68px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.brand:hover { text-decoration: none; color: var(--ember); }
.brand-mark { font-size: 1.25rem; }

.site-nav { display: flex; gap: 1.25rem; margin-left: auto; align-items: center; }
.site-nav a { color: var(--ink-soft); font-size: .93rem; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ember); text-decoration: none; }

.site-footer {
  margin-top: 5rem;
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  color: var(--ink-faint);
  font-size: .88rem;
}
.site-footer > .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* --- buttons --------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem 1.05rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--ember);
  color: var(--btn-solid-fg);
  font: inherit;
  font-size: .92rem;
  font-weight: 550;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s, color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--ember-dark); text-decoration: none; color: var(--btn-solid-fg); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--ink); border-color: var(--border-strong); }

.btn-danger { background: transparent; color: #b91c1c; border-color: #e7b4b4; }
.btn-danger:hover { background: #fee2e2; color: #991b1b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-danger { color: #fca5a5; border-color: #6b2d2d; }
  :root:not([data-theme="light"]) .btn-danger:hover { background: #3b1a1a; color: #fecaca; }
}

.btn-sm { padding: .38rem .78rem; font-size: .84rem; }

.btn-google { background: var(--surface); color: var(--ink); border-color: var(--border-strong); box-shadow: var(--shadow); }
.btn-google:hover { background: var(--surface-alt); color: var(--ink); }

/* Google renders its sign-in button inside an iframe in this holder.
   Reserve its height so the layout doesn't jump while the script loads. */
.gsi-slot { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; }
.site-nav .gsi-slot { min-height: 32px; }

/* --- user chip ------------------------------------------------------- */

.user-chip { display: flex; align-items: center; gap: .6rem; }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  object-fit: cover;
  flex: none;
}
.avatar-lg { width: 42px; height: 42px; }
.user-name { font-size: .9rem; font-weight: 550; color: var(--ink); }

/* --- hero ------------------------------------------------------------ */

.hero { padding: 4rem 0 2.75rem; text-align: center; }
.hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .72rem;
  font-weight: 650;
  color: var(--ember);
  margin-bottom: 1rem;
}
.hero p.lede {
  max-width: 44ch;
  margin: 1.1rem auto 0;
  color: var(--ink-soft);
  font-size: 1.1rem;
}

/* --- toolbar --------------------------------------------------------- */

.toolbar {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
  padding-bottom: 1.75rem;
}
.search-field { position: relative; flex: 1 1 240px; }
.search-field input[type="search"] { padding-left: 2.4rem; }
.search-field::before {
  content: "⌕";
  position: absolute;
  left: .9rem; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 1.2rem;
  pointer-events: none;
}

.chips { display: flex; gap: .45rem; flex-wrap: wrap; }
.chip {
  padding: .38rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { background: var(--surface-alt); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ember-wash);
  border-color: var(--ember);
  color: var(--ember-dark);
  font-weight: 550;
}

/* --- forms ----------------------------------------------------------- */

input[type="text"], input[type="number"], input[type="search"], textarea, select {
  width: 100%;
  padding: .62rem .8rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ember);
  box-shadow: 0 0 0 3px var(--ember-wash);
}
textarea { resize: vertical; min-height: 6.5rem; line-height: 1.55; }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink-soft); margin-bottom: .35rem; }
.field { margin-bottom: 1.15rem; }
.field-hint { font-size: .8rem; color: var(--ink-faint); margin-top: .35rem; font-weight: 400; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; }

.checkbox-row { display: flex; align-items: center; gap: .55rem; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; font-size: .92rem; color: var(--ink); }

/* --- recipe grid ----------------------------------------------------- */

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card a.card-link { color: inherit; display: flex; flex-direction: column; height: 100%; }
.card a.card-link:hover { text-decoration: none; }

.card-photo {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
.card-photo-empty {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--surface-alt), var(--ember-wash));
  border-bottom: 1px solid var(--border);
  font-size: 2.5rem;
  opacity: .55;
}
.card-body { padding: 1.05rem 1.15rem 1.2rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
/* Flex children stretch by default, which would turn the pills into bars. */
.card-badges { display: flex; gap: .35rem; flex-wrap: wrap; align-self: flex-start; }
.card-title { font-family: var(--serif); font-size: 1.22rem; font-weight: 600; line-height: 1.25; }
.card-blurb {
  color: var(--ink-soft);
  font-size: .91rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  margin-top: auto;
  padding-top: .45rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: .82rem;
  color: var(--ink-faint);
  flex-wrap: wrap;
}
.dot::before { content: "·"; margin-right: .65rem; }

.badge {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.badge-draft { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge-draft { background: #3d2f12; border-color: #6b5220; color: #fcd34d; }
}

/* --- stars ----------------------------------------------------------- */

.stars { position: relative; display: inline-block; white-space: nowrap; line-height: 1; }
.stars-empty { color: var(--border-strong); letter-spacing: .08em; }
.stars-full {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  color: var(--star);
  letter-spacing: .08em;
}
.stars-lg { font-size: 1.3rem; }

/* Interactive rating input */
.rating-input { display: flex; gap: .15rem; align-items: center; }
.rating-input button {
  background: none;
  border: none;
  padding: .1rem .12rem;
  font-size: 1.85rem;
  line-height: 1;
  cursor: pointer;
  color: var(--border-strong);
  transition: color .12s, transform .12s;
}
.rating-input button:hover { transform: scale(1.14); }
.rating-input button.on { color: var(--star); }
.rating-label { margin-left: .6rem; font-size: .88rem; color: var(--ink-soft); font-weight: 550; }

/* --- recipe detail --------------------------------------------------- */

.recipe-head { padding: 2.75rem 0 1.75rem; }
.recipe-head .badge { margin-bottom: 1rem; }
.recipe-head .lede { color: var(--ink-soft); font-size: 1.1rem; margin-top: .9rem; max-width: 58ch; }

.rating-summary { display: flex; align-items: center; gap: .7rem; margin-top: 1.1rem; flex-wrap: wrap; }
.rating-value { font-weight: 650; font-size: 1.05rem; }
.rating-count { color: var(--ink-faint); font-size: .9rem; }

.hero-photo {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
}

.facts {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 2.5rem;
}
.fact { flex: 1 1 120px; padding: 1rem 1.15rem; border-right: 1px solid var(--border); }
.fact:last-child { border-right: none; }
.fact-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-faint);
  font-weight: 650;
}
.fact-value { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; margin-top: .15rem; }

.recipe-columns {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) 1.4fr;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 760px) {
  .recipe-columns { grid-template-columns: 1fr; gap: 2.25rem; }
}

.section-title {
  font-family: var(--serif);
  font-size: 1.3rem;
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--ember);
  display: inline-block;
  margin-bottom: 1.1rem;
}

/* Editable "Serves" box in the facts bar */
.fact.fact-serves { flex-basis: 160px; }
label.fact-label { margin-bottom: 0; }
.stepper { display: inline-flex; align-items: center; gap: .3rem; margin-top: .2rem; }
.stepper-btn {
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.stepper-btn:hover:not(:disabled) { background: var(--surface-alt); border-color: var(--ember); color: var(--ember); }
.stepper-btn:disabled { opacity: .4; cursor: not-allowed; }
/* Out-ranks the generic input[type="number"] rule, which would otherwise
   stretch this to 100% width with a full form-field border. */
.stepper input.stepper-input {
  width: 3.4rem;
  padding: .1rem .2rem;
  text-align: center;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper input.stepper-input:focus { border-color: var(--ember); }
.stepper input.stepper-input::-webkit-outer-spin-button,
.stepper input.stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.ingredients-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem .75rem;
  flex-wrap: wrap;
}

/* Segmented ¼× ½× 1× 2× 3× control */
.scale-group {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
  margin-bottom: 1.1rem;
}
.scale-btn {
  font: inherit;
  font-size: .82rem;
  font-weight: 600;
  min-width: 2.5rem;
  padding: .34rem .6rem;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.scale-btn + .scale-btn { border-left: 1px solid var(--border); }
.scale-btn:hover { background: var(--surface-alt); color: var(--ink); }
.scale-btn[aria-pressed="true"] { background: var(--ember); color: var(--btn-solid-fg); }
.scale-btn:focus-visible { outline-offset: -3px; }

.scale-note {
  font-size: .84rem;
  line-height: 1.5;
  color: var(--ink-soft);
  background: var(--ember-wash);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
  margin: 0 0 .9rem;
}

.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li {
  padding: .55rem 0 .55rem 1.6rem;
  border-bottom: 1px dashed var(--border);
  position: relative;
}
.ingredients li::before {
  content: "";
  position: absolute;
  left: .25rem; top: 1.05rem;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--herb);
}

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 1.5rem 3.1rem;
  line-height: 1.7;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -.1rem;
  width: 2.15rem; height: 2.15rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ember-wash);
  border: 1px solid var(--ember);
  color: var(--ember-dark);
  font-family: var(--sans);
  font-weight: 700;
  font-size: .95rem;
}

/* --- the one ad ------------------------------------------------------- */

.ad-slot {
  margin: 3.5rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.ad-label {
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: .5rem;
}
/* AdSense collapses unfilled slots; hide the label with it rather than leave
   a lonely "Advertisement" over nothing. */
.ad-slot:has(ins[data-ad-status="unfilled"]) { display: none; }

/* --- reviews --------------------------------------------------------- */

.reviews-section { margin-top: 4rem; padding-top: 2.5rem; border-top: 1px solid var(--border); }

.review-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow);
}
.review-form h3 { margin-bottom: 1.1rem; }

.signin-prompt {
  background: var(--surface-alt);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 2.5rem;
}
.signin-prompt p { margin: 0 0 1.1rem; color: var(--ink-soft); }

.review-list { display: flex; flex-direction: column; gap: 1.35rem; }
.review {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
}
.review-top { display: flex; align-items: center; gap: .75rem; margin-bottom: .7rem; flex-wrap: wrap; }
.review-who { font-weight: 600; font-size: .95rem; }
.review-when { color: var(--ink-faint); font-size: .82rem; margin-left: auto; }
.review-body { color: var(--ink-soft); line-height: 1.65; white-space: pre-wrap; overflow-wrap: break-word; }
.review-mine { border-color: var(--ember); background: var(--ember-wash); }
.review-actions { display: flex; gap: .5rem; margin-top: .9rem; }

/* --- admin ----------------------------------------------------------- */

.admin-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
}
.admin-layout { display: grid; grid-template-columns: 1.35fr .9fr; gap: 2.25rem; align-items: start; }
@media (max-width: 900px) { .admin-layout { grid-template-columns: 1fr; } }

.admin-list { display: flex; flex-direction: column; gap: .6rem; }
.admin-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: .92rem;
}
.admin-row-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-row-actions { margin-left: auto; display: flex; gap: .4rem; flex: none; }
.admin-row.is-editing { border-color: var(--ember); background: var(--ember-wash); }

.photo-preview {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  margin-bottom: .7rem;
}
.form-actions { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-top: 1.5rem; }

.gate { text-align: center; padding: 5rem 1.5rem; }
.gate h1 { margin-bottom: .9rem; }
.gate p { color: var(--ink-soft); margin: 0 auto 1.5rem; max-width: 42ch; }

/* --- states ---------------------------------------------------------- */

.empty {
  text-align: center;
  padding: 4.5rem 1.5rem;
  color: var(--ink-faint);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty-icon { font-size: 2.75rem; margin-bottom: .9rem; opacity: .65; }
.empty h3 { color: var(--ink-soft); margin-bottom: .45rem; }

.skeleton-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.skeleton-block { background: var(--surface-alt); animation: pulse 1.5s ease-in-out infinite; }
.skeleton-photo { aspect-ratio: 4 / 3; }
.skeleton-line { height: .85rem; border-radius: 4px; margin: .75rem 1.15rem; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.offline-banner {
  width: min(100% - 2.5rem, 1080px);
  margin: 1.25rem auto 0;
  padding: .7rem 1rem;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--star);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--ink-soft);
  font-size: .9rem;
  line-height: 1.5;
}

.setup-notice {
  background: var(--ember-wash);
  border: 1px solid var(--ember);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  margin: 2.5rem 0;
}
.setup-notice h2 { margin-bottom: .8rem; font-size: 1.3rem; }
.setup-notice p { color: var(--ink-soft); margin: .6rem 0 0; }
.setup-notice code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1rem .35rem;
  font-size: .88em;
}

/* --- toasts ---------------------------------------------------------- */

#toast-host {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  align-items: center;
  pointer-events: none;
  width: min(100% - 2rem, 420px);
}
.toast {
  background: var(--ink);
  color: var(--paper);
  padding: .75rem 1.15rem;
  border-radius: 999px;
  font-size: .9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lift);
  animation: toast-in .25s ease;
  text-align: center;
}
.toast-ok  { background: var(--herb); color: #fff; }
.toast-err { background: #b91c1c; color: #fff; }
.toast-out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* --- utilities ------------------------------------------------------- */

.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;
}
.muted { color: var(--ink-soft); }
.back-link { display: inline-block; margin-top: 1.75rem; font-size: .9rem; }
.stack-sm > * + * { margin-top: .6rem; }

/* --- related recipes (generated recipe pages) ------------------------- */

.related-recipes {
  margin-top: 3.25rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--border);
}
.related-recipes .section-title { margin-bottom: 1.1rem; }
/* Narrower than the home grid: this sits in the 760px reading column. */
.related-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1.1rem; }
.related-grid .card-body { padding: .85rem .95rem 1rem; }
.related-grid .card-title { font-size: 1.05rem; }
/* The "All recipes" link belongs at the very bottom, so drop the one the
   recipe itself renders when this section follows it. */
body:has(.related-recipes) #recipe-root .back-link { display: none; }

/* --- filipstudies ----------------------------------------------------- */

:root {
  --pass:      #15803d;
  --pass-wash: #f0fdf4;
  --pass-line: #bbf7d0;
  --fail:      #b91c1c;
  --fail-wash: #fef2f2;
  --fail-line: #fecaca;
  --near:      #a16207;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pass:      #4ade80;
    --pass-wash: #14271a;
    --pass-line: #2c5137;
    --fail:      #fca5a5;
    --fail-wash: #2a1718;
    --fail-line: #5c2b2b;
    --near:      #fbbf24;
  }
}

.studies-head { padding: 2.5rem 0 1.75rem; }
.studies-head h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); }
.studies-head .badge { margin-bottom: .6rem; }
.studies-head .lede { color: var(--ink-soft); font-size: 1.05rem; margin-top: .7rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem 1.5rem;
  margin-bottom: 2rem;
}
.panel .section-title { margin-top: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.err-text { color: var(--fail); font-weight: 550; }
.import-note { margin-top: .9rem; font-size: .9rem; color: var(--ink-soft); }
.import-note ul { margin: .5rem 0 0; padding-left: 1.2rem; }

/* class list ---------------------------------------------------------- */

.class-list { display: flex; flex-direction: column; gap: .75rem; }
.class-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  transition: border-color .15s ease, transform .15s ease;
}
.class-row:hover { border-color: var(--ember); transform: translateX(2px); text-decoration: none; }
.class-name { font-size: 1.25rem; }
.class-go { margin-left: auto; color: var(--ink-faint); font-size: 1.3rem; }

/* test list ----------------------------------------------------------- */

.test-list { display: flex; flex-direction: column; gap: .85rem; }
.test-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.test-main { flex: 1 1 15rem; min-width: 0; }
.test-title { font-size: 1.12rem; }
.test-intro { font-size: .9rem; margin-top: .3rem; }
.test-score { font-size: .88rem; margin-top: .55rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.test-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  /* Flex children stretch by default, which would stand the pill up as a bar. */
  align-self: flex-start;
}
.shuffle-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .85rem;
  color: var(--ink-soft);
  font-weight: 400;
  cursor: pointer;
}
.shuffle-toggle input { margin: 0; }

.score-good { color: var(--pass); font-weight: 600; }
.score-ok   { color: var(--near); font-weight: 600; }
.score-bad  { color: var(--fail); font-weight: 600; }

.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 1.1rem; }
.spark i { display: block; width: 4px; background: var(--ember); border-radius: 1px; opacity: .75; }

/* taking a test ------------------------------------------------------- */

.test-progress {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 0 .8rem;
  background: var(--paper);
  font-size: .85rem;
}
.progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}
.progress-bar i { display: block; height: 100%; background: var(--ember); transition: width .2s ease; }

.question-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.question {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.2rem 1.35rem 1.35rem;
}
.q-prompt { font-size: 1.03rem; line-height: 1.5; margin: 0 0 .9rem; }
.q-num { color: var(--ink-faint); font-weight: 600; margin-right: .3rem; }

.q-choices { display: flex; flex-direction: column; gap: .5rem; }
.q-choice {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .65rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 400;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.q-choice:hover { border-color: var(--ember); }
.q-choice.is-picked { border-color: var(--ember); background: var(--ember-wash); }
.q-choice input { margin: .25rem 0 0; flex: none; }
.q-letter { font-weight: 650; color: var(--ink-faint); flex: none; min-width: 1.1em; }
.q-choice.is-picked .q-letter { color: var(--ember); }

.q-written { width: 100%; }
.q-model {
  margin-top: .9rem;
  padding: .9rem 1rem;
  border-left: 3px solid var(--ember);
  background: var(--surface-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.q-model h3 { font-family: var(--sans); font-size: .8rem; text-transform: uppercase;
               letter-spacing: .04em; color: var(--ink-faint); margin-bottom: .4rem; }
.q-model p { margin: 0 0 .4rem; line-height: 1.55; }
.q-selfmark { display: flex; align-items: center; gap: .5rem; margin-top: .9rem; flex-wrap: wrap; }

.test-submit { margin: 2rem 0 1rem; display: flex; flex-direction: column; gap: .7rem; align-items: flex-start; }

/* results ------------------------------------------------------------- */

.result-card {
  text-align: center;
  padding: 2rem 1.5rem 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 2.5rem;
}
.result-card.score-good { border-color: var(--pass-line); background: var(--pass-wash); }
.result-card.score-bad  { border-color: var(--fail-line); background: var(--fail-wash); }
.result-score { font-family: var(--serif); font-size: 3.2rem; line-height: 1; font-weight: 600; }
.result-score span { font-size: 1.6rem; color: var(--ink-faint); }
.result-pct { font-size: 1.1rem; font-weight: 600; margin-top: .3rem; }
.result-card.score-good .result-pct { color: var(--pass); }
.result-card.score-ok   .result-pct { color: var(--near); }
.result-card.score-bad  .result-pct { color: var(--fail); }
.result-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1.25rem; }

.review-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .9rem; }
.review {
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 1rem 1.15rem;
}
.review.is-right { border-left-color: var(--pass); }
.review.is-wrong { border-left-color: var(--fail); }
.review .q-prompt { font-size: .98rem; margin-bottom: .6rem; }
.r-yours { display: flex; gap: .5rem; align-items: baseline; font-size: .92rem; margin: 0; }
.r-mark { font-weight: 700; flex: none; }
.review.is-right .r-mark { color: var(--pass); }
.review.is-wrong .r-mark { color: var(--fail); }
.r-correct { font-size: .92rem; margin: .4rem 0 0; color: var(--ink); }
.r-why { font-size: .88rem; color: var(--ink-soft); margin: .5rem 0 0; line-height: 1.55; }

@media (max-width: 560px) {
  .test-actions { width: 100%; }
  .result-score { font-size: 2.6rem; }
}
