/* Theme variables: every colour, size and radius comes from here. */
@font-face { font-family: 'Manrope'; src: url('fonts/manrope-latin-wght-normal.woff2') format('woff2'); font-weight: 200 800; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Manrope'; src: url('fonts/manrope-latin-ext-wght-normal.woff2') format('woff2'); font-weight: 200 800; font-display: swap; unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF; }
@font-face { font-family: 'Instrument Serif'; src: url('fonts/instrument-serif-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
  --side-w: 288px;
  --side-min: 220px;
  --side-max: 440px;
  --content-w: 960px;
  --text-w: 40rem;
  --r: 10px;
  --r-sm: 6px;
  --gap: clamp(16px, 2vw, 24px);
  --pad: clamp(20px, 4vw, 56px);
  --t: 180ms cubic-bezier(.2, .7, .2, 1);
  --fs-body: 1.1875rem;   /* 19px */
  --fs-small: 1rem;
  --fs-lead: clamp(1.25rem, 1.1rem + .5vw, 1.5rem);
  --fs-h1: clamp(2.75rem, 2rem + 3vw, 4.5rem);
  --fs-h2: clamp(1.75rem, 1.4rem + 1.2vw, 2.375rem);
}
[data-theme='dark'] {
  --bg: #1b1c1e;
  --side-bg: #222326;
  --surface: #26272a;
  --surface-2: #303135;
  --line: #3a3b40;
  --ink: #eeece7;
  --muted: #a9a7a1;
  --accent: #d9b98a;
  --accent-ink: #1b1c1e;
  --danger: #f0a08f;
  --ok: #9fd3a8;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
[data-theme='light'] {
  --bg: #f3f1ed;
  --side-bg: #e9e6e0;
  --surface: #ffffff;
  --surface-2: #f6f4f0;
  --line: #d9d5cd;
  --ink: #1d1d1f;
  --muted: #5d5b56;
  --accent: #7c5c2e;
  --accent-ink: #ffffff;
  --danger: #a3341f;
  --ok: #2f6b3a;
  --shadow: 0 10px 30px -14px rgba(40, 30, 10, .25);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--fs-body)/1.6 var(--font); -webkit-font-smoothing: antialiased; }
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: -.01em; line-height: 1.05; margin: 0; text-wrap: balance; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
p { margin: 0; }
code { font-size: .9em; background: var(--surface-2); padding: .1em .4em; border-radius: var(--r-sm); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }

/* ---------- Shell: side menu + narrow centre ---------- */
.shell { display: flex; min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; width: var(--side-w); flex: none;
  display: flex; flex-direction: column; background: var(--side-bg); border-right: 1px solid var(--line);
  transition: margin-left var(--t), transform var(--t);
}
.side-closed .side { margin-left: calc(-1 * var(--side-w)); }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 20px 16px 16px 20px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand strong { display: block; font-size: 1rem; line-height: 1.25; font-weight: 700; }
.brand small { display: block; font-size: .875rem; color: var(--muted); }
.brand-mark { width: 30px; height: 30px; flex: none; border-radius: var(--r-sm); background:
  linear-gradient(135deg, transparent 0 46%, var(--accent-ink) 46% 54%, transparent 54%), var(--accent); }
.side-nav { flex: 1; overflow-y: auto; padding: 8px 12px; }
.nav-list, .nav-sub { list-style: none; margin: 0; padding: 0; }
.nav-list > li + li { margin-top: 2px; }
.nav-link {
  display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 10px 12px;
  border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: 600 1.0625rem/1.3 var(--font);
  text-decoration: none; text-align: left; cursor: pointer; transition: background var(--t), color var(--t);
}
.nav-link:hover { background: var(--surface-2); }
.nav-link.is-on { background: var(--surface); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.nav-parent svg { transition: transform var(--t); color: var(--muted); width: 18px; height: 18px; }
.nav-group.is-open .nav-parent svg { transform: rotate(90deg); }
.nav-sub { display: none; padding: 2px 0 8px 12px; margin-left: 12px; border-left: 1px solid var(--line); }
.nav-group.is-open .nav-sub { display: block; }
.nav-child { font-weight: 500; font-size: 1rem; min-height: 40px; padding: 8px 12px; color: var(--muted); }
.nav-child:hover { color: var(--ink); }
.side-foot { padding: 12px 12px 18px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.side-foot .who { font-size: .875rem; color: var(--muted); padding: 6px 12px; overflow-wrap: anywhere; }
.side-foot .who strong { color: var(--ink); font-weight: 600; }
.side-tool { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: 500 1rem var(--font); cursor: pointer; text-align: left; transition: background var(--t); }
.side-tool:hover { background: var(--surface-2); }
.side-resize { position: absolute; top: 0; right: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 5; }
.side-resize::after { content: ''; position: absolute; inset: 0 3px; background: transparent; transition: background var(--t); }
.side-resize:hover::after, .side-resize:focus-visible::after, .is-resizing .side-resize::after { background: var(--accent); }
.is-resizing { cursor: col-resize; user-select: none; }

.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); cursor: pointer; transition: background var(--t); flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.96); }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: none; align-items: center; gap: 8px; height: 60px; padding: 0 12px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.side-closed .topbar { display: flex; }
.topbar-title { font-weight: 600; font-size: 1rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.main { width: 100%; max-width: calc(var(--content-w) + 2 * var(--pad)); margin: 0 auto; padding: clamp(32px, 6vw, 72px) var(--pad) 96px; }
.scrim { display: none; }

/* ---------- Content ---------- */
.eyebrow { font-size: .875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.intro { max-width: var(--text-w); margin-bottom: clamp(28px, 4vw, 44px); }
.lead { font-size: var(--fs-lead); line-height: 1.5; color: var(--muted); margin-top: 18px; max-width: var(--text-w); }
.note { margin-top: 16px; font-size: var(--fs-small); color: var(--muted); padding-left: 14px; border-left: 2px solid var(--accent); max-width: var(--text-w); }
.lead.small { font-size: var(--fs-body); margin: 0 0 24px; }
.block { margin-top: clamp(56px, 8vw, 96px); }
.block > h2 { margin-bottom: 24px; }

.shot { display: block; overflow: hidden; border-radius: var(--r); background: var(--surface); cursor: zoom-in; }
.shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform 500ms cubic-bezier(.2, .7, .2, 1); }
.shot:hover img { transform: scale(1.025); }
.hero-shot { box-shadow: var(--shadow); }

.facts { list-style: none; padding: 0; margin: clamp(28px, 4vw, 40px) 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.facts li { border-top: 1px solid var(--line); padding-top: 14px; }
.facts strong { display: block; font: 400 clamp(2.25rem, 1.6rem + 2vw, 3.25rem)/1 var(--font-display); color: var(--ink); }
.facts span { display: block; margin-top: 8px; font-size: var(--fs-small); color: var(--muted); line-height: 1.4; }
.facts.small { margin: 24px 0 32px; grid-template-columns: repeat(3, 1fr); }

.card { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); transition: transform var(--t), border-color var(--t), box-shadow var(--t); }
a.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: var(--shadow); }
.homes { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.home { display: flex; flex-direction: column; gap: 10px; padding: 24px; }
.home-id { font: 400 3.5rem/1 var(--font-display); color: var(--accent); }
.home-meta { font-weight: 700; font-size: var(--fs-small); }
.home-layout { color: var(--muted); font-size: var(--fs-small); line-height: 1.5; flex: 1; }
.more { font-weight: 600; font-size: var(--fs-small); background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size var(--t); justify-self: start; width: max-content; }
a:hover .more { background-size: 100% 1px; }

.explore { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.tile { overflow: hidden; }
.tile img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform 500ms cubic-bezier(.2, .7, .2, 1); }
.tile:hover img { transform: scale(1.025); }
.tile-name { display: block; padding: 14px 18px 16px; font-weight: 600; font-size: 1.125rem; }

.gallery-lead { margin-bottom: var(--gap); }
.gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.pager { margin-top: clamp(40px, 6vw, 64px); display: flex; justify-content: flex-end; }

.facility-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(32px, 4vw, 48px) var(--gap); margin-top: clamp(40px, 5vw, 56px); }
.facility-group h2 { font-size: 1.625rem; margin-bottom: 12px; }
.facility-list { list-style: none; margin: 0; padding: 0; }
.facility-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.f-name { font-weight: 600; line-height: 1.4; }
.f-walk { color: var(--accent); font-weight: 600; font-size: var(--fs-small); white-space: nowrap; }
.f-dist { grid-column: 1; color: var(--muted); font-size: .9375rem; }

.videos { display: grid; gap: clamp(40px, 6vw, 64px); }
.video-item h2 { margin-bottom: 18px; font-size: 1.75rem; }
.video-item video { width: 100%; border-radius: var(--r); background: #000; aspect-ratio: 16 / 9; }

/* ---------- Buttons and forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 12px 22px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 1.0625rem/1 var(--font); text-decoration: none; cursor: pointer; transition: transform var(--t), background var(--t), border-color var(--t); }
.btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn-ghost { background: none; }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: .9375rem; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }

.form { display: grid; gap: 18px; }
.form label { display: grid; gap: 8px; font-weight: 600; font-size: 1rem; }
.form label small { font-weight: 400; color: var(--muted); }
input, select { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: 400 1.0625rem var(--font); transition: border-color var(--t), box-shadow var(--t); }
input:hover, select:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.form .btn { margin-top: 6px; }
.alert { margin: 20px 0 0; padding: 12px 16px; border-radius: var(--r-sm); border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); font-size: var(--fs-small); }

/* ---------- Gate ---------- */
.is-gate .gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.gate-art { position: absolute; inset: -40px; background: var(--gate-img) center / cover; opacity: .55; }
[data-theme='light'] .gate-art { opacity: .3; }
.gate-card { position: relative; width: 100%; max-width: 520px; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); border-radius: calc(var(--r) + 4px); padding: clamp(28px, 5vw, 48px); box-shadow: var(--shadow); }
.gate-card h1 { font-size: clamp(2.5rem, 2rem + 2vw, 3.5rem); }
.gate-card .lead { font-size: 1.125rem; margin-top: 14px; }
.gate-card .form { margin-top: 28px; }

/* ---------- Admin ---------- */
.admin h1 { font-size: clamp(2.25rem, 1.8rem + 2vw, 3.25rem); margin-bottom: 24px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; margin-bottom: 32px; }
.panel h2 { font-size: 1.625rem; margin-bottom: 18px; }
.form-grid { grid-template-columns: 1fr 1fr; align-items: end; }
.form-grid .btn { grid-column: 1 / -1; justify-self: start; }
.flash { margin-bottom: 24px; padding: 14px 18px; border-radius: var(--r-sm); border: 1px solid color-mix(in srgb, var(--ok) 45%, var(--line)); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.pin { font-size: 1.25em; letter-spacing: .15em; font-weight: 700; user-select: all; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .875rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.actions { display: flex; gap: 6px; flex-wrap: wrap; }
td.actions form { margin: 0; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .875rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill.on { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, var(--surface)); }
.empty { padding: 28px; border: 1px dashed var(--line); border-radius: var(--r); color: var(--muted); }
.inline-form { margin-bottom: 20px; max-width: 420px; }
.inline-form label { display: grid; gap: 8px; font-weight: 600; font-size: 1rem; }

/* ---------- Lightbox ---------- */
.lightbox { padding: 0; border: 0; background: rgba(8, 8, 9, .94); width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; }
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgba(8, 8, 9, .9); }
.lightbox img { max-width: calc(100vw - 32px); max-height: calc(100dvh - 120px); object-fit: contain; border-radius: var(--r-sm); }
.lb-btn { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); background: rgba(30, 30, 32, .7); color: #fff; cursor: pointer; transition: background var(--t), transform var(--t); }
.lb-btn:hover { background: rgba(60, 60, 64, .9); }
.lb-btn:active { transform: scale(.94); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; translate: 0 -50%; }
.lb-next { right: 16px; top: 50%; translate: 0 -50%; }
.lb-count { position: absolute; bottom: 20px; left: 50%; translate: -50% 0; color: #ddd; font-size: 1rem; font-variant-numeric: tabular-nums; }

/* ---------- Smaller screens ---------- */
@media (max-width: 1100px) { .homes { grid-template-columns: 1fr; } .home { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; } .home-id { font-size: 2.75rem; } .home-layout { flex-basis: 100%; } }
@media (max-width: 900px) {
  .topbar { display: flex; }
  .side { position: fixed; left: 0; top: 0; z-index: 40; width: min(86vw, 340px); transform: translateX(-100%); margin-left: 0 !important; box-shadow: var(--shadow); }
  .side-open .side { transform: none; }
  .side-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .5); }
  .side-resize { display: none; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .facts.small { grid-template-columns: repeat(3, 1fr); }
  .facility-groups { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --fs-body: 1.125rem; }
  .explore, .gallery { grid-template-columns: 1fr; }
  .pager .btn, .form .btn { width: 100%; }
  .lb-prev, .lb-next { top: auto; bottom: 8px; translate: none; }
  .lb-count { bottom: 24px; }
  td.actions { min-width: 260px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
