/* Gift Horse Coffee — one ink on cream, vintage roastery seal energy. */

:root {
  --ink: #3b2417;        /* dark roast brown */
  --cream: #f4ecdd;      /* paper / background */
  --paper: #efe5d2;      /* slightly deeper cream for sections */
  --paper-2: #e7d9bf;    /* deepest cream band */
  --muted: #6b513c;      /* softened ink for secondary text */
  --rule: #cbb795;       /* hairline borders */
  --accent: #9e3b2d;     /* brick red — sparing warm accent */
  --accent-2: #b5791f;   /* caramel/mustard */

  --serif: Georgia, "Times New Roman", "Hoefler Text", serif;
  --sans: "Helvetica Neue", Arial, system-ui, sans-serif;

  --wrap: 1080px;
  --radius: 4px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: #ebdcbc;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Fixed textured backdrop: yellowed butcher paper with scattered roasted beans
   and coffee-cup ring stains, under a 20% white veil to keep content legible. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: #ebdcbc;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.2)),
    url("/static/bg.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  pointer-events: none;
}

h1, h2, h3, .brand-name {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

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

p { margin: 0 0 1rem; }

code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  background: var(--paper-2);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--cream);
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.site-header {
  border-bottom: 2px solid var(--ink);
  background: rgba(244, 236, 221, 0.9);
  backdrop-filter: saturate(120%) blur(4px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--ink);
}
.brand-mark { display: block; }
.brand-words { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-size: 1.4rem; letter-spacing: 0.02em; }
.brand-sub {
  font-family: var(--sans);
  font-size: 0.62rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  font-size: 0.95rem;
}
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.03em;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--accent); }
.site-nav a.is-active { border-bottom-color: var(--ink); }
.site-nav a.btn.is-active { border-bottom-color: transparent; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  border: 2px solid var(--ink);
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--cream); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--cream); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--cream); }
.btn-nav { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.btn-block { width: 100%; text-align: center; }

.cta-row { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 1.4rem; }

.eyebrow {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

.lede { font-size: 1.25rem; color: var(--muted); }

.quiet-link { font-size: 0.9rem; letter-spacing: 0.03em; }

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero { padding: 3.5rem 0 2.5rem; }
.hero-inner {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 3rem;
  align-items: center;
}
.hero-badge { display: flex; justify-content: center; }
.hero-badge img { width: 100%; max-width: 320px; height: auto; filter: drop-shadow(0 6px 14px rgba(59, 36, 23, 0.18)); }
.hero-copy h1 { font-size: 3.4rem; margin: 0 0 0.6rem; }
.hero-copy .lede { margin-bottom: 1.2rem; }

/* ── Strip ─────────────────────────────────────────────────────────────── */
.strip { border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); background: var(--paper); }
.strip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; padding: 2.2rem 1.5rem; }
.strip-item h3 { margin: 0 0 0.4rem; font-size: 1.2rem; }
.strip-item p { margin: 0; color: var(--muted); font-size: 0.98rem; }

/* ── Sections ──────────────────────────────────────────────────────────── */
.featured { padding: 3rem 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.6rem;
  margin-bottom: 1.6rem;
}
.section-head h2 { font-size: 1.8rem; margin: 0; }

/* ── Roast cards ───────────────────────────────────────────────────────── */
.roast-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.roast-card {
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: 4px 4px 0 rgba(59, 36, 23, 0.12);
}
.roast-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; }
.roast-card h3 { margin: 0; font-size: 1.25rem; }
.roast-origin { font-size: 0.92rem; color: var(--muted); margin: 0.2rem 0 0.5rem; }
.roast-meta { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-2); margin: 0 0 0.7rem; }
.roast-notes { margin: 0; font-size: 0.98rem; }

.roast-level {
  flex: none;
  font-family: var(--sans);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  white-space: nowrap;
}
.roast-level--light { background: #f0d9a8; }
.roast-level--medium { background: #d9a86a; }
.roast-level--medium-dark { background: #a9713f; color: var(--cream); border-color: var(--cream); }
.roast-level--dark { background: var(--ink); color: var(--cream); border-color: var(--cream); }

/* ── Quote band ────────────────────────────────────────────────────────── */
.quote-band { background: var(--ink); color: var(--cream); padding: 2.6rem 0; }
.quote-band blockquote {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.8rem;
  font-style: italic;
  text-align: center;
}
.quote-band cite {
  display: block;
  font-size: 0.9rem;
  font-style: normal;
  letter-spacing: 0.06em;
  color: var(--paper-2);
  margin-top: 0.8rem;
  text-transform: uppercase;
}

/* ── Page head ─────────────────────────────────────────────────────────── */
.page-head { padding: 3rem 0 1.5rem; }
.page-head h1 { font-size: 2.8rem; margin: 0 0 0.6rem; }
.error-page { text-align: center; padding: 4rem 0; }
.error-page .cta-row { justify-content: center; }

/* ── Roast log list ────────────────────────────────────────────────────── */
.roast-list-section { padding-bottom: 3rem; }
.roast-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.roast-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.roast-row-day {
  font-family: var(--sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  font-weight: 700;
}
.roast-row-top { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.roast-row-body h2 { font-size: 1.4rem; margin: 0; }
.roast-row .roast-origin { margin: 0.3rem 0 0.5rem; }
.roast-row .roast-notes { margin: 0; }
.empty-state { color: var(--muted); font-style: italic; padding: 2rem 0; }
.list-cta { display: flex; align-items: center; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.list-cta p { margin: 0; font-family: var(--serif); font-size: 1.2rem; }

/* ── Prose / About ─────────────────────────────────────────────────────── */
.prose-section { padding-bottom: 3.5rem; }
.prose { max-width: 680px; }
.prose h2 { font-size: 1.6rem; margin: 2rem 0 0.6rem; }
.callout {
  margin-top: 2.5rem;
  border: 2px dashed var(--rule);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  background: var(--paper);
}
.callout-title {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0 0 0.5rem;
}
.callout p:last-child { margin: 0; }

/* ── Claim form ────────────────────────────────────────────────────────── */
.claim-section { padding-bottom: 3.5rem; }
.claim-wrap { max-width: 620px; }
.claim-form { display: flex; flex-direction: column; gap: 1.2rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.02em; }
.field .optional { font-weight: 400; color: var(--muted); text-transform: none; letter-spacing: 0; }
.field input, .field select, .field textarea {
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 3px solid var(--accent-2);
  outline-offset: 1px;
}
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--accent); }
.field-error { color: var(--accent); font-size: 0.88rem; margin: 0; font-weight: 600; }
.form-note { font-size: 0.85rem; color: var(--muted); margin: 0; }

.claim-success {
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 2rem;
  box-shadow: 5px 5px 0 rgba(59, 36, 23, 0.12);
}
.claim-success h2 { margin: 0 0 0.6rem; font-size: 1.8rem; }

/* ── Footer ────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 2px solid var(--ink);
  background: var(--paper);
  margin-top: 2rem;
  padding: 2.5rem 0;
}
.footer-inner { text-align: center; }
.footer-tagline { font-family: var(--serif); font-style: italic; font-size: 1.3rem; margin: 0 0 0.8rem; }
.footer-fine { max-width: 560px; margin: 0 auto 1rem; color: var(--muted); font-size: 0.92rem; }
.footer-meta {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  body { font-size: 17px; }
  .hero-inner { grid-template-columns: 1fr; gap: 1.8rem; text-align: center; }
  .hero-badge { order: -1; }
  .hero-badge img { max-width: 240px; }
  .hero-copy h1 { font-size: 2.6rem; }
  .cta-row { justify-content: center; }
  .strip-grid { grid-template-columns: 1fr; gap: 1.4rem; }
  .roast-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .site-nav { gap: 1rem; flex-wrap: wrap; font-size: 0.88rem; }
  .brand-name { font-size: 1.2rem; }
  .roast-row { grid-template-columns: 1fr; gap: 0.4rem; }
  .page-head h1 { font-size: 2.1rem; }
  .quote-band blockquote { font-size: 1.4rem; }
}

/* ── Auth / account / admin additions ──────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.nav-logout { display: inline; margin: 0; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.78rem; }
.btn-danger { background: var(--accent); color: var(--cream); border-color: var(--accent); }
.btn-danger:hover { background: var(--ink); border-color: var(--ink); }

/* Flash messages */
.flash-wrap { margin: 1.2rem auto 0; }
.flash { border: 2px solid var(--ink); border-radius: var(--radius); padding: 0.8rem 1.1rem; margin-bottom: 0.6rem; font-size: 0.95rem; word-break: break-word; }
.flash-error { background: #f3d9d2; border-color: var(--accent); }
.flash-success { background: #e6dcc0; }

/* Auth pages */
.auth-wrap { max-width: 460px; }
.auth-aside { margin-top: 1.2rem; text-align: center; }
.enroll-qr { text-align: center; margin-bottom: 1.4rem; }
.enroll-qr img { border: 2px solid var(--ink); border-radius: var(--radius); background: #fff; padding: 6px; }
.totp-secret code { font-size: 1rem; letter-spacing: 0.08em; }
.recovery-list { list-style: none; padding: 0; margin: 0 0 1.4rem; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.recovery-list li { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.55rem 0.7rem; text-align: center; }
.recovery-list code { font-size: 1rem; letter-spacing: 0.05em; }

/* Field rows */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

/* Account */
.account-section { padding-bottom: 3.5rem; }
.account-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; align-items: start; }
.account-side { display: flex; flex-direction: column; gap: 1.5rem; }
.account-card { background: var(--cream); border: 2px solid var(--ink); border-radius: var(--radius); padding: 1.4rem; box-shadow: 4px 4px 0 rgba(59,36,23,0.10); }
.account-card h2 { margin-top: 0; font-size: 1.3rem; }
@media (max-width: 860px) { .account-grid { grid-template-columns: 1fr; } }

/* Ratings / reviews */
.stars { color: var(--accent-2); letter-spacing: 0.08em; }
.rating-count { color: var(--muted); font-size: 0.85em; }
.roast-rating { margin: 0 0 0.5rem; }
.reviews-band { background: var(--paper); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); padding: 2.6rem 0; }
.section-head-plain { font-size: 1.6rem; margin: 0 0 1.4rem; }
.review-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
@media (max-width: 860px) { .review-grid { grid-template-columns: 1fr; } }
.review { margin: 0; background: var(--cream); border: 2px solid var(--ink); border-radius: var(--radius); padding: 1.1rem; }
.review-stars { margin: 0 0 0.4rem; font-size: 1.1rem; }
.review-text { font-family: var(--serif); font-style: italic; margin: 0 0 0.6rem; }
.review cite { font-size: 0.85rem; color: var(--muted); }

/* Roast claim controls */
.roast-claim { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; margin: 0.6rem 0; }
.roast-stock { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 0.2rem 0.55rem; border-radius: 999px; border: 1.5px solid var(--ink); }
.roast-stock.in { background: #e0d3a8; }
.roast-stock.out { background: var(--ink); color: var(--cream); }
.claim-inline { display: flex; gap: 0.5rem; margin: 0; align-items: center; }
.claim-inline select { padding: 0.4rem 0.6rem; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--cream); font-family: var(--sans); }
.roast-reviews { margin-top: 0.6rem; }
.roast-reviews summary { cursor: pointer; font-size: 0.85rem; color: var(--accent); }
.roast-review { font-size: 0.9rem; padding: 0.35rem 0; border-bottom: 1px dashed var(--rule); }
.review-by { color: var(--muted); }

/* Orders */
.orders-section { padding-bottom: 3.5rem; }
.order-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.order-card { background: var(--cream); border: 2px solid var(--ink); border-radius: var(--radius); padding: 1.2rem; }
.order-top { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.order-top h2 { margin: 0; font-size: 1.2rem; }
.order-meta { font-size: 0.9rem; color: var(--muted); margin: 0.3rem 0 0; }
.order-ship { font-size: 0.88rem; margin: 0.3rem 0 0; }
.order-reviewed { color: var(--accent-2); font-weight: 700; margin: 0.6rem 0 0; }
.review-form, .order-status-form { margin-top: 0.8rem; }
.order-status-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.order-status-form select, .order-status-form input { padding: 0.45rem 0.6rem; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--cream); font-family: var(--sans); }
.order-status-form input { flex: 1; min-width: 160px; }
.order-status { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; padding: 0.25rem 0.6rem; border-radius: 999px; border: 1.5px solid var(--ink); white-space: nowrap; }
.order-status--claimed { background: #e9d9b3; }
.order-status--packed { background: #d9a86a; }
.order-status--shipped { background: #a9713f; color: var(--cream); border-color: var(--cream); }
.order-status--delivered { background: #4f6b3a; color: var(--cream); border-color: var(--cream); }
.order-status--cancelled { background: var(--ink); color: var(--cream); border-color: var(--cream); }

/* Admin */
.admin-section { padding-bottom: 3.5rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.8rem; }
.stat { background: var(--cream); border: 2px solid var(--ink); border-radius: var(--radius); padding: 1.1rem; text-align: center; }
.stat-num { display: block; font-family: var(--serif); font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.admin-subhead { margin: 2.2rem 0 1rem; font-size: 1.4rem; }
.admin-form { max-width: 760px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th, .admin-table td { text-align: left; padding: 0.7rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.admin-table thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.admin-table .muted, .muted { color: var(--muted); font-size: 0.85em; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.row-actions form { margin: 0; }
.role-badge { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; border: 1.5px solid var(--ink); }
.role-admin { background: var(--accent); color: var(--cream); border-color: var(--accent); }
.role-member { background: var(--paper-2); }
.invite-status { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.invite-open { color: #4f6b3a; }
.invite-used { color: var(--muted); }
.invite-expired { color: var(--accent); }
