@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #767267;
  --border: #e8e4df;
  --accent: #8b7355;
  --surface: #f7f5f2;
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font-body); color: var(--text); background: var(--bg); line-height: 1.6; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 600; margin: 0 0 .5em; line-height: 1.2; }
a { color: inherit; }
img { max-width: 100%; display: block; }

.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 1rem; }

.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 6px;
  font-family: var(--font-body); font-size: .95rem; margin-bottom: 12px; background: #fff; color: var(--text);
}
.form-label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 4px; color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: 6px; border: 1.5px solid transparent; cursor: pointer;
  font-family: var(--font-body); font-size: .9rem; font-weight: 500; text-decoration: none; transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--text); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-danger { background: #fff; border-color: #d9534f; color: #d9534f; }
.btn-sm { padding: 6px 12px; font-size: .82rem; }

/* ---------------- Auth ---------------- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; padding: 40px 36px; background: #fff; border: 1px solid var(--border); border-radius: 12px; text-align: center; }
.auth-logo { font-family: var(--font-heading); font-size: 1.3rem; margin-bottom: 20px; }
.auth-error { color: #c0392b; font-size: .88rem; margin-bottom: 12px; }
.auth-card form { text-align: left; margin-top: 20px; }
.auth-card .btn { width: 100%; }

/* ---------------- Admin shell ---------------- */
.admin-shell { display: flex; min-height: 100vh; }
/* The page editor locks to the viewport height so its palette/canvas/settings
   panels scroll internally instead of the whole page growing and scrolling. */
.admin-page-fullbleed, .admin-page-fullbleed .admin-shell { height: 100vh; overflow: hidden; }
.admin-nav {
  width: 220px; flex-shrink: 0; background: #1a1714; color: #fff; display: flex; flex-direction: column;
  padding: 20px 16px; gap: 4px;
}
.admin-nav-brand { font-family: var(--font-heading); font-size: 1.1rem; margin-bottom: 20px; color: #fff; }
.admin-nav-link { color: #cfc9c0; text-decoration: none; padding: 8px 10px; border-radius: 6px; font-size: .9rem; }
.admin-nav-link:hover, .admin-nav-link.active { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav-spacer { flex: 1; }
.admin-nav-user { color: #8a8478; font-size: .8rem; padding: 0 10px; }
.admin-content { flex: 1; padding: 32px 40px; overflow-x: auto; min-height: 0; }
.admin-page-fullbleed .admin-content { padding: 0; display: flex; flex-direction: column; overflow: hidden; }

.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.admin-new-page-form { display: flex; gap: 8px; }
.admin-new-page-form .form-control { margin-bottom: 0; width: 240px; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 10px 12px; border-bottom: 2px solid var(--border); }
.admin-table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: .92rem; }
.admin-table a { text-decoration: none; font-weight: 500; }
.admin-row-actions form { margin-right: 6px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .72rem; font-weight: 600; margin-left: 6px; }
.badge-published { background: #e6f4ea; color: #1e7e34; }
.badge-draft { background: #f0ede9; color: #8a8478; }
.badge-home { background: #eef1fb; color: #3b5bdb; }

.admin-flash { color: #1e7e34; font-size: .9rem; }
.admin-settings-form { max-width: 480px; }

/* Nav item drag-and-drop list */
.nav-items-list-children { margin-left: 32px; }
.nav-item-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--border); }
.nav-item-row.drag-over-top { border-top: 3px solid var(--accent); }
.nav-item-row.drag-over-bottom { border-bottom: 3px solid var(--accent); }
.nav-drag-handle { cursor: grab; padding-top: 12px; color: var(--text-muted); font-size: .9rem; line-height: 1; user-select: none; letter-spacing: -2px; }
.nav-drag-handle:active { cursor: grabbing; }

/* ---------------- Page editor ---------------- */
.editor-topbar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 14px 24px; border-bottom: 1px solid var(--border); background: #fff; flex-shrink: 0;
}
.editor-topbar-fields { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.editor-topbar-fields .form-control { margin-bottom: 0; width: auto; }
#meta-title { width: 220px; }
#meta-slug { width: 160px; }
.editor-slug-prefix { color: var(--text-muted); }
.editor-nav-toggle { font-size: .85rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.editor-topbar-actions { display: flex; align-items: center; gap: 10px; }

.editor-wrap { display: flex; flex: 1; min-height: 0; }
.editor-palette { width: 190px; flex-shrink: 0; border-right: 1px solid var(--border); padding: 16px 12px; overflow-y: auto; background: var(--surface); }
.editor-canvas { flex: 1; padding: 24px; overflow-y: auto; background: #fbfaf8; }
.editor-settings { width: 300px; flex-shrink: 0; border-left: 1px solid var(--border); padding: 20px; overflow-y: auto; background: #fff; }

.palette-item {
  padding: 10px 12px; margin-bottom: 6px; background: #fff; border: 1.5px solid var(--border); border-radius: 6px;
  cursor: grab; font-size: .85rem; text-align: center;
}
.palette-item:hover { border-color: var(--accent); }

.editor-block {
  position: relative; background: #fff; border: 1.5px solid var(--border); border-radius: 8px; margin-bottom: 14px;
  padding: 12px 14px; cursor: grab;
}
.editor-block.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(139,115,85,.15); }
.editor-block.drag-over-top { border-top: 3px solid var(--accent); }
.editor-block.drag-over-bottom { border-bottom: 3px solid var(--accent); }
.editor-block-header { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--text-muted); margin-bottom: 6px; }
.editor-block-remove { background: none; border: none; color: #c0392b; cursor: pointer; font-size: .9rem; }
.editor-block-preview { font-size: .85rem; color: var(--text); pointer-events: none; }
.editor-canvas-empty { color: var(--text-muted); text-align: center; padding: 60px 0; }

.settings-field { margin-bottom: 14px; }
.settings-field label { display: block; font-size: .8rem; font-weight: 500; margin-bottom: 4px; }
.settings-field input, .settings-field textarea, .settings-field select { width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 5px; font-family: var(--font-body); font-size: .85rem; }
.settings-field textarea { min-height: 70px; resize: vertical; }
.settings-image-preview { width: 100%; height: 90px; object-fit: cover; border-radius: 5px; margin-bottom: 6px; background: var(--surface); }
.settings-pkg { border: 1px solid var(--border); border-radius: 6px; padding: 10px; margin-bottom: 10px; }
.settings-pkg-remove, .settings-add-btn, .settings-img-btn { font-size: .78rem; background: none; border: 1px solid var(--border); border-radius: 5px; padding: 4px 8px; cursor: pointer; }

/* ---------------- Media picker ---------------- */
.media-picker-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 5000; display: flex; align-items: center; justify-content: center; }
.media-picker-modal { background: #fff; border-radius: 10px; width: 640px; max-width: 92vw; max-height: 80vh; display: flex; flex-direction: column; }
.media-picker-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.media-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; padding: 16px 18px; overflow-y: auto; }
.media-picker-grid img { width: 100%; height: 90px; object-fit: cover; border-radius: 5px; cursor: pointer; border: 2px solid transparent; }
.media-picker-grid img:hover { border-color: var(--accent); }
.media-picker-footer { padding: 12px 18px; border-top: 1px solid var(--border); }

/* ---------------- Public site ---------------- */
.public-site { background: var(--bg); }
.site-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 40px; transition: background .25s, box-shadow .25s, color .25s; }
.site-logo { font-family: var(--font-heading); font-size: 1.2rem; text-decoration: none; color: inherit; }
.site-logo-img { max-height: 44px; max-width: 200px; object-fit: contain; }
.site-nav { display: flex; align-items: center; gap: 24px; }
.site-nav a, .nav-dropdown-toggle { text-decoration: none; font-size: .9rem; letter-spacing: .02em; color: inherit; }
.site-nav a:hover, .nav-dropdown-toggle:hover { color: var(--accent); }
.site-main { min-height: 60vh; }

/* Logo-centre layout: nav links split either side of a centred logo */
.site-header.nav-layout-center { justify-content: center; gap: 40px; }
.site-header.nav-layout-center .site-nav-left { justify-content: flex-end; flex: 1; }
.site-header.nav-layout-center .site-nav-right { justify-content: flex-start; flex: 1; }

/* Dropdown sub-menus */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle { display: inline-flex; align-items: center; gap: 5px; background: none; border: none; font-family: inherit; cursor: pointer; padding: 0; }
.nav-dropdown-menu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 14px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.1);
  min-width: 180px; padding: 6px; display: none; flex-direction: column; z-index: 200;
}
.nav-dropdown.open .nav-dropdown-menu { display: flex; }
.nav-dropdown-menu a { color: var(--text) !important; padding: 8px 12px; border-radius: 5px; font-size: .88rem; }
.nav-dropdown-menu a:hover { background: var(--surface); color: var(--text) !important; }

/* Overlay header — transparent over a hero, solid once scrolled past it.
   Sits lower and larger while over the hero (like the reference design),
   shrinking back to the compact bar once scrolled. Text/logo colour follows
   whichever logo variant is active (dark logo = dark text, light logo =
   white text) — but scrolled always reverts to dark logo + dark text,
   regardless of which was showing before. */
.site-header-overlay {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  background: transparent; color: var(--text);
  padding-top: 52px;
  transition: background .25s, box-shadow .25s, color .25s, padding-top .25s;
}
.site-header-overlay .nav-dropdown-menu a { color: var(--text) !important; }
.site-header-overlay .site-logo-img { max-height: 68px; transition: max-height .25s; }
.site-header-overlay .site-logo { font-size: 1.55rem; transition: font-size .25s; }

.site-header-overlay.nav-use-light-logo { color: #fff; }

.site-header-overlay.scrolled {
  background: #fff; color: var(--text); box-shadow: 0 2px 12px rgba(0,0,0,.08);
  padding-top: 20px;
}
.site-header-overlay.scrolled .site-logo-img { max-height: 44px; }
.site-header-overlay.scrolled .site-logo { font-size: 1.2rem; }

/* Light-logo swap — shown only while transparent over the hero; reverts to
   the normal logo once the header goes solid (.scrolled), same as the text. */
.site-logo-light-wrap { display: none; }
.site-header.nav-use-light-logo:not(.scrolled) .site-logo-dark-wrap { display: none; }
.site-header.nav-use-light-logo:not(.scrolled) .site-logo-light-wrap { display: inline-block; }
.site-footer { padding: 32px 40px; border-top: 1px solid var(--border); font-size: .85rem; color: var(--text-muted); }
.site-footer-simple { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.site-footer-social a { margin-left: 16px; text-decoration: none; }
.site-footer-bottom { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); font-size: .8rem; }

/* Columns footer layout */
.footer-columns-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; }
.footer-col h4 { font-family: var(--font-body); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text); margin: 0 0 12px; }
.footer-col p { margin: 0; line-height: 1.6; }
.footer-col-links .footer-links-list { display: flex; flex-direction: column; gap: 8px; }
.footer-links-list a, .footer-col a { text-decoration: none; color: var(--text-muted); }
.footer-links-list a:hover, .footer-col a:hover { color: var(--accent); }
.footer-nav-child { display: block; margin-left: 14px; font-size: .82rem; opacity: .85; }
.footer-social-icons { display: flex; gap: 10px; }
.footer-social-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); color: var(--text-muted); }
.footer-social-icon:hover { color: var(--accent); border-color: var(--accent); }

/* Centred footer layout */
.site-footer-centered { text-align: center; }
.footer-centered-logo { font-family: var(--font-heading); font-size: 1.15rem; margin-bottom: 18px; }
.footer-centered-logo img { margin: 0 auto; max-height: 44px; }
.footer-centered-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 22px; margin-bottom: 18px; }
.footer-centered-nav a, .footer-centered-nav .nav-dropdown-toggle { text-decoration: none; color: var(--text-muted); font-size: .88rem; }
.footer-centered-nav a:hover, .footer-centered-nav .nav-dropdown-toggle:hover { color: var(--accent); }
.footer-centered-social { display: flex; justify-content: center; gap: 10px; margin-bottom: 4px; }
.site-footer-centered .site-footer-bottom { text-align: center; }

.public-404 { text-align: center; padding: 100px 20px; }
.public-404 a { text-decoration: underline; }

/* ---------------- Blocks ---------------- */
.block { padding: 0; }

.block-hero {
  position: relative; height: 82vh; min-height: 420px; background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; color: #fff; text-align: center;
}
.block-hero-overlay { position: absolute; inset: 0; }
.block-hero-content { position: relative; z-index: 1; max-width: 700px; padding: 0 24px; }
.block-hero-content h1 { font-size: clamp(2rem, 5vw, 3.4rem); color: #fff; }
.block-hero-content p { font-size: 1.1rem; opacity: .92; }
.block-hero-cta {
  display: inline-block; margin-top: 20px; padding: 12px 28px; border: 1.5px solid #fff; border-radius: 4px;
  color: #fff; text-decoration: none; font-size: .9rem; letter-spacing: .04em;
}
.block-hero-cta:hover { background: #fff; color: var(--text); }

/* Slideshow Hero — images cross-fade untouched (no darkening overlay);
   text legibility comes from a shadow on the text itself, not the image. */
.block-slideshow-hero {
  position: relative; height: 82vh; min-height: 420px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: #fff; text-align: center;
}
.block-slideshow-hero.block-hero-full { height: 100vh; }
.slideshow-items { position: absolute; inset: 0; }
.slideshow-item { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.4s ease; }
.slideshow-item.active { opacity: 1; }
.block-slideshow-hero .block-hero-content { text-shadow: 0 2px 16px rgba(0,0,0,.45); }
.block-slideshow-hero .block-hero-content h1 { color: #fff; }

.block-mosaic { padding: 60px 40px; }
.block-mosaic-title { text-align: center; margin-bottom: 32px; }
.mosaic-grid { width: 100%; }
.mosaic-item { position: relative; cursor: pointer; overflow: hidden; border-radius: 3px; break-inside: avoid; }
.mosaic-item img { width: 100%; height: auto; display: block; transition: transform .3s; }
.mosaic-item:hover img { transform: scale(1.03); }
.mosaic-item-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 12px; background: linear-gradient(transparent, rgba(0,0,0,.6)); color: #fff; font-size: .8rem; opacity: 0; transition: opacity .2s; }
.mosaic-item:hover .mosaic-item-caption { opacity: 1; }

.block-text, .block-split, .block-quote, .block-cta, .block-pricing, .block-banner { padding: 60px 40px; max-width: 1100px; margin: 0 auto; }
.block-text-body p { margin: 0 0 1em; color: var(--text); }
.block-text-2col .block-text-body { columns: 2; column-gap: 40px; }

.block-split { display: flex; gap: 48px; align-items: center; }
.block-split.block-split-reverse { flex-direction: row-reverse; }
.block-split-media, .block-split-content { flex: 1; min-width: 0; }
.block-split-media img { width: 100%; border-radius: 6px; }

.block-banner { max-width: none; padding: 0; height: 50vh; min-height: 300px; background-size: cover; background-position: center; position: relative; }
.block-banner-caption { position: absolute; bottom: 20px; left: 40px; color: #fff; font-size: .9rem; background: rgba(0,0,0,.45); padding: 6px 14px; border-radius: 4px; }

.block-quote { text-align: center; }
.block-quote blockquote { font-family: var(--font-heading); font-size: 1.6rem; font-style: italic; margin: 0 0 12px; }
.block-quote cite { color: var(--text-muted); font-style: normal; font-size: .9rem; }

.block-cta { text-align: center; }
.block-cta-btn { display: inline-block; margin-top: 16px; padding: 12px 28px; background: var(--text); color: #fff; text-decoration: none; border-radius: 4px; font-size: .9rem; }

.block-pricing-title { text-align: center; margin-bottom: 40px; }
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.pricing-card { border: 1.5px solid var(--border); border-radius: 10px; padding: 28px 24px; text-align: center; }
.pricing-card-highlight { border-color: var(--accent); box-shadow: 0 4px 24px rgba(139,115,85,.15); }
.pricing-card-name { font-family: var(--font-heading); font-size: 1.15rem; margin-bottom: 6px; }
.pricing-card-price { font-size: 1.6rem; font-weight: 600; margin-bottom: 16px; }
.pricing-card-features { list-style: none; padding: 0; margin: 0 0 20px; font-size: .88rem; color: var(--text-muted); }
.pricing-card-features li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.pricing-card-cta { display: inline-block; padding: 10px 22px; border: 1.5px solid var(--text); border-radius: 4px; text-decoration: none; font-size: .85rem; }
.pricing-card-highlight .pricing-card-cta { background: var(--text); color: #fff; }

.block-spacer { width: 100%; }

/* ---------------- Lightbox ---------------- */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 9000; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 90vw; max-height: 90vh; object-fit: contain; }
.lightbox-close { position: absolute; top: 20px; right: 30px; background: none; border: none; color: #fff; font-size: 2rem; cursor: pointer; }

@media (max-width: 860px) {
  .editor-wrap { flex-direction: column; }
  .editor-palette, .editor-settings { width: 100%; }
  .block-split { flex-direction: column; }
  .block-split.block-split-reverse { flex-direction: column; }
  .site-header { padding: 16px 20px; flex-direction: column; gap: 10px; }
  .site-nav { flex-wrap: wrap; justify-content: center; }
  .block-hero, .block-mosaic, .block-text, .block-split, .block-quote, .block-cta, .block-pricing { padding: 40px 20px; }
  .mosaic-grid { column-count: 2 !important; }
  .footer-columns-row { grid-template-columns: 1fr 1fr; gap: 24px; }
  .site-footer { padding: 32px 20px; }
}

@media (max-width: 480px) {
  .mosaic-grid { column-count: 1 !important; }
  .footer-columns-row { grid-template-columns: 1fr; }
}
