/* ==========================================================================
   BrewDose — brewdose.online
   Single stylesheet. No preprocessor, no build step.

   Contents:
     1. Tokens
     2. Reset & base
     3. Layout primitives
     4. Header / nav
     5. Hero
     6. Article cards (responsive grid)
     7. About panel
     8. Article pages (prose)
     9. Comments
    10. Forms
    11. Footer
    12. Responsive
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   Palette and scale live here so a rebrand is a single-block edit.
   -------------------------------------------------------------------------- */
:root {
  /* Brand palette */
  --cream: #faf0e6;
  --brown: #3e2723;
  --orange: #d84315;

  /* Derived tones — all hand-checked for >=4.5:1 contrast on their pairing */
  --brown-soft: #5d4037;
  --brown-line: #d7c4b0;
  --cream-panel: #fff8f0;
  --cream-sunk: #f3e5d5;
  --ink: #2f2420;
  --ink-muted: #6d5b52;
  --orange-dark: #b03610; /* link hover; passes AA on cream */

  /* Type */
  --font-head: "Merriweather", Georgia, "Times New Roman", serif;
  --font-body: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Spacing / shape */
  --measure: 68ch;      /* readable line length for prose */
  --shell: 1140px;      /* max page width */
  --radius: 6px;
  --shadow: 0 1px 2px rgba(62, 39, 35, 0.06), 0 6px 18px rgba(62, 39, 35, 0.08);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  /* Fluid body copy: 16px on phones, up to 17px on desktop. */
  font-size: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  line-height: 1.7;
  /* Sticky footer without a wrapper div. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  color: var(--brown);
  line-height: 1.25;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.9rem); }
h2 { font-size: clamp(1.35rem, 1.15rem + 0.9vw, 1.75rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1.15em; }

a {
  color: var(--orange);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover { color: var(--orange-dark); }

/* Visible focus for keyboard users on every interactive element. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
  border-radius: 2px;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

main {
  flex: 1; /* pushes footer down on short pages */
}

.section {
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

/* Skip link — visually hidden until focused. */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--orange);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
}

.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* --------------------------------------------------------------------------
   4. Header / nav
   -------------------------------------------------------------------------- */
.masthead {
  background: var(--brown);
  border-bottom: 3px solid var(--orange);
}

.masthead .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
}

.logo {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--cream);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.logo:hover { color: #fff; }

/* The dot in "BrewDose" — small brand tell. */
.logo span { color: var(--orange); }

.nav-toggle {
  display: none; /* shown only under the mobile breakpoint */
  background: transparent;
  border: 1px solid rgba(250, 240, 230, 0.4);
  border-radius: var(--radius);
  color: var(--cream);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav a {
  color: var(--cream);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding-block: 0.25rem;
  border-bottom: 2px solid transparent;
}

.nav a:hover {
  color: #fff;
  border-bottom-color: var(--orange);
}

/* Set per-page via aria-current="page" on the matching link. */
.nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--orange);
}

/* --------------------------------------------------------------------------
   5. Hero
   -------------------------------------------------------------------------- */
.hero {
  background: var(--brown);
  color: var(--cream);
  text-align: center;
  padding-block: clamp(3rem, 8vw, 5.5rem);
}

.hero h1 {
  color: var(--cream);
  max-width: 18ch;
  margin-inline: auto;
}

.hero p {
  color: rgba(250, 240, 230, 0.82);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
  max-width: 46ch;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   6. Article cards
   auto-fill + minmax gives 3 / 2 / 1 columns across desktop / tablet / phone
   from one rule — no breakpoint math needed.
   -------------------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.75rem;
}

.card {
  background: var(--cream-panel);
  border: 1px solid var(--brown-line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--cream-sunk); /* placeholder tone while the image loads */
}

.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.card h3 a {
  color: var(--brown);
  text-decoration: none;
}

.card h3 a:hover { color: var(--orange); }

.card p {
  color: var(--ink-muted);
  font-size: 0.95rem;
  flex: 1;
}

.card .meta {
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.read-more {
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  align-self: flex-start;
}

.read-more::after {
  content: " \2192"; /* → */
}

.read-more:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   7. About panel (homepage)
   -------------------------------------------------------------------------- */
.about-panel {
  background: var(--cream-sunk);
  border-top: 1px solid var(--brown-line);
  border-bottom: 1px solid var(--brown-line);
}

.about-panel .inner {
  max-width: var(--measure);
  margin-inline: auto;
  text-align: center;
}

.section-head {
  text-align: center;
  margin-bottom: 2rem;
}

.section-head p {
  color: var(--ink-muted);
  margin: 0;
}

/* --------------------------------------------------------------------------
   8. Article pages
   -------------------------------------------------------------------------- */
.prose {
  max-width: var(--measure);
  margin-inline: auto;
}

.prose h2 {
  margin-top: 2.25em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--brown-line);
}

.prose h3 { margin-top: 1.75em; }

.prose ul,
.prose ol {
  margin: 0 0 1.15em;
  padding-left: 1.4em;
}

.prose li { margin-bottom: 0.4em; }

.prose figure {
  margin: 2rem 0;
}

.prose figure img {
  width: 100%;
  border-radius: var(--radius);
  background: var(--cream-sunk);
}

.prose figcaption {
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 0.6rem;
  font-style: italic;
}

.byline {
  color: var(--ink-muted);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--brown-line);
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
}

.byline strong { color: var(--brown); }

/* Pull-quote / key-takeaway block used a few times in the articles. */
.callout {
  background: var(--cream-panel);
  border-left: 4px solid var(--orange);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.1rem 1.25rem;
  margin: 1.75rem 0;
}

.callout p:last-child { margin-bottom: 0; }

.callout strong { color: var(--brown); }

/* Spec tables in the review articles. */
.table-wrap {
  overflow-x: auto; /* narrow screens scroll the table, not the page */
  margin: 1.75rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}

th,
td {
  border: 1px solid var(--brown-line);
  padding: 0.6rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--cream-sunk);
  font-family: var(--font-head);
  color: var(--brown);
  font-size: 0.85rem;
}

/* Related articles */
.related {
  max-width: var(--measure);
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 2px solid var(--brown-line);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.related-item {
  background: var(--cream-panel);
  border: 1px solid var(--brown-line);
  border-radius: var(--radius);
  padding: 1rem;
}

.related-item a {
  font-family: var(--font-head);
  font-weight: 700;
  text-decoration: none;
  color: var(--brown);
}

.related-item a:hover { color: var(--orange); }

.related-item p {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

/* --------------------------------------------------------------------------
   9. Comments (static markup — no backend wired up)
   -------------------------------------------------------------------------- */
.comments {
  max-width: var(--measure);
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 2px solid var(--brown-line);
}

.comment {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--brown-line);
}

.avatar {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brown-soft);
  color: var(--cream);
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.95rem;
}

.comment-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.comment-head b { color: var(--brown); }

.comment-head time {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.comment p {
  margin: 0;
  font-size: 0.95rem;
}

/* Nested reply */
.comment.reply {
  margin-left: 3.25rem;
}

/* --------------------------------------------------------------------------
   10. Forms
   -------------------------------------------------------------------------- */
.form {
  max-width: 34rem;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--brown);
  margin-bottom: 0.35rem;
}

.field input,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--cream-panel);
  border: 1px solid var(--brown-line);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--orange);
}

.field textarea {
  resize: vertical;
  min-height: 9rem;
}

.btn {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: var(--radius);
  padding: 0.7rem 1.5rem;
  cursor: pointer;
}

.btn:hover { background: var(--orange-dark); }

.note {
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.contact-aside {
  background: var(--cream-sunk);
  border: 1px solid var(--brown-line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 2rem;
  max-width: 34rem;
}

.contact-aside p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   11. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--brown);
  color: rgba(250, 240, 230, 0.75);
  font-size: 0.9rem;
  margin-top: auto;
  padding-block: 2rem;
}

.site-footer .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--cream);
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

/* --------------------------------------------------------------------------
   12. Responsive
   One breakpoint: the nav collapses. The card grid handles itself via
   auto-fill, so it needs no rule here.
   -------------------------------------------------------------------------- */
@media (max-width: 720px) {
  .nav-toggle {
    display: block;
  }

  .masthead .shell {
    flex-wrap: wrap;
    padding-block: 0.75rem;
  }

  /* Collapsed by default on mobile; main.js flips [data-open]. */
  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding-bottom: 0.5rem;
  }

  .nav[data-open="true"] {
    display: flex;
  }

  .nav a {
    width: 100%;
    padding-block: 0.7rem;
    border-bottom: 1px solid rgba(250, 240, 230, 0.15);
  }

  .nav a[aria-current="page"],
  .nav a:hover {
    border-bottom-color: var(--orange);
  }

  .comment.reply {
    margin-left: 1.5rem;
  }

  .site-footer .shell {
    flex-direction: column;
    text-align: center;
  }
}

/* No-JS fallback: without main.js the toggle can't work, so show the nav.
   .no-js is removed by main.js on load. */
.no-js .nav { display: flex; }
.no-js .nav-toggle { display: none; }

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Print — strip chrome, keep the article readable.
   -------------------------------------------------------------------------- */
@media print {
  .masthead,
  .site-footer,
  .comments,
  .related {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
