/* WineNotes design system — Phase 1.5.
   Own stylesheet, no build step, no Pico.css. One file, CSS variables,
   dark mode by default (designed as the primary look), light mode
   overridden via prefers-color-scheme so the app follows the phone's
   own setting — there is no in-app toggle. */

:root {
  --bg: #16110F;
  --card: #1E1815;
  --text: #F5F0E8;
  --text-secondary: #9C9088;
  --text-muted: #8C8078;
  --border: #2E2723;
  --border-field: #3A322C;
  --chip-active-bg: #2A1D1F;
  --chip-active-text: #D9A6AE;
  --chip-active-border: #7E2233;
  --wine: #7E2233;
  --gold: #C9A227;

  --radius-card: 8px;
  --radius-chip: 999px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", Times, serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #FAF7F2;
    --card: #FFFFFF;
    --text: #1A1512;
    --text-secondary: #6B615A;
    --text-muted: #857B72;
    --border: #E5DED5;
    --border-field: #D8CFC4;
    --chip-active-bg: #F7E9EC;
    --chip-active-text: #7E2233;
    --chip-active-border: #C99BA5;
    --wine: #7E2233;
    --gold: #8A6D14;
  }
}

/* ---------------------------------------------------------------------
   Reset & base
   --------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.5;
}

/* Two weights only, ever: 400 and 500. Browsers default many elements
   (strong, th, legend, summary, b) to 700 — override globally. */
strong, b, th, legend, summary {
  font-weight: 500;
}

h1, h2, h3, h4 {
  font-weight: 500;
  margin: 0 0 0.6rem 0;
  line-height: 1.25;
}
h1 { font-size: 23px; }
h2 { font-size: 21px; }
h3 { font-size: 19px; }
h4 { font-size: 15px; }

small, .label, label {
  font-size: 11px;
}

p { margin: 0 0 0.75rem 0; }

a {
  color: var(--wine);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1rem 0;
}

img { max-width: 100%; }

/* ---------------------------------------------------------------------
   Layout
   --------------------------------------------------------------------- */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem 1rem;
}

/* Desktop layer — the app is mobile-first, but a plain 720px column
   centered on a wide monitor reads as a stretched phone screen. Widen
   the reading column in steps as room appears; individual screens
   (wizard, archive, region profiles) refine this further below. */
@media (min-width: 768px) {
  .container {
    max-width: 760px;
    padding: 1.25rem 1.5rem 3rem 1.5rem;
  }
}
@media (min-width: 1200px) {
  .container {
    max-width: 860px;
  }
}

nav.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
nav.topnav .brand {
  font-size: 17px;
  font-weight: 500;
  color: var(--text);
}
nav.topnav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
nav.topnav a { color: var(--text-secondary); }
nav.topnav a:hover { color: var(--text); }

@media (min-width: 768px) {
  nav.topnav {
    padding: 1.1rem 0;
    margin-bottom: 1.75rem;
  }
  nav.topnav .brand { font-size: 19px; }
  nav.topnav ul { gap: 1.75rem; }
}

/* Log out is the least-used nav action — a plain, muted, discreet link,
   never a bordered button (that hierarchy belongs to "New tasting"). */
.nav-logout-link {
  width: auto;
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  color: var(--text-muted);
  cursor: pointer;
}
.nav-logout-link:hover { color: var(--text); filter: none; text-decoration: underline; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1rem;
  margin-bottom: 1rem;
}
.card > h3, .card > h4 {
  margin-top: 0;
}

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */

button, [role="button"], input[type="submit"] {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-card);
  border: 1px solid var(--wine);
  background: var(--wine);
  color: #F5F0E8;
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  width: 100%;
  margin: 0.35rem 0;
}
button:hover, [role="button"]:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.secondary, [role="button"].secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-field);
}
button.outline, [role="button"].outline {
  background: transparent;
  color: var(--wine);
  border: 1px solid var(--wine);
}
button.contrast {
  background: var(--gold);
  border-color: var(--gold);
  color: #1A1512;
}

/* Shared action-button pattern: one look for every screen's main action
   (.btn-primary — filled wine, full width) and its optional/alternative
   actions (.btn-secondary — same shape, outlined). Apply these classes
   instead of styling buttons per-screen, so new buttons stay consistent
   automatically. */
.btn-primary, .btn-secondary {
  display: inline-block;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-card);
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  margin: 0.35rem 0;
}
.btn-primary:hover, .btn-secondary:hover { filter: brightness(1.08); text-decoration: none; }
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  border: 1px solid var(--wine);
  background: var(--wine);
  color: #F5F0E8;
}
.btn-secondary {
  border: 1px solid var(--wine);
  background: transparent;
  color: var(--wine);
}

/* Buttons used inline (e.g. grape/wine result buttons, print) shouldn't
   stretch to full width like the primary wizard actions. */
.grape-result-btn, .wine-result-btn, .inline-btn {
  width: auto;
  display: inline-block;
}

/* ---------------------------------------------------------------------
   Forms
   --------------------------------------------------------------------- */

label {
  display: block;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0.85rem 0 0.3rem 0;
}
/* Labels wrapping a checkbox/radio (plain, non-chip options) stay
   inline and sentence case — the uppercase treatment above is for
   field labels above inputs, not option text. */
label:has(input[type="checkbox"]), label:has(input[type="radio"]) {
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 13px;
  margin: 0.25rem 0.75rem 0.25rem 0;
}

input[type="text"], input[type="search"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="file"], select, textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border-field);
  border-radius: var(--radius-card);
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
}
textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--wine);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%239C9088' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 0.85rem 0;
}

/* A search field that highlights while the taster is actively typing in
   it (grape search) — spec: "wyróżnionym obramowaniem gdy aktywna". */
input[type="search"]:focus {
  border-color: var(--wine);
  box-shadow: none;
}

.field-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin: -0.25rem 0 0.6rem 0;
  text-transform: none;
}
.field-error { color: var(--wine); }

/* Visually hides an element while keeping it in the accessibility tree and
   clickable via its associated <label> (e.g. the native file input behind
   a styled label-as-button). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------------
   Chips — used for filters, scale values, quality, BLIC overrides, and
   aroma descriptors. A chip is a label wrapping a checkbox/radio; the
   input itself is visually hidden but stays focusable/clickable.
   --------------------------------------------------------------------- */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.3rem 0 0.85rem 0;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-chip);
  border: 1px solid var(--border-field);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
  background: transparent;
  margin: 0;
  width: auto;
  white-space: nowrap;
  text-decoration: none;
}
.chip:hover { text-decoration: none; }
.chip input[type="radio"], .chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}
.chip.chip-active, .chip:has(input:checked) {
  background: var(--chip-active-bg);
  color: var(--chip-active-text);
  border-color: var(--chip-active-border);
}
.chip.chip-active.chip-gold, .chip.chip-gold:has(input:checked) {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold);
}
.chip.chip-overdue {
  background: transparent;
  color: var(--wine);
  border-color: var(--wine);
}

/* Filter chips (archive) are plain buttons/links, not checkbox chips. */
a.chip.chip-static, button.chip.chip-static {
  text-decoration: none;
}

/* ---------------------------------------------------------------------
   Disclosure widgets (aroma groups/clusters, "add new..." admin forms)
   — custom chevron, no browser marker.
   --------------------------------------------------------------------- */

details { margin-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
details:last-child { border-bottom: none; }

summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
}
summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }
summary::after {
  content: "\276F";
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 0.15s ease;
  transform: rotate(0deg);
  font-size: 11px;
  flex-shrink: 0;
}
details[open] > summary::after { transform: rotate(90deg); }

summary .count-chip {
  font-size: 11px;
  margin-left: auto;
}
summary:has(.count-chip)::after { margin-left: 0.5rem; }

/* "Add a new wine" is the second main path through step 0 (not a footnote):
   an outlined secondary button, not a plain disclosure link. */
details.new-wine-details { border-bottom: none; margin-bottom: 0.5rem; }
summary.new-wine-toggle {
  display: flex;
  justify-content: center;
}
summary.new-wine-toggle::after { margin-left: 0.5rem; color: var(--wine); }

.aroma-group-sub {
  color: var(--text-muted);
  font-weight: 400;
}

.aroma-descriptor-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.25rem 0 0.85rem 0;
}
.aroma-descriptor-list .chip { font-size: 11px; padding: 0.3rem 0.7rem; }

.aroma-pinned {
  min-height: 2rem;
  padding: 0.5rem 0;
  margin-bottom: 0.5rem;
}
.aroma-pinned em { color: var(--text-muted); font-style: normal; font-size: 11px; }
.aroma-chip {
  display: inline-flex;
  border: 1px solid var(--chip-active-border);
  background: var(--chip-active-bg);
  color: var(--chip-active-text);
  border-radius: var(--radius-chip);
  padding: 0.2rem 0.7rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
  font-size: 11px;
}

/* ---------------------------------------------------------------------
   Wizard progress indicator ("N / total" top right)
   --------------------------------------------------------------------- */

/* The SAT wizard and the rest of the "new tasting" flow are forms —
   width doesn't help them read better, so on wide screens they keep a
   comfortable, centered column instead of following the generic
   desktop widening above. */
@media (min-width: 768px) {
  body.wizard-body .container { max-width: 640px; }
}

.wizard-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.wizard-progress {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}
.wizard-meta-links {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 0.75rem 0;
}
.wizard-steps {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  font-size: 11px;
}
.wizard-steps a { color: var(--text-muted); }
.wizard-steps a[aria-current="step"] {
  color: var(--wine);
  font-weight: 500;
}

.save-status {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0.75rem 0;
}
.save-status .saved { color: var(--gold); }

/* ---------------------------------------------------------------------
   BLIC widget
   --------------------------------------------------------------------- */

.blic-widget h3 {
  font-size: 15px;
}
.blic-widget h3 small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
}

.blic-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.blic-row:last-of-type { border-bottom: none; }
.blic-row-label {
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  min-width: 90px;
}
.blic-row-value { flex: 1; }
.blic-source {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 0.15rem;
}

.blic-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.blic-total .blic-total-value {
  color: var(--gold);
  font-weight: 500;
  font-size: 17px;
}
.blic-decide {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 0.35rem;
}
.blic-warning {
  color: var(--wine);
  font-size: 11px;
}

/* ---------------------------------------------------------------------
   Tables (SAT value table in the note view)
   --------------------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}
table th {
  text-align: left;
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.75rem 0 0.3rem 0;
}
table td {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
table td:first-child {
  color: var(--text-secondary);
  text-align: left;
  width: 45%;
}
table td:last-child {
  text-align: right;
}

/* ---------------------------------------------------------------------
   Archive — row list
   --------------------------------------------------------------------- */

.archive-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
}
.archive-row:hover { text-decoration: none; background: var(--card); }
.archive-row.is-draft { opacity: 0.55; }

.archive-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--border);
}
.archive-thumb-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
}

/* Knowledge (/regions) list — appellation profiles sit indented under
   their parent region, prefixed with "Region -> Appellation" (spec: profile
   hierarchy must be visible without opening each row). */
.profile-row-appellation { padding-left: 1.25rem; }
.profile-hierarchy-parent { color: var(--text-muted); font-weight: 400; }

.archive-row-main { flex: 1; min-width: 0; }
.archive-row-info { min-width: 0; }
.archive-row-producer {
  font-weight: 500;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-row-sub {
  color: var(--text-secondary);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-row-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Archive on wide screens — more breathing room, and the row's producer
   / origin block and its colour-quality-date meta sit side by side
   instead of stacking, since there's finally width to spare. */
@media (min-width: 768px) {
  body.archive-body .container { max-width: 860px; }
}
@media (min-width: 1200px) {
  body.archive-body .container { max-width: 1080px; }
  body.archive-body .archive-row-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
  }
  body.archive-body .archive-row-meta { margin-top: 0; flex-shrink: 0; }
  body.archive-body .filter-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 768px) and (max-width: 1199px) {
  body.archive-body .filter-grid { grid-template-columns: repeat(3, 1fr); }
}

.colour-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wine);
}
.colour-dot.colour-white { background: var(--gold); }
.colour-dot.colour-rose { background: #C99BA5; }
.colour-dot.colour-red { background: var(--wine); }

.wine-thumb {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 0.4rem;
}

/* ---------------------------------------------------------------------
   Grape / wine type-ahead
   --------------------------------------------------------------------- */

.grape-result-list, .wine-result-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
  list-style: none;
  padding: 0;
}
.grape-result-btn {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border-field);
  color: var(--text);
}
.grape-alias-match {
  color: var(--chip-active-text);
}

.grape-chips-line { margin-bottom: 0.5rem; }
.grape-chips-line em { color: var(--text-muted); font-style: normal; }
.grape-chip { font-size: 13px; }
.grape-chip:not(:last-child)::after { content: ", "; }
.grape-chip-remove {
  width: auto;
  display: inline;
  background: none;
  border: none;
  color: inherit;
  padding: 0 0 0 0.15rem;
  margin: 0;
  cursor: pointer;
  font-weight: 500;
  font-size: 12px;
}

/* ---------------------------------------------------------------------
   Label photo
   --------------------------------------------------------------------- */

.label-photo-field { margin-bottom: 0.75rem; }
.label-photo-btn {
  text-transform: none;
  letter-spacing: normal;
}
.label-photo-btn small { color: var(--text-muted); font-size: 11px; }

.label-photo {
  max-width: 280px;
  width: 100%;
  height: auto;
  border-radius: var(--radius-card);
  margin: 0.75rem 0;
}
.label-photo-preview { margin-bottom: 0.5rem; }
.label-photo-confirm { color: var(--text-secondary); margin: 0 0 0.5rem 0; }
.label-photo-full {
  width: 100%;
  max-height: 60vh;
  object-fit: cover;
  border-radius: var(--radius-card);
  margin-bottom: 1rem;
  display: block;
}

/* ---------------------------------------------------------------------
   Tasting note prose — the one serif spot in the app
   --------------------------------------------------------------------- */

.prose-card .prose-text {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}
.prose-card .prose-text p {
  margin: 0 0 0.9em;
}
.prose-card .prose-text p:last-child {
  margin-bottom: 0;
}
.prose-card .prose-empty {
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 13px;
}
.prose-card .prose-error {
  color: var(--wine);
  font-size: 12px;
  font-family: var(--font-sans);
}
.prose-card .prose-text .ai-verify {
  font-style: italic;
  background: var(--chip-active-bg);
  border-radius: 4px;
  padding: 0 0.2rem;
}
.prose-card .prose-text .prose-pairing {
  margin-top: 1.2em;
  padding-top: 0.8em;
  border-top: 1px solid var(--border);
}
.prose-card .prose-text .prose-pairing-heading {
  display: block;
  font-family: var(--font-sans);
  font-weight: 600;
  text-decoration: underline;
  font-size: 13px;
  margin-bottom: 0.3em;
}
.prose-card .prose-ai-badge {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 0.4rem;
}
.prose-actions {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.prose-actions form {
  margin-bottom: 0.5rem;
}

/* ---------------------------------------------------------------------
   Login screen — full-bleed background image, form on a translucent
   dark overlay at the bottom.
   --------------------------------------------------------------------- */

body.login-body {
  margin: 0;
  min-height: 100vh;
}
.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background-size: cover;
  background-position: center;
}
.login-overlay {
  background: linear-gradient(to bottom, rgba(22, 17, 15, 0) 0%, rgba(22, 17, 15, 0.55) 35%, rgba(22, 17, 15, 0.92) 100%);
  padding: 3rem 1.25rem 1.75rem 1.25rem;
}
.login-brand {
  color: #F5F0E8;
  font-size: 23px;
  font-weight: 500;
  margin-bottom: 0.2rem;
}
.login-subtitle {
  color: #C9BEB4;
  font-size: 13px;
  margin-bottom: 1.5rem;
}
.login-overlay label { color: #C9BEB4; }
.login-overlay input {
  background: rgba(30, 24, 21, 0.75);
  border-color: rgba(245, 240, 232, 0.25);
  color: #F5F0E8;
}
.login-error {
  color: #E8A0AC;
  font-size: 12px;
  margin-bottom: 0.5rem;
}
.login-overlay .login-remember {
  color: #C9BEB4;
  margin: 0.5rem 0 1rem 0;
}

/* ---------------------------------------------------------------------
   Home screen ("Start a new tasting note") — button up top, wine glass
   photo centered in whatever vertical space is left below it. The photo
   box grows/shrinks with the viewport but always centers its own
   content, so the composition holds on any screen height.
   --------------------------------------------------------------------- */

body.start-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.start-body .container {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}
.start-hero {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.start-hero-photo {
  flex: 1 1 auto;
  min-height: 200px;
  margin-top: 1.5rem;
  border-radius: var(--radius-card);
  background-image: url('/static/img/login-bg.jpg');
  background-size: cover;
  background-position: center;
}

/* On a wide screen, letting the (portrait) photo keep growing to fill
   100vh of a narrow column is what made it read as a distorted vertical
   strip. From here up, switch to a text-left / photo-right layout with
   the photo capped at its own natural-ish proportions. */
@media (min-width: 900px) {
  body.start-body .container { max-width: 1040px; }
  .start-hero {
    flex-direction: row;
    align-items: center;
    gap: 3rem;
  }
  .start-hero-text { flex: 1 1 380px; }
  .start-hero-photo {
    flex: 0 0 340px;
    width: 340px;
    aspect-ratio: 900 / 1611;
    height: auto;
    max-height: 65vh;
    min-height: 0;
    margin-top: 0;
    align-self: center;
  }
}

/* ---------------------------------------------------------------------
   Full-bleed background photo — About only. Not the archive or the
   wizard: those are working screens, and the photo would push their
   content below the fold (task spec point 6).
   --------------------------------------------------------------------- */

body.hero-bg-body {
  min-height: 100vh;
  background-image: url('/static/img/login-bg.jpg');
  background-size: cover;
  background-position: center;
  position: relative;
}
body.hero-bg-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(to bottom, rgba(22, 17, 15, 0.55) 0%, rgba(22, 17, 15, 0.8) 100%);
  z-index: 0;
}
body.hero-bg-body .container { position: relative; z-index: 1; }
body.hero-bg-body h1, body.hero-bg-body h2, body.hero-bg-body h3, body.hero-bg-body h4,
body.hero-bg-body p, body.hero-bg-body li, body.hero-bg-body .brand a {
  color: #F5F0E8;
}
body.hero-bg-body .about-list li { border-bottom-color: rgba(245, 240, 232, 0.2); }
body.hero-bg-body nav.topnav { border-bottom-color: rgba(245, 240, 232, 0.2); }
body.hero-bg-body nav.topnav a, body.hero-bg-body .nav-logout-link { color: #C9BEB4; }
body.hero-bg-body nav.topnav a:hover, body.hero-bg-body .nav-logout-link:hover { color: #F5F0E8; }

/* ---------------------------------------------------------------------
   About page
   --------------------------------------------------------------------- */

.about-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}
.about-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
}

/* ---------------------------------------------------------------------
   Region profiles (Knowledge Builder, Etap 1) — a reading screen, so it
   gets a wider column and a desktop-first two-column layout (TOC sidebar +
   content) once there's room for it. On narrow screens it just stacks —
   spec: readable, but not optimised for phone.
   --------------------------------------------------------------------- */

body.profile-body .container {
  max-width: 1100px;
}

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.profile-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: flex-start;
}

/* This is a long-form reading screen (~40k characters, 40+ headings) — give
   it roomier line-height and paragraph/heading spacing than the compact
   default app type scale, on every viewport width, not just the desktop
   two-column layout below. */
.profile-content {
  font-size: 15px;
  line-height: 1.65;
}
.profile-content p {
  margin: 0 0 1.1em 0;
}
.profile-content h1 {
  font-size: 26px;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1rem;
}
.profile-content h2 {
  font-size: 21px;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}
.profile-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.profile-content h4 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 1.15rem;
  margin-bottom: 0.4rem;
}
.profile-content li {
  margin-bottom: 0.35rem;
}

@media (min-width: 900px) {
  .profile-layout {
    flex-direction: row;
  }
  .profile-toc {
    flex: 0 0 240px;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
  .profile-content {
    flex: 1;
    min-width: 0;
  }
  .profile-content {
    line-height: 1.75;
  }
  .profile-content h2 {
    font-size: 23px;
    margin-top: 2.2rem;
    padding-top: 1rem;
  }
  .profile-content h3 {
    font-size: 18px;
    margin-top: 1.6rem;
  }
}

.profile-toc {
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 0.75rem 1rem;
  width: 100%;
}
.profile-toc .toc,
.profile-toc .toc ul {
  list-style: none;
  padding-left: 0.85rem;
  margin: 0;
}
.profile-toc > .toc {
  padding-left: 0;
}
.profile-toc a {
  display: block;
  padding: 0.15rem 0;
  color: var(--text-secondary);
}
.profile-toc a:hover {
  color: var(--text);
  text-decoration: none;
}

.profile-content h2 {
  margin-top: 1.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.profile-content h3 {
  margin-top: 1.25rem;
}
.profile-content ul,
.profile-content ol {
  list-style-position: outside;
  padding-left: 1.5rem;
  margin: 0 0 0.9em 0;
}
.profile-content ul {
  list-style-type: disc;
}
.profile-content ol {
  list-style-type: decimal;
}
.profile-content blockquote {
  margin: 0 0 0.75rem 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--border-field);
  color: var(--text-secondary);
}

/* Markdown tables — full grid borders (spec: readable at ~42k characters),
   distinct from the plain SAT value table's bottom-border-only style above. */
.profile-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25em 0;
  font-size: 0.95em;
  border: 1px solid var(--border);
}
.profile-content th,
.profile-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.profile-content th {
  background: var(--card);
  font-weight: 600;
}

.md-upload-preview {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0.35rem 0 0.75rem 0;
}

/* [DO UZUPEŁNIENIA] — a gap the profile still owes the reader: dimmed,
   dashed border, so it reads as "missing", not as ordinary text. */
.profile-gap {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  font-style: italic;
  background: var(--card);
  border: 1px dashed var(--border-field);
  border-radius: 4px;
  padding: 0 0.4rem;
  font-size: 0.9em;
}

/* [S1] style citation markers — visible but out of the way of reading. */
.profile-source-ref {
  color: var(--text-muted);
  font-size: 0.75em;
  margin-left: 1px;
}

/* ---------------------------------------------------------------------
   Print — the note view as an A4 tasting card, always light, no chrome.
   --------------------------------------------------------------------- */

@media print {
  :root {
    --bg: #FFFFFF;
    --card: #FFFFFF;
    --text: #1A1512;
    --text-secondary: #444;
    --text-muted: #666;
    --border: #999;
    --border-field: #999;
    --gold: #8A6D14;
  }
  nav.topnav, .no-print {
    display: none !important;
  }
  body { background: #FFFFFF; }
  .container {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
  table td, table th {
    border: 1px solid #999;
    padding: 4px 8px;
  }
  .card, .blic-widget {
    border: 1px solid #999;
    break-inside: avoid;
  }
  h1 {
    font-size: 19px;
    margin-bottom: 0.3rem;
  }
  .label-photo-full {
    max-height: 30vh;
  }
  @page {
    size: A4;
    margin: 1.5cm;
  }
}

/* ---------------------------------------------------------------------
   Region profile diffs — re-import confirmation (spec item 2) and archival
   version comparison (spec item 3). Line-based, git-diff style coloring.
   --------------------------------------------------------------------- */

.diff-view {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 0.75rem 1rem;
  margin: 1rem 0 1.25rem 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.diff-line {
  padding: 0 0.25rem;
}
.diff-equal {
  color: var(--text-secondary);
}
.diff-added {
  background: rgba(80, 160, 80, 0.15);
  color: var(--text);
}
.diff-removed {
  background: rgba(200, 70, 70, 0.15);
  color: var(--text);
  text-decoration: line-through;
  text-decoration-color: rgba(200, 70, 70, 0.5);
}
.diff-collapsed {
  color: var(--text-muted);
  font-style: italic;
  padding: 0.25rem;
  text-align: center;
}
