/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

:root {
  --ink: #22201d;
  --muted: #6b6560;
  --rule: #e4ded6;
  --paper: #fbf9f6;
  --accent: #8c4a2f;
  --measure: 42rem;   /* prose: ~70 characters a line */
  --wide: 78rem;      /* browsing: grids and photo rows */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.65 ui-serif, Georgia, "Times New Roman", serif;
}

main { margin: 0 auto; padding: 2rem 1.25rem 4rem; }
main.reading { max-width: var(--measure); }
main.wide    { max-width: var(--wide); }
h1, h2 { font-family: ui-sans-serif, system-ui, sans-serif; line-height: 1.2; }
h1 { font-size: 2rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 2.25rem 0 .5rem; }
a { color: var(--accent); }
.lead { color: var(--muted); }
.subtitle { color: var(--muted); margin-top: 0; font-style: italic; }
.count, .card-meta { color: var(--muted); font-size: .875rem; }

.site-header, .site-footer {
  max-width: var(--measure); margin: 0 auto; padding: 1rem 1.25rem;
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: .9rem;
}
/* One row: brand, navigation, then the language chooser pushed right. Prose
   stays at the reading measure; pages you browse rather than read get --wide.
   None of this is responsive plumbing -- max-width never engages on a phone,
   where the viewport is narrower than either value. */
.site-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.5rem;
  max-width: var(--wide); margin: 0 auto;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--rule);
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: .9rem;
}
.site-header .brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 1rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: baseline; }
.site-nav a { text-decoration: none; color: var(--ink); }
.site-nav a:hover { color: var(--accent); }

/* language chooser */
.lang { margin-left: auto; position: relative; }
.lang summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: .45rem;
  padding: .35rem .7rem; border: 1px solid var(--rule); border-radius: 999px;
  background: #fff; font-size: .85rem; user-select: none;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: "▾"; color: var(--muted); font-size: .75rem; }
.lang summary:hover { border-color: var(--accent); }
.lang[open] summary { border-color: var(--accent); }
.lang ul {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20;
  list-style: none; margin: 0; padding: .3rem;
  min-width: 12rem; background: #fff;
  border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(34, 32, 29, .12);
}
.lang li a {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .6rem; border-radius: 5px;
  text-decoration: none; color: var(--ink); font-size: .875rem;
}
.lang li a:hover { background: var(--paper); }
.lang li a[aria-current] { font-weight: 600; }
.lang li a[aria-current]::after { content: "✓"; margin-left: auto; color: var(--accent); }
/* Windows browsers render regional-indicator pairs as letters rather than a
   flag; the language name beside them carries the meaning either way. */
.flag { font-size: 1.05rem; line-height: 1; }

.site-footer { border-top: 1px solid var(--rule); margin-top: 3rem; max-width: var(--wide); }

.hero { padding: 1rem 0 2rem; border-bottom: 1px solid var(--rule); }
.tagline { font-size: 1.1rem; margin-top: 0; }
.button {
  display: inline-block; padding: .55rem 1.1rem; border-radius: 999px;
  background: var(--accent); color: #fff; text-decoration: none;
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: .9rem;
}

.cards { list-style: none; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card a { display: block; text-decoration: none; color: inherit; }
.card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
.card-title { display: block; margin-top: .45rem; font-weight: 600; }
.badge {
  display: inline-block; margin-top: .3rem; padding: .1rem .5rem; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: .7rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

/* Twenty chapters in one column wastes a wide screen; auto-fill collapses to a
   single column on a phone with no media query. */
.chapter-list {
  list-style: none; padding: 0; margin: 1.5rem 0 0;
  display: grid; gap: 0 2rem;
  grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr));
}
.chapter-list li { border-bottom: 1px solid var(--rule); }

/* The whole row is the link, so the photo and the title share one hit target
   and one focus ring. The image is decorative -- the chapter title is right
   beside it -- so it carries an empty alt rather than repeating the name. */
.chapter-row {
  display: flex; gap: 1rem; align-items: center;
  padding: .85rem 0; text-decoration: none; color: inherit;
}
.chapter-row:hover .chapter-title { color: var(--accent); }
.chapter-thumb {
  width: 76px; height: 76px; flex: none;
  object-fit: cover; border-radius: 8px; display: block;
  background: var(--rule);
}
.chapter-text { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.chapter-title {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 1.05rem; font-weight: 600; line-height: 1.3;
}
.chapter-text .subtitle { margin: 0; font-size: .9rem; }

.recipe-photo { width: 100%; border-radius: 8px; margin-bottom: 1.25rem; }
.facts { display: flex; flex-wrap: wrap; gap: 1.5rem; padding: .9rem 0; margin: 0 0 1rem; border-block: 1px solid var(--rule); font-family: ui-sans-serif, system-ui, sans-serif; font-size: .85rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: .1rem 0 0; font-weight: 600; }
.ingredients, .method { padding-left: 1.2rem; }
.ingredients li, .method li { margin-bottom: .4rem; }

.locked { margin-top: 2rem; padding: 1.25rem; border: 1px solid var(--rule); border-radius: 8px; background: #fff; }
.locked h2 { margin-top: 0; }
.placeholder { color: var(--muted); font-style: italic; }

.notice {
  padding: .9rem 1.1rem; margin: 1.5rem 0;
  border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0;
  background: #fff; font-size: .95rem;
}
.beta { margin-top: 2.25rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.beta ol { padding-left: 1.2rem; }
.beta ol li { margin-bottom: .45rem; }

.sample-note {
  margin-top: 1.75rem; padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted); font-size: .95rem;
}
.locked .button { margin-top: .35rem; }

/* ---- admin ---- */
.admin main { max-width: 82rem; }
/* Utilitarian, not a reading page: the measure that suits recipe prose makes a
   189-row table unusable. Guides stay narrow (see .guide below). */
.admin .guide { max-width: 46rem; }
.notice.alert { border-left-color: #a33; }
.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: .8rem; text-decoration: underline;
}
.linkish:hover { color: var(--accent); }

.signin { max-width: 22rem; margin: 3rem auto; }
.form { display: flex; flex-direction: column; gap: .3rem; }
.form label {
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: .8rem;
  color: var(--muted); margin-top: .6rem;
}
.form input[type=email], .form input[type=password] {
  padding: .55rem .7rem; border: 1px solid var(--rule); border-radius: 6px;
  font: inherit; font-size: .95rem; background: #fff;
}
.form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form input[type=submit] { margin-top: 1rem; border: 0; cursor: pointer; }

/* rendered markdown */
.guide h1 { font-size: 1.7rem; margin-bottom: 1rem; }
.guide h2 { margin-top: 2rem; }
.guide h3 { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 1rem; margin: 1.4rem 0 .3rem; }
.guide code {
  background: #f0ece6; padding: .1rem .35rem; border-radius: 4px;
  font-size: .875em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.guide pre {
  background: #2b2724; color: #f4efe8; padding: .9rem 1.1rem; border-radius: 8px;
  overflow-x: auto; font-size: .85rem; line-height: 1.5;
}
.guide pre code { background: none; padding: 0; color: inherit; }
.guide blockquote {
  margin: 1.25rem 0; padding-left: 1rem;
  border-left: 3px solid var(--rule); color: var(--muted);
}
.guide table { border-collapse: collapse; width: 100%; font-size: .9rem; margin: 1rem 0; }
.guide th, .guide td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--rule); }

.admin-head { border-bottom: 1px solid var(--rule); padding-bottom: 1rem; margin-bottom: 1.25rem; }
.admin-head h1 { margin-bottom: .35rem; }
.stats { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: .75rem 0 0;
         font-family: ui-sans-serif, system-ui, sans-serif; }
.stats dt { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.stats dd { margin: .1rem 0 0; font-weight: 600; font-size: 1.05rem; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.filters input[type=search], .filters select {
  padding: .4rem .6rem; border: 1px solid var(--rule); border-radius: 6px;
  font: inherit; font-size: .9rem; background: #fff;
}
.filters input[type=search] { min-width: 16rem; }
.filters input[type=submit] { padding: .4rem .9rem; font-size: .85rem; border: 0; cursor: pointer; }

.grid { width: 100%; border-collapse: collapse; font-size: .9rem;
        font-family: ui-sans-serif, system-ui, sans-serif; }
.grid th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); border-bottom: 1px solid var(--rule); padding: .4rem .6rem;
}
.grid td { padding: .4rem .6rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.grid tbody tr:hover { background: #fff; }
.row-thumb { border-radius: 4px; object-fit: cover; display: block; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; color: var(--muted); }
.untranslated { background: #fdf3e7; }

.pager { display: flex; gap: 1.25rem; align-items: center; margin-top: 1.25rem;
         font-family: ui-sans-serif, system-ui, sans-serif; font-size: .9rem; }

/* ---- admin top bar ---- */
/* One row: brand, then navigation, then the account group pushed right by
   margin-left:auto. A solid dark bar so an admin page is never mistaken for the
   public site at a glance. */
.admin-bar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .4rem 1.25rem;
  /* Full-bleed background, but the contents line up with <main>, which is
     centred at 82rem. The max() keeps a gutter on narrow screens and centres
     the row on wide ones -- no wrapper element needed. */
  padding: .6rem max(1.25rem, calc((100% - 82rem) / 2));
  background: var(--ink); color: #f1ece5;
  font-family: ui-sans-serif, system-ui, sans-serif; font-size: .875rem;
}
.admin-bar .brand { font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.admin-bar-nav { display: flex; flex-wrap: wrap; gap: 1.1rem; align-items: center; }
.admin-bar a { color: #d8d0c6; text-decoration: none; }
.admin-bar a:hover { color: #fff; text-decoration: underline; }
.admin-bar a[aria-current="page"] { color: #fff; font-weight: 600; }

.admin-bar-account {
  margin-left: auto;              /* the float-right, without floats */
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem;
}
.admin-bar-user { color: #9d948a; font-size: .8rem; }
/* button_to renders a form; keep it from breaking the row */
.admin-bar-account form { display: inline; margin: 0; }
.admin-bar .linkish { color: #d8d0c6; font-size: .8rem; }
.admin-bar .linkish:hover { color: #fff; }

/* the bar spans the window; its contents line up with the page */
.admin main { margin-top: 1.5rem; }
