/* ====================================================================
   The Coffee Review — design system
   Editorial / print-magazine feel: warm paper tones, a serif display
   face for headlines, hairline rules instead of boxed cards-with-shadows,
   restrained color. Deliberately avoids glassmorphism, purple gradients,
   big rounded pills and emoji-as-icons.
   ==================================================================== */

:root {
  --cream: #f6f1e7;
  --paper: #fffcf6;
  --ink: #2a2017;
  --ink-soft: #5c5047;
  --espresso: #3c2a1e;
  --rust: #a8502e;
  --rust-dark: #823d23;
  --gold: #b8863f;
  --line: #e2d5bf;
  --line-strong: #cdbb9b;
  --green: #4a6b4d;
  --max-width: 1140px;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Self-hosted fonts — loaded from our own domain, never from Google's
   servers, so a visitor's IP is never sent to a third party just to render
   text. Both files cover the weights used across the site. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../fonts/fraunces-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* the .band full-bleed trick (100vw) can overshoot when a scrollbar is present */
}

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

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--espresso);
  margin: 0 0 0.4em;
  line-height: 1.15;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Masthead ---------- */

.masthead {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.masthead__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.masthead__logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--espresso);
  letter-spacing: -0.01em;
}

.masthead__logo span { color: var(--rust); }

.masthead__brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.masthead__logo-img {
  display: block;
  height: 60px;
  width: auto;
}

.masthead__nav {
  display: flex;
  gap: 28px;
  align-items: center;
}

.masthead__nav a {
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.masthead__nav a:hover { color: var(--rust-dark); text-decoration: none; }

/* Hamburger toggle — hidden on desktop, shown under the mobile breakpoint below */
.masthead__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.masthead__toggle span {
  display: block;
  height: 2px;
  background: var(--espresso);
  border-radius: 1px;
}

.masthead__rule {
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  height: 3px;
  background: var(--ink);
  margin: 0;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid var(--espresso);
  background: var(--espresso);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
}

.btn:hover { background: var(--rust-dark); border-color: var(--rust-dark); text-decoration: none; }

.btn--ghost {
  background: transparent;
  color: var(--espresso);
}

.btn--ghost:hover { background: var(--espresso); color: var(--paper); }

.btn--small { padding: 7px 14px; font-size: 0.82rem; }

.btn--danger { border-color: var(--rust); background: transparent; color: var(--rust); }
.btn--danger:hover { background: var(--rust); color: var(--paper); }

.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Hero ---------- */

.hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--line);
}

.hero h1 {
  font-size: 2.6rem;
  max-width: 640px;
}

.hero p {
  max-width: 560px;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.hero__actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* Full-bleed background band — breaks out of the parent .container's max
   width so alternating sections read as distinct blocks, like the masthead.
   The inner .container re-establishes normal content width inside it. */
.band {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 40px 0;
}

.band + .band {
  border-top: none; /* adjacent bands share one hairline, not a double rule */
}

/* ---------- View toggle ---------- */

.view-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--espresso);
  border-radius: 3px;
  overflow: hidden;
  width: fit-content;
}

.view-toggle button {
  padding: 8px 18px;
  background: var(--paper);
  border: none;
  border-right: 1px solid var(--espresso);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--espresso);
  cursor: pointer;
}

.view-toggle button:last-child { border-right: none; }
.view-toggle button.active { background: var(--espresso); color: var(--paper); }

/* ---------- Filters ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin: 28px 0;
}

.filters select, .filters input {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  border-radius: 3px;
  color: var(--ink);
}

.filters select:focus, .filters input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.filters input[type="search"] { min-width: 220px; flex: 1 1 220px; }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin: 32px 0 8px;
}

.pagination button:disabled { opacity: 0.4; cursor: default; }

.pagination__status { font-size: 0.85rem; color: var(--ink-soft); }

/* Bare selects used outside .filters (e.g. the top-picks rating filter) */
select {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  border-radius: 3px;
  color: var(--ink);
}

/* ---------- Cafe list ---------- */

.cafe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}

.cafe-card {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
  padding-right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cafe-card__image {
  width: 100%;
  height: 170px;
  object-fit: cover;
  background: var(--line);
  border: 1px solid var(--line);
}

.cafe-card__name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--espresso);
}

.cafe-card__rating {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--espresso);
}

.cafe-card__rating span {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--ink-soft);
}

.cafe-card__suburb {
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cafe-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.stars { color: var(--gold); letter-spacing: 1px; font-size: 0.95rem; }
.star--empty { color: var(--line-strong); }

.value-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 2px;
  border: 1px solid currentColor;
}

.value-badge--great { color: var(--green); }
.value-badge--fair { color: var(--gold); }
.value-badge--low { color: var(--rust); }

.cafe-card__price {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- Map ---------- */

#map {
  height: 560px;
  width: 100%;
  border: 1px solid var(--line);
  filter: saturate(0.85);
}

.leaflet-popup-content {
  font-family: var(--font-body);
}

.map-popup h4 {
  margin: 0 0 4px;
  font-size: 1rem;
}

/* ---------- Cafe detail page ---------- */

.cafe-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  padding: 44px 0;
  border-bottom: 1px solid var(--line);
}

.cafe-hero__image {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.cafe-gallery {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.cafe-gallery__thumb {
  padding: 0;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  line-height: 0;
}

.cafe-gallery__thumb img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--line);
}

.cafe-gallery__thumb.is-active {
  border-color: var(--rust);
}

.cafe-gallery__thumb.is-active img {
  border-color: var(--rust);
}

.cafe-hero__suburb {
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.cafe-hero__rating {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
}

.cafe-hero__rating .stars { font-size: 1.2rem; }

.cafe-hero__score {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--espresso);
  margin-top: 10px;
}

.cafe-hero__score span {
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--ink-soft);
}

/* A boxed, self-contained value score — the $/star figure plus its
   plain-language tier, used on café cards and the café detail hero. */
.value-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 8px 12px;
  margin-top: 10px;
}

.value-box__amount {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--espresso);
}

.value-box__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.value-box.value-badge--great { border-color: var(--green); }
.value-box.value-badge--great .value-box__label { color: var(--green); }
.value-box.value-badge--fair { border-color: var(--gold); }
.value-box.value-badge--fair .value-box__label { color: var(--gold); }
.value-box.value-badge--low { border-color: var(--rust); }
.value-box.value-badge--low .value-box__label { color: var(--rust); }

.pull-review {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--espresso);
  border-left: 3px solid var(--rust);
  padding-left: 18px;
  margin: 18px 0;
}

.byline {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.price-table th, .price-table td {
  text-align: left;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.price-table th {
  color: var(--ink-soft);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.price-table tr.is-benchmark td { font-weight: 700; color: var(--rust-dark); }

.value-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 22px;
  margin: 24px 0;
}

.value-panel__score {
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--rust-dark);
}

.section {
  padding: 40px 0;
  border-bottom: 1px solid var(--line);
}

.section h2 {
  font-size: 1.5rem;
}

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

.review {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.review__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.review__author { font-weight: 600; }
.review__date { font-size: 0.8rem; color: var(--ink-soft); }

.review-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 480px;
}

.review-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.review-form textarea, .review-form input, .review-form select {
  font-family: var(--font-body);
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  border-radius: 3px;
  font-size: 0.95rem;
}

.star-picker {
  display: flex;
  gap: 4px;
  font-size: 1.6rem;
  color: var(--line-strong);
  cursor: pointer;
}

.star-picker .star--active { color: var(--gold); }

/* ---------- Forms (login / admin) ---------- */

.auth-panel, .admin-panel {
  max-width: 480px;
  margin: 60px auto;
  padding: 36px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.admin-panel.admin-panel--wide { max-width: 720px; }

.form-row {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.form-row input, .form-row textarea, .form-row select {
  font-family: var(--font-body);
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  font-size: 0.95rem;
  width: 100%;
}

.form-row textarea { min-height: 90px; resize: vertical; }

.form-error {
  color: var(--rust);
  font-size: 0.85rem;
  min-height: 1.2em;
}

.form-note {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 16px;
}

.coffee-row {
  display: grid;
  grid-template-columns: 1fr 100px 32px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.coffee-row button {
  background: none;
  border: none;
  color: var(--rust);
  cursor: pointer;
  font-size: 1.1rem;
}

.admin-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.admin-list-item__actions { display: flex; gap: 8px; }

.tabs { display: flex; gap: 6px; margin-bottom: 24px; }
.tabs button {
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
}
.tabs button.active { background: var(--espresso); color: var(--paper); border-color: var(--espresso); }

/* ---------- Modal (report inaccurate info) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 32, 23, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 28px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}

/* ---------- Menu tag library (admin) ---------- */

.tag-btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  margin: 0 8px 8px 0;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}

.tag-btn.selected {
  background: var(--espresso);
  border-color: var(--espresso);
  color: var(--paper);
}

.tag-btn__delete {
  margin-left: 8px;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1;
}

.tag-btn.selected .tag-btn__delete { color: var(--line); }

.tag-btn__delete:hover { color: var(--rust); }

.menu-item-block {
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 14px;
}

.menu-item-block__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.size-row {
  display: grid;
  grid-template-columns: 70px 1fr 32px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.size-row input[type="text"] {
  text-transform: uppercase;
}

/* ---------- Ad slot (placeholder, wired up later) ---------- */

.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 32px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; /* safety net if an ad iframe ever renders wider than its slot */
}

.ad-slot__label {
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 36px 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 20px;
  line-height: 1.7;
}

/* ---------- Misc ---------- */

.empty-state {
  padding: 60px 0;
  text-align: center;
  color: var(--ink-soft);
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  padding: 20px 0;
}

.loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--rust);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Slim top-of-page progress bar shown on page load and on internal nav clicks */
#page-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--rust), var(--gold));
  z-index: 9999;
  opacity: 0;
  transition: width 0.25s ease, opacity 0.2s ease;
}

#page-progress.is-active { opacity: 1; }

.pill-link {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.visually-hidden {
  position: absolute;
  left: -9999px;
}

@media (max-width: 760px) {
  .masthead__top { position: relative; }
  .masthead__toggle { display: flex; }
  .masthead__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 16px 24px 22px;
    z-index: 20;
  }
  .masthead__nav.is-open { display: flex; }
  .cafe-hero { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
