/* ---------------------------------------------------------------------------
   Loyal Hood Coffee palette.

   Three brand colours: navy, gold, brick, sampled directly from the brand
   sheet in brand-assets/brand-sheet.jpeg. Every colour on every page
   resolves through these tokens, so this block is the only place to edit.

   Contrast rules worth keeping:
   - Gold on cream is far too low-contrast for text. Gold is for fills,
     dots, and accents only; navy is the text workhorse.
   - In dark mode the roles swap to gold-on-navy, which is a pairing the
     brand sheet already uses, so dark mode is on-brand by design.
--------------------------------------------------------------------------- */
:root {
  --navy: #092d45;
  --gold: #f3bf59;
  --brick: #a9403c;

  --ink: #13293a;           /* body text */
  --brand: var(--navy);     /* primary actions, links, focus */
  --brand-dark: #04202f;    /* primary hover */
  --on-brand: #ffffff;      /* text on a --brand fill */
  --accent: var(--gold);    /* availability dots, highlights */

  --cream: #fbf6ec;         /* page background */
  --card: #ffffff;
  --line: #e8dfcf;
  --muted: #7c7268;

  --ok: var(--navy);        /* confirmation text */
  --ok-bg: #fbefd5;         /* gold tint behind confirmations */
  --taken: var(--brick);

  --shadow: 0 1px 2px rgba(9, 45, 69, .07), 0 8px 24px rgba(9, 45, 69, .09);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2e9da;
    --brand: var(--gold);   /* gold carries the actions on navy */
    --brand-dark: #e0ad45;
    --on-brand: #092d45;    /* navy text on a gold button */
    --accent: var(--gold);

    --cream: #08202f;
    --card: #10303f;
    --line: #21475c;
    --muted: #9dafbd;

    --ok: var(--gold);
    --ok-bg: #163a4d;
    --taken: #e58b85;

    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 32px 20px 72px; }

/* ---- header ---- */
header { margin-bottom: 28px; }
header h1 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.02em; }
header p { margin: 0; color: var(--muted); }
.badge {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 10px;
}

/* ---- generic surfaces ---- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.range { font-weight: 600; }

/* ---- buttons ---- */
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px;
  display: inline-block; text-decoration: none; text-align: center;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 9px 14px; transition: background .15s, border-color .15s, opacity .15s;
}
button:hover:not(:disabled), .btn:hover { border-color: var(--brand); }
button:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary, button.primary {
  background: var(--brand); border-color: var(--brand); color: var(--on-brand);
}
.btn-primary:hover, button.primary:hover:not(:disabled) { background: var(--brand-dark); }

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

.btn-link {
  background: none; border: none; padding: 0; color: var(--brand);
  text-decoration: underline; font-weight: 600;
}

/* ---- day list ---- */
.day { border-top: 1px solid var(--line); padding: 18px 20px; }
.day:first-child { border-top: none; }
.day-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.day-head h2 { font-size: 16px; margin: 0; }
.day-head .count { font-size: 13px; color: var(--muted); }
.today-tag {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  background: var(--ok-bg); color: var(--ok); padding: 2px 7px; border-radius: 20px;
}

.slots { display: flex; flex-wrap: wrap; gap: 8px; }

.slot {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 10px; padding: 9px 13px; font-size: 14px; font-weight: 600;
  font-variant-numeric: tabular-nums; cursor: pointer;
}
.slot:hover { border-color: var(--brand); background: var(--ok-bg); }
.slot[data-status="open"]::before {
  content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); margin-right: 7px; vertical-align: middle;
}
.slot[disabled] {
  cursor: not-allowed; opacity: .45; text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.slot[data-status="booked"], .slot[data-status="blocked"] { text-decoration: line-through; }

.closed-note, .empty-note { color: var(--muted); font-size: 14px; margin: 0; }

/* ---- form ---- */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input, textarea {
  font: inherit; width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--cream); color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
textarea { resize: vertical; min-height: 72px; }
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; }
.optional { color: var(--muted); font-weight: 400; }

/* ---- dialog ---- */
dialog {
  border: none; padding: 0; border-radius: var(--radius); background: var(--card);
  color: var(--ink); box-shadow: var(--shadow); width: min(440px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(46, 38, 34, .45); backdrop-filter: blur(2px); }
.dialog-body { padding: 24px; }
.dialog-body h2 { margin: 0 0 4px; font-size: 20px; }
.dialog-when {
  color: var(--brand); font-weight: 700; margin: 0 0 18px;
}
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ---- messages ---- */
.msg { border-radius: 10px; padding: 11px 14px; font-size: 14px; margin: 0 0 14px; }
.msg-error { background: #fbeae9; color: #8e2f2c; border: 1px solid #edc4c2; }
.msg-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid currentColor; }
@media (prefers-color-scheme: dark) {
  .msg-error { background: #3b2422; color: #f0b3af; border-color: #5e3733; }
}

/* ---- success panel ---- */
.success { text-align: center; padding: 40px 24px; }
.success .tick {
  width: 52px; height: 52px; border-radius: 50%; background: var(--ok-bg);
  color: var(--ok); display: grid; place-items: center; margin: 0 auto 16px;
  font-size: 26px; font-weight: 700;
}
.success h2 { margin: 0 0 6px; font-size: 22px; }
.success .when { font-size: 18px; font-weight: 700; color: var(--brand); margin: 0 0 4px; }

.detail-list { list-style: none; padding: 0; margin: 18px 0; font-size: 14px; }
.detail-list li { padding: 7px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; }
.detail-list li:first-child { border-top: none; }
.detail-list .k { color: var(--muted); }
.detail-list .v { font-weight: 600; text-align: right; }

footer { margin-top: 28px; text-align: center; color: var(--muted); font-size: 13px; }
footer a { color: var(--muted); }

.skeleton { padding: 40px; text-align: center; color: var(--muted); }

/* ---- admin ---- */
.admin-row {
  display: flex; align-items: center; gap: 14px; padding: 13px 20px;
  border-top: 1px solid var(--line); flex-wrap: wrap;
}
.admin-row:first-child { border-top: none; }
.admin-row.is-past { opacity: .5; }
.admin-row.is-cancelled .who .name { text-decoration: line-through; }
.admin-when { min-width: 190px; font-weight: 700; font-variant-numeric: tabular-nums; }
.admin-who { flex: 1; min-width: 180px; }
.admin-who .who { font-weight: 600; }
.admin-who .contact, .admin-notes { font-size: 13px; color: var(--muted); }
.admin-notes { flex-basis: 100%; }
.tag {
  display: inline-block;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 8px; border-radius: 20px; background: var(--line); color: var(--muted);
}
.tag-blocked { background: var(--line); }
.section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin: 28px 0 10px;
}
.login-wrap { max-width: 380px; margin: 12vh auto; padding: 0 20px; }

@media (max-width: 560px) {
  .wrap { padding: 24px 14px 56px; }
  .range { order: -1; flex-basis: 100%; text-align: center; }
  .toolbar > button { flex: 1; }
  header h1 { font-size: 25px; }
  .field-row { flex-direction: column; gap: 0; }
  .admin-when { min-width: 100%; }
}

/* ---- brandmark -------------------------------------------------------- */
/* Shown as type until a real logo file is dropped into public/brand/,
   at which point brand.js swaps the image in and removes the wordmark. */
.brandmark {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit; margin-bottom: 14px;
}
.brandmark-logo { height: 62px; width: auto; display: block; }
/* display:block above would otherwise defeat the hidden attribute, leaving a broken-image icon until a logo file exists. */
.brandmark-logo[hidden] { display: none; }
.brandmark-name {
  display: block; font-size: 19px; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: var(--brand); line-height: 1.05;
}
.brandmark-tag {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; color: var(--muted); margin-top: 4px;
}
/* The gold rule echoes the arch stroke on the badge without imitating it. */
.brandmark-text { border-left: 3px solid var(--accent); padding-left: 12px; }

@media (max-width: 560px) {
  .brandmark-logo { height: 48px; }
  .brandmark-name { font-size: 16px; letter-spacing: .1em; }
  .brandmark-tag { font-size: 9px; }
}
