/* ============================================================
   tokens.css — SOURCE, project-specific.
   Ironmonger's Loft — a converted Victorian ironmonger's warehouse,
   one apartment, city centre.

   Palette grounded in the building itself: oxidised structural
   steel, brass fittings salvaged from the old shopfront, poured
   concrete floors, warm filament light after dark.

   Convention: every project's tokens.css MUST define --accent as
   an alias to whichever named colour is the primary accent. Shared
   base rules (focus rings, link colour, etc.) key off --accent, not
   a project-specific name — so retheming never means hunting down
   every rule that quietly assumed one project's variable name.
   ============================================================ */

:root {
  /* ---- Named palette (the actual design decisions) ---- */
  --charcoal:  #201d1a;   /* primary text / near-black warm ink */
  --iron:      #4b5157;   /* structural grey-blue — steel beams */
  --rust:      #b5502e;   /* SIGNATURE accent — oxidised steel */
  --brass:     #ad8a4e;   /* secondary accent — salvaged fittings */
  --concrete:  #efe8de;   /* page background — warm poured concrete */
  --flint:     #d8d0c2;   /* mid neutral — borders, surfaces, rules */
  --ember:     #d97a4d;   /* lighter rust — hover states */
  --paper:     #faf7f2;   /* card surfaces, lighter than page bg */

  /* ---- Generic aliases — shared/base rules use ONLY these ---- */
  --accent:        var(--rust);
  --accent-hover:  var(--ember);
  --ink:           var(--charcoal);
  --ink-muted:     #6b645b;
  --bg:            var(--concrete);
  --bg-alt:        var(--paper);
  --bg-dark:       var(--charcoal);
  --border:        var(--flint);
  --border-strong: var(--iron);
  --error:         #a3342a;
  --success:       #3a6b4a;

  /* ---- Type ---- */
  --font-display: "Bebas Neue", "Archivo Narrow", sans-serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    "Space Mono", ui-monospace, monospace;

  --fs-h1:  clamp(2.75rem, 5vw + 1rem, 5.5rem);
  --fs-h2:  clamp(2rem, 3vw + 1rem, 3.25rem);
  --fs-h3:  clamp(1.35rem, 1.2vw + 1rem, 1.75rem);
  --fs-lede: clamp(1.05rem, 0.4vw + 1rem, 1.25rem);
  --fs-body: 1rem;
  --fs-small: 0.875rem;

  --lh-tight: 1.05;
  --lh-heading: 1.15;
  --lh-body: 1.6;

  /* ---- Spacing / radius / shadow ---- */
  --container-max: 72rem;
  --container-pad: clamp(1.5rem, 6vw, 5rem);

  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  --shadow-card: 0 12px 28px rgba(32, 29, 26, 0.14);
  --shadow-soft: 0 2px 10px rgba(32, 29, 26, 0.08);

  /* Height of the sticky nav — used by scroll-padding-top and by
     JS that needs to offset anchor jumps. Keep these in sync. */
  --nav-height: 4.5rem;
}
/* ============================================================
   base.css — SOURCE, reusable as-is across projects.
   Reset + element defaults + the small set of global fixes that
   past builds each rediscovered independently. Keep these baked
   in here so no future project has to relearn them.
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Sticky nav means every anchor jump (native fragment nav,
     scrollIntoView, tab links) needs this or the target lands
     underneath the nav bar. */
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img, picture, svg { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--lh-heading);
  letter-spacing: 0.01em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { text-wrap: pretty; }

a { color: inherit; text-decoration: none; }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

ul, ol { list-style: none; padding: 0; }

/* Visible keyboard focus everywhere, keyed off the generic
   --accent alias so it never silently falls back to the browser
   default on a project using a non-standard palette variable name. */
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
}

/* A shared flex/stack utility setting display:flex on its children
   silently beats the browser's own [hidden]{display:none} default
   for any element carrying both classes. Force it globally so
   [hidden] always actually hides, regardless of what utility
   classes an element also carries. */
[hidden] { display: none !important; }

/* Starting/end state for reveal.js. The class is added by JS, not
   assumed by CSS alone — see js/reveal.js for why. */
.reveal-pending { opacity: 0; transform: translateY(16px); }
.reveal-in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
/* ============================================================
   layout.css — SOURCE, reusable as-is across projects.
   Generic layout primitives. Rarely needs edits per project —
   check this table before writing fresh flex/grid for a new
   section: .container / .section / .stack / .cluster / .split /
   .grid-auto / .grid-fixed-3
   ============================================================ */

.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: clamp(3.5rem, 7vw, 7rem);
}
.section--alt   { background: var(--bg-alt); }
.section--dark  { background: var(--bg-dark); color: var(--paper); }
.section--dark h1, .section--dark h2, .section--dark h3 { color: var(--paper); }

/* Vertical rhythm between children. margin-top has no effect on
   inline elements — any project dropping bare <a> tags into a
   .stack (e.g. a footer link list) needs them block-level, so
   that's handled here once rather than per project. */
.stack > * + * { margin-top: var(--stack-gap, 1.25rem); }
.stack--tight  { --stack-gap: 0.6rem; }
.stack--loose  { --stack-gap: 2.5rem; }
.stack > a { display: block; }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, 1rem);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: center;
}
@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; }
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1.5rem;
}

/* Locked 3-column grid. Past bug: at tablet width this silently
   dropped to 2 columns via an intermediate breakpoint, orphaning
   the third card on its own row. Fixed at the primitive level —
   stay at 3 columns down to 640px, then go to 1. */
.grid-fixed-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
@media (max-width: 640px) {
  .grid-fixed-3 { grid-template-columns: 1fr; }
}

.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;
}
/* ============================================================
   components.css
   Nav / button / card / tab / form MECHANICS are reusable as-is.
   Colours, radius and the signature element (the rivet line) are
   specific to this project — swap those on a new build, keep the
   mechanics.
   ============================================================ */

/* ---------------- Nav ---------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
/* One wrapper, one flex row — bar and mobile panel are children of
   the SAME container, not separate siblings, or the bar's own
   items misalign against the panel below it. */
.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav__brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}
.nav__links {
  display: none;
  gap: 2rem;
  font-size: var(--fs-small);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.nav__links a { padding: 0.5rem 0; border-bottom: 2px solid transparent; }
.nav__links a:hover { border-color: var(--accent); }

.nav__toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
}
.nav__toggle span {
  width: 22px; height: 2px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile dropdown panel. Visibility is keyed off ONE mechanism —
   the .is-open class — and CSS and JS both agree on it. (Past bug:
   JS toggled inline style.display while CSS keyed visibility off a
   class driving transform/opacity — the two fell out of sync and
   the menu silently stopped working.) pointer-events: none is a
   deliberate second line of defence: even if the class logic ever
   regresses again, a hidden-but-still-rendered panel can never
   block input or scroll. */
.nav__panel {
  position: fixed;
  inset: var(--nav-height) 0 0 0;
  background: var(--bg-alt);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  padding: 2rem var(--container-pad);
  pointer-events: none;
}
.nav__panel.is-open {
  transform: translateX(0);
  pointer-events: auto;
}
.nav__panel .nav__links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 1.1rem;
}
.nav__panel .nav__links a { display: block; padding: 0.9rem 0; border-bottom: 1px solid var(--border); }

@media (min-width: 961px) {
  .nav__toggle { display: none; }
  .nav__links { display: flex; }
  .nav__panel { display: none; }
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center; /* prevents a stretched full-width button
                               from pinning its label to the left
                               inside a flex column */
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--fs-small);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn--primary { background: var(--accent); color: var(--paper); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--outline { border: 1.5px solid var(--border-strong); }
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }
.btn--block { width: 100%; }

/* ---------------- Cards / surfaces ---------------- */
.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

/* Data-plate style panel — used for the hero spec box and the
   booking summary. Mono type + rules, like a foundry stamp plate. */
.spec-plate {
  background: var(--charcoal);
  color: var(--paper);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-card);
}
.spec-plate__row {
  display: flex;
  justify-content: space-between;
  padding-block: 0.6rem;
  border-top: 1px solid rgba(250, 247, 242, 0.15);
  font-size: 0.85rem;
}
.spec-plate__row:first-child { border-top: none; }
.spec-plate__label { color: var(--flint); text-transform: uppercase; letter-spacing: 0.06em; }

/* ---------------- Hero ---------------- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: calc(100vh - var(--nav-height));
}
.hero__media {
  position: relative;
  background: linear-gradient(160deg, var(--iron) 0%, var(--charcoal) 100%);
  overflow: hidden;
}
.hero__media-label {
  position: absolute;
  inset: auto 1.5rem 1.5rem auto;
  color: var(--flint);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.7;
}
.hero__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.5rem;
  padding: clamp(2.5rem, 5vw, 5rem);
  position: relative;
}
.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero__lede { font-size: var(--fs-lede); color: var(--ink-muted); max-width: 32rem; }

/* The structural risk: the spec plate breaks the column boundary,
   overlapping the image edge rather than sitting neatly inside its
   own column. */
.hero__spec {
  margin-top: 1rem;
  max-width: 20rem;
}
@media (min-width: 961px) {
  .hero__spec { margin-left: -3.5rem; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero__media { min-height: 60vh; }
  .hero__spec { margin-left: 0; }
}

/* ---------------- Rivet line — signature element, used once ---------------- */
.rivet-line {
  display: block;
  width: 100%;
  height: 1.5rem;
  color: var(--border-strong);
}

/* ---------------- Tabs ---------------- */
.tabs__pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}
.tabs__pill {
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  font-size: var(--fs-small);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.tabs__pill[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}

/* Progressive enhancement: panels are hidden ONLY once JS has
   confirmed it's running (via the .js class on <html>, set by an
   inline script in <head> — see the top of index.html). Without
   this, a tab/accordion panel hidden by the `hidden` attribute
   alone is permanently unreachable if JS ever fails to run. */
html.js .tabs__panel[hidden] { display: none; }
html:not(.js) .tabs__panel {
  display: block !important;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
html:not(.js) .tabs__pills { display: none; }

/* ---------------- Amenities / facts ---------------- */
.fact {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--fs-small);
}
.fact svg { width: 1.1rem; height: 1.1rem; color: var(--accent); flex-shrink: 0; }

/* ---------------- Reviews ---------------- */
.review-card { display: flex; flex-direction: column; gap: 0.75rem; }
.review-card__stars { display: flex; gap: 0.2rem; color: var(--brass); }
.review-card__stars svg { width: 1rem; height: 1rem; }
.review-card__quote { font-size: var(--fs-lede); line-height: var(--lh-body); }
.review-card__meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-muted); }

/* ---------------- Forms (booking widget mechanics + contact form) ---------------- */
.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: var(--fs-small);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.field input,
.field textarea {
  width: 100%;         /* without this a field sizes to its own
                           intrinsic width inside a flex/grid column
                           and can push past the card edge */
  min-width: 0;         /* guards the same overflow class inside
                           any flex/grid ancestor */
  padding: 0.75rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  box-sizing: border-box;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

.error   { color: var(--error); font-size: var(--fs-small); }
.success { color: var(--success); font-size: var(--fs-small); font-weight: 600; }

/* ---------------- Admin shell (admin.html / calendar-help.html) ---------------- */
.admin-shell { max-width: 48rem; margin-inline: auto; padding: 3rem var(--container-pad) 5rem; }
.admin-login { max-width: 22rem; margin: 5rem auto; padding: 0 var(--container-pad); }
.admin-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 1.75rem;
}
.admin-card legend {
  font-family: var(--font-display);
  font-size: 1.15rem;
  padding: 0 0.4rem;
  letter-spacing: 0.01em;
}
.admin-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-small);
}
.admin-list li:last-child { border-bottom: none; }
.admin-list button {
  font-size: 0.8rem;
  text-decoration: underline;
  color: var(--error);
}

/* ---------------- Stay-booking-widget ----------------
   The widget markup sets its own --sw-* variables inline (mapped
   from this project's global tokens — see index.html) so retheming
   the site retheme the widget too, without a second set of colour
   decisions living in here. */
#stay-widget { max-width: 28rem; color: var(--sw-text); }
#stay-widget .sw-card {
  background: var(--sw-bg-card);
  border: 1.5px solid var(--sw-border);
  border-radius: var(--sw-radius-card);
  padding: 1.5rem;
}
#stay-widget .sw-title { font-family: var(--font-display); font-size: 1.4rem; margin: 0 0 0.25rem; }
#stay-widget .sw-rates { font-size: 0.85rem; color: var(--sw-text-muted); margin: 0 0 1.25rem; }
#stay-widget .sw-field { margin-bottom: 1rem; position: relative; }
#stay-widget label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--sw-text-muted); margin-bottom: 0.4rem; }
#stay-widget .sw-control {
  width: 100%;
  padding: 0.75rem;
  border: 1.5px solid var(--sw-border);
  border-radius: var(--sw-radius);
  background: var(--sw-bg-field);
  font-family: inherit;
  font-size: 1rem;
  color: var(--sw-text);
  box-sizing: border-box;
  cursor: pointer;
  text-align: left;
}
#stay-widget .sw-control:focus { outline: none; border-color: var(--sw-accent); }
#stay-widget .sw-calendar {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 0.4rem;
  background: var(--sw-bg-field);
  border: 1px solid var(--sw-border-light);
  border-radius: var(--sw-radius);
  box-shadow: var(--shadow-card);
  padding: 0.9rem;
  z-index: 20;
}
#stay-widget .sw-cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; font-weight: 700; }
#stay-widget .sw-cal-nav { background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 0.25rem 0.6rem; color: var(--sw-accent); }
#stay-widget .sw-cal-nav:hover { color: var(--sw-accent-hover); }
#stay-widget .sw-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.2rem; text-align: center; }
#stay-widget .sw-cal-day-name { font-size: 0.7rem; color: var(--sw-text-muted); padding: 0.25rem 0; }
#stay-widget .sw-cal-day {
  background: var(--sw-bg-field);
  border: 1px solid var(--sw-border-light);
  padding: 0.5rem 0;
  border-radius: calc(var(--sw-radius) * 0.6);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--sw-text);
}
#stay-widget .sw-cal-day:hover:not(:disabled) { background: var(--sw-bg-hover); }
#stay-widget .sw-cal-day:disabled { color: var(--sw-border); cursor: not-allowed; text-decoration: line-through; background: var(--sw-bg-hover); }
#stay-widget .sw-cal-day.in-range { background: var(--sw-bg-hover); }
#stay-widget .sw-cal-day.range-end { background: var(--sw-accent); border-color: var(--sw-accent); color: #fff; }
#stay-widget .sw-cal-day.empty { visibility: hidden; border: none; }
#stay-widget .sw-cal-hint { font-size: 0.78rem; color: var(--sw-text-muted); margin-top: 0.6rem; text-align: center; }
#stay-widget .sw-summary { background: var(--sw-bg-hover); border-radius: var(--sw-radius); padding: 0.9rem; margin-bottom: 1rem; font-size: 0.9rem; }
#stay-widget .sw-summary-row { display: flex; justify-content: space-between; margin-top: 0.35rem; }
#stay-widget .sw-summary-row:first-child { margin-top: 0; }
#stay-widget .sw-summary-total { font-weight: 700; border-top: 1px solid var(--sw-border-light); margin-top: 0.6rem; padding-top: 0.6rem; }
#stay-widget .sw-card-element { padding: 0.75rem; border: 1.5px solid var(--sw-border); border-radius: var(--sw-radius); background: var(--sw-bg-field); }
#stay-widget .sw-submit {
  width: 100%; padding: 0.85rem 0;
  background: var(--sw-accent); color: #fff; border: none;
  border-radius: var(--sw-radius); font-size: 1rem; font-weight: 600; cursor: pointer;
}
#stay-widget .sw-submit:hover { background: var(--sw-accent-hover); }
#stay-widget .sw-submit:disabled { opacity: 0.5; cursor: not-allowed; }
#stay-widget .sw-error { color: var(--sw-error); font-size: 0.85rem; margin-top: 0.75rem; }
#stay-widget .sw-success { color: var(--sw-success); font-size: 0.9rem; margin-top: 0.75rem; font-weight: 600; }

/* ---------------- Footer ---------------- */
.site-footer {
  background: var(--bg-dark);
  color: var(--flint);
  padding-block: 3rem;
}
.site-footer a:hover { color: var(--paper); }
.site-footer__bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(250, 247, 242, 0.12);
  font-size: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
}
