/* ============================================================
   Gravity Principle Meadery
   Dark amber/honey theme. Glass surfaces, warm glow, tabular data.
   ============================================================ */

@import url('fonts/fonts.css');

:root {
  /* surfaces — neutral cool slate, no warm cast */
  --bg: #0a0e14;
  --bg-2: #0f141c;
  --surface: rgba(148, 170, 200, 0.045);
  --surface-2: rgba(148, 170, 200, 0.085);
  --border: rgba(148, 170, 200, 0.14);
  --border-lit: rgba(255, 178, 41, 0.34);

  /* text — cool greys, deliberately not beige */
  --text: #eaf0f8;
  --text-dim: #a3b2c7;
  --text-faint: #6d7f96;

  /* amber accent */
  --honey: #ffb229;
  --honey-lt: #ffcf6b;
  --honey-dk: #e08c14;
  --amber-glow: rgba(255, 178, 41, 0.13);
  --eyebrow: #f5a623;

  /* semantic */
  --green: #4ddba0;
  --blue: #58b0f5;
  --violet: #a78bfa;
  --rose: #f472a0;

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;

  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --display: 'Fraunces', Georgia, serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  isolation: isolate;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -6px;
  z-index: -1;
  pointer-events: none;
  background: url('background.webp') repeat;
}

.hero, .card, .stat, .tile, .front-page-item, .label-showcase,
.page-banner, .document-card, .batch-header, .batch-card, .batch-notes,
.table-wrap, .chart, .panel, .gallery-card, .photo {
  -webkit-backdrop-filter: blur(3px) brightness(.65) saturate(.8);
  backdrop-filter: blur(3px) brightness(.65) saturate(.8);
}

::selection { background: rgba(255, 178, 41, 0.3); color: #fff; }

/* ---------- photo galleries ---------- */

.gallery-cards, .photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 1.3rem;
}
.gallery-card, .photo {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(145deg, var(--surface-2), var(--surface));
}
.gallery-card {
  display: flex;
  flex-direction: column;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}
.gallery-card:hover { border-color: var(--border-lit); color: var(--text); }
.gallery-cover, .photo-image {
  display: block;
  background: #070b10;
  border-bottom: 1px solid var(--border);
}
.gallery-cover { position: relative; aspect-ratio: 4 / 3; flex: none; }
.gallery-cover img { position: absolute; inset: 0; }
.gallery-video-cover {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--honey);
  font-size: 1.25rem;
}
video.photo-image { width: 100%; object-fit: contain; }
.gallery-cover img, .photo-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.gallery-card-body { display: flex; flex-direction: column; flex: 1; padding: 1.25rem; }
.gallery-card-body h3 { font-family: var(--display); font-size: 1.35rem; margin: 0; }
.gallery-card-body > p:not(.eyebrow) { color: var(--text-dim); font-size: 0.9rem; }
.gallery-heading { margin-bottom: 2rem; }
.gallery-heading .lede { margin: 1rem 0 0; }
.gallery-context { padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.related-galleries { margin-top: 2.5rem; }
.photo-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.photo { scroll-margin-top: 7rem; }
.photo-image { height: clamp(260px, 42vw, 520px); }
.photo figcaption { padding: 1.25rem; overflow-wrap: anywhere; }
.photo-caption { margin: 0 0 0.75rem; }
.photo-timestamp { color: var(--text-dim); font-size: 0.8rem; }
.photo-timestamp time { display: block; font-variant-numeric: tabular-nums; }
.gallery-card:focus-visible, .photo a:focus-visible { outline: 3px solid var(--honey); outline-offset: 3px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.85rem clamp(1rem, 4vw, 2.5rem);
  padding-right: calc(clamp(1rem, 4vw, 2.5rem) + 3.25rem);
  background: rgba(10, 14, 20, 0.75);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}

.logout-form {
  position: absolute;
  top: .55rem;
  right: clamp(1rem, 4vw, 2.5rem);
  margin: 0;
}

.logout-form button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

.logout-form button:hover { background: var(--surface-2); }
.logout-form button:focus-visible { outline: 2px solid var(--honey); outline-offset: 2px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--display);
  font-size: 1.16rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  font-size: 1.05em;
  filter: drop-shadow(0 0 10px var(--amber-glow));
}

.topbar nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }

.topbar nav a {
  position: relative;
  padding: 0.4rem 0.8rem;
  border-radius: 100px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}

.topbar nav a:hover { color: var(--text); background: var(--surface-2); }

.topbar nav a.active {
  color: #10161f;
  background: linear-gradient(135deg, var(--honey-lt), var(--honey));
  box-shadow: 0 2px 16px rgba(255, 178, 41, 0.28);
}

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

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2.5rem) 5rem;
}

.frontpage {
  --margin: clamp(.5rem, 2vmin, 1.5rem);
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: none;
  padding: var(--margin);
}

.frontpage-label {
  position: relative;
  width: min(100%, (100vh - 2 * var(--margin)) * .75);
  width: min(100%, (100dvh - 2 * var(--margin)) * .75);
}

.frontpage-label img { display: block; width: 100%; height: auto; }

.frontpage-login {
  position: absolute;
  top: 82.5%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: .25rem;
  width: min(78%, 21rem);
}

.frontpage-login input, .frontpage-login button {
  border: 1px solid #765a32;
  border-radius: .3rem;
  padding: .3rem .45rem;
  font: 1rem var(--sans);
}

.frontpage-login input {
  flex: 1;
  min-width: 0;
  color: #23180d;
  background: #fff8e9;
}

.frontpage-login button { color: #fff8e9; background: #493318; cursor: pointer; }

.frontpage-login :focus-visible { outline: 2px solid #493318; outline-offset: 2px; }

.frontpage-error {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin: 0 0 .25rem;
  padding: .15rem .4rem;
  border-radius: .25rem;
  background: #fff8e9;
  color: #861d16;
  font-size: .8rem;
  line-height: 1.2;
  text-align: center;
  width: max-content;
  max-width: 100%;
}

footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 4vw, 2.5rem) 3rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.82rem;
}

section { margin-bottom: 2.75rem; }

.two-col {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
}

/* ---------- typography ---------- */

h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 2.9rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin: 0 0 0.4rem;
}

h2 {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 1rem;
}

h3 { font-size: 1.02rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }

.section-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.1rem;
}
.section-label h2 { margin: 0; }
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}

.eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--eyebrow);
  margin: 0 0 0.5rem;
}

.group {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--text-faint);
  margin: 1.6rem 0 0.6rem;
}

a { color: var(--honey); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--honey-lt); }

.lede {
  font-size: 1.06rem;
  color: var(--text-dim);
  max-width: 62ch;
  margin: 0 0 2rem;
}

.meta { color: var(--text-faint); font-size: 0.82rem; }
.empty { color: var(--text-faint); font-style: italic; }
code { font-family: var(--mono); font-size: 0.87em; color: var(--honey-lt); }

.crumbs {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-bottom: 1rem;
}
.crumbs a { color: var(--text-dim); }
.crumbs a:hover { color: var(--honey); }

.page-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.page-head h1 { margin: 0; }

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

.hero {
  position: relative;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  margin-bottom: 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background:
    radial-gradient(ellipse 70% 120% at 10% 0%, rgba(255, 178, 41, 0.10), transparent 62%),
    radial-gradient(ellipse 65% 110% at 92% 8%, rgba(88, 176, 245, 0.09), transparent 62%),
    linear-gradient(160deg, rgba(148, 170, 200, 0.07), rgba(148, 170, 200, 0.02));
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--border-lit), transparent 45%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.hero h1 {
  background: linear-gradient(115deg, #fff 25%, var(--honey-lt) 80%, var(--honey));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .hero-logo-heading {
  margin: 0;
  display: flex;
  justify-content: center;
}
.hero-logo {
  display: block;
  width: 444px;
  max-width: 100%;
  height: auto;
}
.hero .lede { margin-bottom: 0; }

.hero-stats {
  display: flex;
  gap: 2.25rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.hero-stat .n {
  display: block;
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.hero-stat .l {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}

/* ---------- front of mind ---------- */

.front-page { margin-bottom: 2.75rem; }
.front-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 0.9rem;
}
.front-page-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  min-width: 0;
  padding: 1.2rem;
  color: var(--text);
  border: 1px solid var(--border-lit);
  border-radius: var(--r);
  background: linear-gradient(150deg, var(--amber-glow), var(--surface-2) 70%);
  transition: transform 0.25s var(--ease), border-color 0.25s, background 0.25s;
}
.front-page-item:hover {
  color: var(--text);
  transform: translateY(-3px);
  border-color: var(--honey);
  background: linear-gradient(150deg, rgba(255, 178, 41, 0.2), var(--surface-2) 70%);
}
.front-page-item:focus-visible { outline: 3px solid var(--honey); outline-offset: 3px; }
.front-page-count { font: 500 0.8rem var(--mono); color: var(--honey-lt); }
.front-page-copy { display: grid; gap: 0.35rem; flex: 1; min-width: 0; }
.front-page-copy strong { font-family: var(--display); font-size: 1.2rem; line-height: 1.2; }
.front-page-copy > span { color: var(--text-dim); font-size: 0.84rem; line-height: 1.5; }
.front-page-arrow { color: var(--honey); font-size: 1.2rem; line-height: 1; }

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

.cards {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border-lit), transparent);
  opacity: 0;
  transition: opacity 0.35s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-lit);
  box-shadow: 0 16px 44px -14px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--border-lit);
}
.card:hover::before { opacity: 1; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.card-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.card-abv {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.card-abv .big {
  font-family: var(--display);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--honey-lt), var(--honey));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.card-abv .unit { font-size: 0.78rem; color: var(--text-faint); letter-spacing: 0.06em; }

dl.mini { margin: 0; display: grid; gap: 0.42rem; }
dl.mini > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  align-items: baseline;
}
dl.mini dt { color: var(--text-faint); margin: 0; white-space: nowrap; }
dl.mini dd { margin: 0; text-align: right; color: var(--text-dim); font-weight: 500; }

/* nav-style tile cards */
.tiles {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: background 0.25s, border-color 0.25s, transform 0.25s var(--ease);
}
.tile:hover {
  background: var(--surface-2);
  border-color: var(--border-lit);
  transform: translateY(-2px);
}
.tile .t { font-weight: 600; font-size: 0.95rem; }
.tile .d { font-size: 0.79rem; color: var(--text-faint); }
.tile .ico { font-size: 1.1rem; margin-bottom: 0.15rem; opacity: 0.85; }

/* ---------- badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border-radius: 100px;
  font-size: 0.685rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
}
.badge-bottled { color: var(--green); border-color: rgba(77, 219, 160, 0.32); background: rgba(77, 219, 160, 0.1); }
.badge-primary, .badge-secondary { color: var(--honey); border-color: var(--border-lit); background: var(--amber-glow); }
.badge-aging { color: var(--blue); border-color: rgba(88, 176, 245, 0.32); background: rgba(88, 176, 245, 0.1); }
.badge-planned { color: var(--violet); border-color: rgba(167, 139, 250, 0.32); background: rgba(167, 139, 250, 0.1); }
.badge-archived { color: var(--text-faint); }

.est {
  font-size: 0.7rem;
  font-style: normal;
  color: var(--text-faint);
  padding: 0.1rem 0.4rem;
  border: 1px dashed var(--border);
  border-radius: 4px;
}

/* ---------- stats ---------- */

.stats {
  display: grid;
  gap: 0.85rem;
  margin: 1.75rem 0;
  /* grid (not flex) so a trailing tile keeps its width instead of stretching.
     Narrow min so 5 tiles fit one row rather than orphaning the last. */
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}
.stat {
  position: relative;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  overflow: hidden;
}
.stat .label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.3rem;
}
.stat .value {
  display: block;
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}
.stat.accent {
  border-color: var(--border-lit);
  background: linear-gradient(165deg, var(--amber-glow), var(--surface));
}
.stat.accent .value {
  background: linear-gradient(120deg, var(--honey-lt), var(--honey));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- batch detail ---------- */

.nowrap { white-space: nowrap; }
.cell-detail { display: block; margin-top: .25rem; font-size: .72rem; color: var(--text-dim); }
.mini dd small { display: block; color: var(--text-dim); font-size: .75rem; }
.label-showcase { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); align-items: center; gap: 2rem; padding: clamp(1rem, 3vw, 2rem); margin-bottom: 2.5rem; border: 1px solid var(--border-lit); border-radius: var(--r-lg); background: linear-gradient(135deg, var(--amber-glow), var(--surface)); }
.label-art { display: block; }
.label-art img { display: block; width: 100%; height: auto; border-radius: var(--r-sm); }
.label-showcase .pills { flex-wrap: wrap; }
@media (max-width: 600px) {
  .label-showcase { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .label-art { width: min(100%, 220px); margin: auto; }
}
.page-banner { margin-bottom: 2rem; padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--border); border-radius: var(--r-lg); background: linear-gradient(135deg, var(--amber-glow), var(--surface)); }
.document-card { padding: clamp(1rem, 3vw, 2rem); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); margin-bottom: 2rem; min-width: 0; }
.document-card .prose { max-width: none; }
.inventory-section { scroll-margin-top: 10rem; }
.batch-header {
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: radial-gradient(ellipse at top left, var(--amber-glow), transparent 75%), var(--surface);
}
.batch-header .meta { margin-bottom: 0; }
.batch-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr)); }
.batch-stats small { font-size: .6em; }
.stat-detail { display: block; margin-top: .55rem; font-size: .75rem; color: var(--text-dim); }
.batch-details-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1.25rem; margin: 2rem 0; align-items: start; }
.batch-card { min-width: 0; padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.batch-card .section-label { margin-top: 0; }
.batch-card .table-wrap { margin-bottom: 0; overflow-x: auto; }
.nutrient-when, .nutrient-grams { white-space: nowrap; }
.nutrient-when { font-variant-numeric: tabular-nums; }
.nutrient-summary { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin: 1rem 0 1.5rem; }
.nutrient-summary dt { font-size: .75rem; color: var(--text-dim); }
.nutrient-summary dd { margin: .2rem 0 0; font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.batch-notes { padding: clamp(1rem, 3vw, 2rem); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.batch-notes > .section-label { margin-top: 0; }
.batch-notes .prose { max-width: none; }
@media (max-width: 760px) {
  .batch-details-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- callouts ---------- */

.notice, .caveat {
  position: relative;
  padding: 1rem 1.2rem 1rem 2.9rem;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  font-size: 0.9rem;
  color: var(--text-dim);
}
.notice::before, .caveat::before {
  position: absolute;
  left: 1.1rem;
  top: 1rem;
  font-size: 1rem;
  line-height: 1.4;
}
.notice {
  border-left: 2px solid var(--blue);
  background: linear-gradient(to right, rgba(88, 176, 245, 0.09), transparent 60%);
}
.notice::before { content: "ℹ"; color: var(--blue); }
.caveat {
  border-left: 2px solid var(--honey);
  background: linear-gradient(to right, var(--amber-glow), transparent 60%);
}
.caveat::before { content: "⚠"; color: var(--honey); }
.notice strong, .caveat strong { color: var(--text); }

/* ---------- tables ---------- */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin: 1rem 0 1.75rem;
  background: var(--surface);
  overflow: hidden;
}
.table-wrap > table { margin: 0; border: none; }
.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 1rem 0 1.75rem;
}

th, td {
  text-align: left;
  padding: 0.7rem 0.95rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

thead th {
  background: rgba(15, 20, 28, 0.96);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  white-space: nowrap;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

td { font-variant-numeric: tabular-nums; color: var(--text-dim); }
td strong, td a { color: var(--text); font-weight: 600; }
td a:hover { color: var(--honey); }
th[scope="row"], tbody th { color: var(--text-dim); font-weight: 500; font-size: 0.85rem; }
td.note { font-variant-numeric: normal; font-size: 0.83rem; color: var(--text-faint); }
td.num { text-align: right; font-family: var(--mono); font-size: 0.83rem; }

/* attenuation bar */
.bar {
  position: relative;
  height: 6px;
  min-width: 70px;
  border-radius: 100px;
  background: rgba(148, 170, 200, 0.14);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(to right, var(--honey-dk), var(--honey-lt));
  box-shadow: 0 0 12px rgba(255, 178, 41, 0.5);
}
.bar-label { font-size: 0.75rem; color: var(--text-faint); margin-top: 0.2rem; }

/* ---------- fermentation chart ---------- */

.chart {
  position: relative;
  padding: 1.5rem 1.25rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  margin: 1rem 0 1.75rem;
}
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-line { fill: none; stroke: url(#honeyGrad); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: url(#areaGrad); }
.chart-dot { fill: var(--honey-lt); stroke: var(--bg); stroke-width: 2; }
.chart-dot:hover { r: 6; }
.chart-grid { stroke: rgba(148, 170, 200, 0.12); stroke-width: 1; }
.chart { position: relative; }
.chart-interactive { cursor: pointer; }
.chart-interactive:focus-visible { outline: none; stroke: #fff; stroke-width: 3; }
.chart-tooltip {
  position: absolute; z-index: 10; width: min(290px, calc(100% - 16px));
  padding: 1.1rem 1.25rem; border: 1px solid var(--border-lit); border-radius: var(--r);
  background: #111c2bf5; box-shadow: 0 12px 40px #0008; backdrop-filter: blur(12px);
  color: var(--text); font-size: .85rem; overflow-wrap: anywhere;
}
.chart-tooltip[hidden] { display: none; }
.chart-tip-kind { color: var(--honey); font-size: .7rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.chart-tip-gravity { display: block; margin: .35rem 0; font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.chart-tip-gravity small { font-size: .8rem; color: var(--text-dim); }
.chart-tip-date { margin: 0 0 .8rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.chart-tooltip dl { margin: 0; }
.chart-tooltip dl div { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; }
.chart-tooltip dt { color: var(--text-dim); }
.chart-tooltip dd { margin: 0; font-weight: 600; text-align: right; }
.chart-tip-note { margin: .8rem 0 0; padding-top: .7rem; border-top: 1px solid var(--border); color: var(--text-dim); font-size: .78rem; }
.chart-estimate { fill: none; stroke: #72bfff; stroke-width: 2.5; stroke-dasharray: 6 5; }
.chart-estimate-now { fill: #72bfff; stroke: var(--surface); stroke-width: 2; }
.chart-legend .estimate-now-key { width: 9px; height: 9px; border-radius: 50%; background: #72bfff; }
.chart-estimate-end { fill: var(--surface); stroke: #72bfff; stroke-width: 2; }
.chart-legend .estimate-key { height: 0; border-top: 2px dashed #72bfff; background: none; }
.chart-ref { stroke: var(--honey); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.55; }
.chart-txt { fill: var(--text-faint); font-size: 10px; font-family: var(--mono); }
.chart-legend {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.76rem;
  color: var(--text-faint);
}
.chart-legend i { display: inline-block; width: 16px; height: 2px; vertical-align: middle; margin-right: 0.4rem; }

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

.linklist { list-style: none; padding: 0; margin: 0.5rem 0; }
.linklist li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  flex-wrap: wrap;
  padding: 0.6rem 0.2rem;
  border-bottom: 1px solid var(--border);
  transition: padding-left 0.2s var(--ease), background 0.2s;
}
.linklist li:hover { padding-left: 0.6rem; background: var(--surface); }
.linklist li:last-child { border-bottom: none; }
.linklist.tight li { padding: 0.35rem 0.2rem; border-bottom: none; }
.linklist a { font-weight: 500; }

.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.25rem 0 2rem; }
.pills a {
  padding: 0.42rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: all 0.2s;
}
.pills a:hover {
  color: var(--text);
  border-color: var(--border-lit);
  background: var(--amber-glow);
}

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

.calc-form {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 1.4rem;
  margin: 1.5rem 0 2rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
}
.calc-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
}
.calc-form input {
  width: 8.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: rgba(4, 8, 14, 0.55);
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.calc-form input:focus {
  outline: none;
  border-color: var(--honey);
  box-shadow: 0 0 0 3px var(--amber-glow);
}
.calc-form button {
  padding: 0.62rem 1.4rem;
  border: none;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--honey-lt), var(--honey));
  color: #10161f;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
  box-shadow: 0 3px 18px rgba(255, 178, 41, 0.26);
}
.calc-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(255, 178, 41, 0.38);
}
.calc-form button:active { transform: translateY(0); }

/* ---------- rendered markdown ---------- */

.prose { max-width: 78ch; }
.prose > *:first-child { margin-top: 0; }
.prose h1 { font-size: clamp(1.7rem, 4vw, 2.2rem); margin: 0 0 1rem; }
.prose h2 {
  font-size: 1.32rem;
  margin: 2.5rem 0 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.prose h3 { font-size: 1.06rem; margin: 1.9rem 0 0.5rem; color: var(--honey-lt); }
.prose h2 { color: var(--text); }
.prose h4 { font-size: 0.95rem; margin: 1.4rem 0 0.4rem; color: var(--text-dim); }
.prose p { color: var(--text-dim); }
.prose strong { color: var(--text); font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.3rem; color: var(--text-dim); }
.prose li { margin: 0.3rem 0; }
.prose li::marker { color: var(--honey); }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose img { max-width: 100%; border-radius: var(--r); }
/* Markdown tables have no wrapper; let wide ones scroll instead of clipping. */
.prose table { font-size: 0.86rem; display: block; max-width: 100%; overflow-x: auto; }
.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.9rem 1.2rem;
  border-left: 2px solid var(--honey);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: linear-gradient(to right, var(--amber-glow), transparent 70%);
  color: var(--text-dim);
}
.prose blockquote > *:first-child { margin-top: 0; }
.prose blockquote > *:last-child { margin-bottom: 0; }
.prose pre {
  padding: 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: rgba(4, 8, 14, 0.6);
  overflow-x: auto;
  font-size: 0.83rem;
  line-height: 1.6;
}
.prose pre code { color: var(--text-dim); }
.prose :not(pre) > code {
  padding: 0.12em 0.4em;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.prose input[type="checkbox"] { accent-color: var(--honey); margin-right: 0.4rem; }

/* ---------- math (MathML) ---------- */

math { font-size: 1.06em; color: var(--text); }

/* Display equations get their own panel so formulas read as reference material. */
math.math-display {
  display: block;
  margin: 1.5rem 0;
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-left: 2px solid var(--honey);
  border-radius: 0 var(--r) var(--r) 0;
  background: linear-gradient(to right, var(--amber-glow), rgba(148, 170, 200, 0.03) 55%);
  font-size: 1.15em;
  text-align: center;
}

math.math-inline {
  padding: 0 0.1em;
  color: var(--honey-lt);
  white-space: nowrap;
}

/* Fallback when LaTeX fails to parse — visible, not silent. */
code.math-error {
  color: var(--rose);
  border-color: rgba(244, 114, 160, 0.4);
  background: rgba(244, 114, 160, 0.1);
}

/* collapsible doc panels */
details.panel {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  margin: 1rem 0;
  overflow: hidden;
}
details.panel > summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  list-style: none;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 600;
  transition: background 0.2s;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary:hover { background: var(--surface-2); }
details.panel > summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid var(--honey);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.25s var(--ease);
}
details.panel[open] > summary::before { transform: rotate(90deg); }
details.panel > .panel-body { padding: 0 1.25rem 1.25rem; }

/* ---------- 404 ---------- */

.center-pad { text-align: center; padding: 4rem 1rem; }

/* ---------- motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.rise { animation: rise 0.5s var(--ease) backwards; }
.rise:nth-child(1) { animation-delay: 0.04s; }
.rise:nth-child(2) { animation-delay: 0.09s; }
.rise:nth-child(3) { animation-delay: 0.14s; }
.rise:nth-child(4) { animation-delay: 0.19s; }
.rise:nth-child(5) { animation-delay: 0.24s; }
.rise:nth-child(6) { animation-delay: 0.29s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 0.7rem; }
  .topbar .brand { white-space: normal; }
  .topbar nav { justify-content: flex-start; overflow-x: auto; padding-bottom: 0.2rem; }
  .hero-stats { gap: 1.5rem; }
  .calc-form input { width: 100%; }
  .calc-form label { flex: 1 1 130px; }
  table { font-size: 0.82rem; }
  th, td { padding: 0.55rem 0.6rem; }
}

/* Gallery lightbox */
.photo.viewer-enabled { cursor: pointer; }
.photo.viewer-enabled:focus-visible { outline: 3px solid var(--honey); outline-offset: 3px; }
.photo.viewer-enabled .photo-video-preview video { pointer-events: none; }
.photo-video-preview { position: relative; }
.photo-play-overlay { display: none; }
.viewer-enabled .photo-play-overlay {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: grid; place-items: center; width: 72px; height: 72px;
  padding-left: 4px; border: 1px solid #ffffff80; border-radius: 50%;
  background: #0009; color: #fff; font-size: 2rem; pointer-events: none;
}
.viewer-enabled:hover .photo-play-overlay,
.viewer-enabled:focus-visible .photo-play-overlay { background: #000c; border-color: var(--honey); }
.viewer-open { overflow: hidden; }
.media-viewer {
  width: 98vw; max-width: 98vw;
  height: 98dvh; max-height: 98dvh;
  padding: 0; border: 1px solid #40516a; border-radius: 18px;
  background: #0b121d; color: var(--text); overflow: hidden;
  box-shadow: 0 30px 120px #000b;
}
.media-viewer::backdrop { background: #02060de8; backdrop-filter: blur(10px); }
.viewer-shell:fullscreen { width: 100vw; height: 100dvh; background: #0b121d; color: var(--text); }
.viewer-fullscreen { font-size: 1.5rem; }
.viewer-shell { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
.viewer-toolbar { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--border); }
.viewer-gallery { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-count { font-family: var(--mono); color: var(--honey); white-space: nowrap; }
.media-viewer button { background: #1c293a; color: var(--text); border: 1px solid #40516a; border-radius: 50%; cursor: pointer; width: 44px; height: 44px; flex: none; }
.media-viewer button:hover:not(:disabled) { background: #34465d; border-color: var(--honey); }
.media-viewer button:focus-visible { outline: 3px solid var(--honey); outline-offset: 3px; }
.media-viewer button:disabled { opacity: .25; cursor: default; }
.viewer-stage { position: relative; min-height: 0; display: flex; align-items: center; gap: .75rem; padding: 1rem; }
.viewer-prev, .viewer-next { font-size: 2rem; }
.viewer-media { height: 100%; min-width: 0; flex: 1; display: grid; place-items: center; }
.viewer-media img, .viewer-media video { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; border-radius: 6px; }
.viewer-media img { opacity: 0; transition: opacity .18s ease; }
.viewer-media img.loaded { opacity: 1; }
.viewer-info { margin: 0 auto; width: 100%; min-width: 0; text-align: center; padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: #121e2c; max-height: 25dvh; overflow-y: auto; }
.viewer-info p { margin: 0 0 .5rem; color: var(--text); font-size: 1rem; }
.viewer-date { font-size: .85rem; color: var(--honey); font-variant-numeric: tabular-nums; }
.viewer-hint { display: block; margin-top: .5rem; font-size: .75rem; color: var(--text-dim); }
.viewer-error { padding: 1rem; }
@media (max-width: 600px) {
  .media-viewer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  .viewer-toolbar { padding: .6rem .75rem; }
  .viewer-stage { padding: .5rem 0; gap: .2rem; }
  .media-viewer .viewer-prev, .media-viewer .viewer-next { width: 44px; height: 44px; border-radius: 6px; }
  .viewer-info { padding: .8rem 1rem; }
  .viewer-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .viewer-media img { transition: none; }
}
