/* ==========================================================================
   DIGITAL SANCTUARY — NATIVE CSS ARCHITECTURE
   Zero external dependencies. Classical editorial serif & clean grotesque UI.
   ========================================================================== */

:root {
  --bg-parchment: #f4efe4;
  --bg-parchment-deep: #eae2d3;
  --studio-dark: #10191c;
  --studio-panel: #152125;
  --studio-border: #26383e;
  --studio-text: #e7eceb;
  --studio-muted: #93a6ab;
  --gold-leaf: #d5a858;
  --gold-soft: #b88c42;
  --teal-deep: #0b3936;
  --ink-serif: 'Iowan Old Style', 'Palatino Linotype', 'URW Palladio L', P052, Georgia, serif;
  --ui-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;

  /* Dynamic Live Site Tokens (Updated by JS) */
  --site-bg: #f6f0e4;
  --site-text: #1c2826;
  --site-accent: #dcb063;
  --site-btn-text: #16221f;
  --site-pillar-icon: #c89643;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-parchment);
  background-image: 
    radial-gradient(circle at 15% 95%, rgba(16, 75, 68, 0.08) 0%, transparent 35%),
    radial-gradient(circle at 88% 92%, rgba(185, 113, 24, 0.08) 0%, transparent 35%);
  color: var(--site-text);
  font-family: var(--ui-sans);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==========================================================================
   TOP BANNER HEADER
   ========================================================================== */
.sanctuary-header {
  background: 
    radial-gradient(circle at 38% 20%, rgba(213, 168, 88, 0.32), transparent 45%),
    linear-gradient(100deg, #072224 0%, #0d3c3a 48%, #072024 100%);
  color: #f5efe4;
  padding: 1.1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid rgba(213, 168, 88, 0.4);
  position: relative;
  overflow: hidden;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.lotus-logo {
  width: 44px;
  height: 44px;
  color: var(--gold-leaf);
  flex-shrink: 0;
}

.header-brand h1 {
  font-family: var(--ink-serif);
  font-weight: 400;
  font-size: 1.95rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.header-sub {
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  color: #cbd5d0;
  margin-top: 0.2rem;
}

.header-tagline {
  font-family: var(--ink-serif);
  font-style: italic;
  font-size: 1.02rem;
  color: #e6dfd1;
  text-align: center;
}

.header-badges {
  display: flex;
  gap: 1.5rem;
}

.badge {
  display: flex;
   flex-direction: column;
  align-items: center;
  text-align: center;
  font-size: 0.68rem;
  color: #d9e2df;
  line-height: 1.25;
}

.badge svg {
  width: 18px;
  height: 18px;
  color: var(--gold-leaf);
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   3-COLUMN STUDIO WORKSPACE
   ========================================================================== */
.workspace-container {
  max-width: 1560px;
  margin: 0.9rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: 330px 1fr 315px;
  gap: 0.9rem;
  align-items: stretch;
}

/* LEFT SIDEBAR: Dark Studio Controls */
.studio-sidebar {
  background: var(--studio-dark);
  color: var(--studio-text);
  border-radius: 10px;
  display: grid;
  grid-template-columns: 54px 1fr;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.icon-rail {
  background: #0b1214;
  border-right: 1px solid var(--studio-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0;
  gap: 0.65rem;
}

.rail-btn {
  background: transparent;
  border: none;
  color: var(--studio-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.62rem;
  cursor: pointer;
  padding: 0.45rem 0.25rem;
  width: 44px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.rail-btn svg {
  width: 18px;
  height: 18px;
}

.rail-btn:hover,
.rail-btn.active {
  background: rgba(25, 115, 102, 0.28);
  color: #7fe3d2;
}

.inspector-panel {
  padding: 1rem 1rem 1.25rem;
  overflow-y: auto;
  max-height: 650px;
}

.panel-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #f3f6f6;
}

.accordion-group {
  border-top: 1px solid var(--studio-border);
  padding: 0.55rem 0;
}

.accordion-group summary {
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #d6e1e3;
  padding: 0.2rem 0;
}

.accordion-group summary::after {
  content: '⌄';
  font-size: 0.9rem;
  color: var(--studio-muted);
}

.accordion-group[open] summary::after {
  content: '⌃';
}

.accordion-body {
  padding-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.field-label {
  font-size: 0.69rem;
  color: var(--studio-muted);
}

.field-input,
.field-textarea {
  width: 100%;
  background: #0d1518;
  border: 1px solid #293b42;
  color: #eef3f3;
  padding: 0.42rem 0.55rem;
  border-radius: 5px;
  font-size: 0.74rem;
  font-family: inherit;
}

.field-input:focus,
.field-textarea:focus {
  outline: 1px solid #4ca699;
  border-color: #4ca699;
}

.field-hint {
  font-size: 0.65rem;
  color: #7c9096;
}

/* ==========================================================================
   CENTER COLUMN: LIVE INTERACTIVE PREVIEW
   ========================================================================== */
.preview-stage {
  background: #232830;
  border-radius: 10px;
  padding: 0.65rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.viewport-toolbar {
  display: flex;
  justify-content: center;
  margin-bottom: 0.55rem;
}

.viewport-toggles {
  background: #181c22;
  padding: 0.2rem;
  border-radius: 6px;
  display: flex;
  gap: 0.25rem;
}

.vp-btn {
  background: transparent;
  border: none;
  color: #9aa3b2;
  font-size: 0.7rem;
  padding: 0.28rem 0.65rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.vp-btn.active {
  background: #2d3440;
  color: #ffffff;
}

.browser-frame {
  background: var(--site-bg);
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  width: 100%;
  transition: max-width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.browser-frame[data-viewport="tablet"] {
  max-width: 580px;
}

.browser-frame[data-viewport="mobile"] {
  max-width: 360px;
}

.browser-chrome {
  background: #3a404d;
  padding: 0.45rem 0.8rem;
  display: flex;
  align-items: center;
}

.window-dots {
  display: flex;
  gap: 6px;
}

.window-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5b6273;
}

.address-bar {
  margin: 0 auto;
  background: #2b303a;
  color: #aeb6c4;
  font-size: 0.68rem;
  padding: 0.18rem 1.2rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* INSIDE THE LIVE PREVIEW */
.site-viewport {
  background: var(--site-bg);
  color: var(--site-text);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.site-nav {
  padding: 0.85rem 1.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.site-brand {
  font-family: var(--ink-serif);
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.brand-leaf {
  color: var(--site-pillar-icon);
}

.site-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1.35rem;
  font-size: 0.76rem;
}

.site-links a {
  text-decoration: none;
  color: inherit;
  opacity: 0.85;
}

.site-Hero, .site-hero {
  position: relative;
  height: 340px;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 2rem 2.4rem;
}

#sanctuary-gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 410px;
  color: #f9f6f0;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.55);
}

.hero-content h2 {
  font-family: var(--ink-serif);
  font-size: 2.25rem;
  font-weight: 400;
  line-height: 1.12;
  margin-bottom: 0.75rem;
}

.hero-content p {
  font-size: 0.84rem;
  line-height: 1.5;
  opacity: 0.94;
  margin-bottom: 1.25rem;
}

.hero-cta {
  display: inline-block;
  background: var(--site-accent);
  color: var(--site-btn-text);
  text-decoration: none;
  padding: 0.55rem 1.15rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-shadow: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.hero-cta:hover {
  transform: translateY(-1px);
}

.hero-whisper {
  position: absolute;
  right: 1.5rem;
  bottom: 0.95rem;
  z-index: 2;
  font-family: var(--ink-serif);
  font-style: italic;
  font-size: 0.78rem;
  color: #f3ede2;
  text-shadow: 0 1px 8px rgba(0,0,0,0.7);
}

.site-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 1.25rem 1rem;
  background: var(--site-bg);
  text-align: center;
  gap: 0.5rem;
  flex: 1;
  align-items: center;
}

.pillar-item {
  padding: 0 0.65rem;
  border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.pillar-item:last-child {
  border-right: none;
}

.pillar-icon {
  font-size: 1.25rem;
  color: var(--site-pillar-icon);
  margin-bottom: 0.3rem;
  display: block;
}

.pillar-item h4 {
  font-family: var(--ink-serif);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.pillar-item p {
  font-size: 0.68rem;
  opacity: 0.78;
  line-height: 1.35;
}

/* ==========================================================================
   RIGHT SIDEBAR: PALETTE SELECTOR
   ========================================================================== */
.palette-sidebar {
  background: #f8f4ec;
  border: 1px solid #dfd6c5;
  border-radius: 10px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
}

.palette-sidebar h2 {
  font-family: var(--ink-serif);
  font-weight: 400;
  font-size: 1.25rem;
  color: #1b2422;
}

.palette-intro {
  font-size: 0.74rem;
  color: #5c6460;
  margin: 0.2rem 0 0.85rem;
}

.palette-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.palette-card {
  background: #fcfaf5;
  border: 1.5px solid #e2d9c8;
  border-radius: 8px;
  padding: 0.55rem;
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.palette-card:hover {
  border-color: #c8b698;
}

.palette-card.active {
  border-color: #b58d3d;
  background: #fffdf9;
  box-shadow: 0 4px 14px rgba(181, 141, 61, 0.14);
}

.thumb-canvas {
  width: 84px;
  height: 84px;
  border-radius: 6px;
  display: block;
}

.palette-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.palette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.palette-header h3 {
  font-family: var(--ink-serif);
  font-size: 0.95rem;
  font-weight: 600;
}

.radio-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #b8b0a2;
  display: inline-block;
  position: relative;
}

.palette-card.active .radio-indicator {
  border-color: #204e45;
}

.palette-card.active .radio-indicator::after {
  content: '';
  position: absolute;
  inset: 2px;
  background: #204e45;
  border-radius: 50%;
}

.palette-info p {
  font-family: var(--ink-serif);
  font-style: italic;
  font-size: 0.73rem;
  color: #5c635e;
  margin: 0.15rem 0 0.45rem;
}

.swatch-row {
  display: flex;
  gap: 0.38rem;
}

.swatch-row span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.12);
}

/* ==========================================================================
   LOWER ARCHETYPE SHOWCASE CARDS
   ========================================================================== */
.archetype-showcase {
  max-width: 1560px;
  margin: 1.2rem auto 2rem;
  padding: 0 1rem;
}

.archetype-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.95rem;
}

.archetype-card {
  background: #f8f3e8;
  border: 1px solid #ded5c3;
  border-radius: 9px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.archetype-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.1);
}

.arch-preview {
  position: relative;
  height: 220px;
  padding: 0.85rem 1.1rem;
  color: #f7f2e8;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.arch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.arch-topbar,
.arch-hero-text {
  position: relative;
  z-index: 2;
}

.arch-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--ink-serif);
  font-size: 0.8rem;
}

.arch-topbar small {
  font-family: var(--ui-sans);
  font-size: 0.6rem;
  opacity: 0.85;
}

.arch-hero-text h3 {
  font-family: var(--ink-serif);
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 1.12;
  margin-bottom: 0.35rem;
}

.arch-hero-text p {
  font-size: 0.68rem;
  max-width: 85%;
  opacity: 0.92;
  margin-bottom: 0.65rem;
}

.arch-pill {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.32rem 0.75rem;
  border-radius: 4px;
}

.dark-text {
  color: #23201a;
}

.arch-substrip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  text-align: center;
  padding: 0.7rem 0.4rem;
  background: #f5efe2;
  border-bottom: 1px solid #e5dccb;
  font-size: 0.62rem;
}

.arch-substrip span {
  display: block;
  font-size: 0.95rem;
  color: #3f6a58;
  margin-bottom: 0.15rem;
}

.dark-strip {
  background: #131826;
  color: #d6d8e4;
  border-bottom-color: #252b3d;
}

.dark-strip span {
  color: #b898b4;
}

.arch-thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  background: #f5efe2;
  border-bottom: 1px solid #e5dccb;
}

.mini-thumb {
  height: 46px;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
}

.thumb-pine { background: linear-gradient(135deg, #4b5d3b, #d8a556); }
.thumb-book { background: linear-gradient(135deg, #b88c5a, #e7d5b8); }
.thumb-lake { background: linear-gradient(135deg, #2b4c59, #c49b60); }
.thumb-vessel1 { background: radial-gradient(circle at 40% 40%, #4b3d30, #16181c); }
.thumb-vessel2 { background: radial-gradient(circle at 50% 45%, #8f6e4f, #28211c); }
.thumb-vessel3 { background: radial-gradient(circle at 50% 40%, #7d6347, #221d17); }

.arch-footer {
  padding: 0.85rem 1rem 1rem;
}

.arch-footer h4 {
  font-family: var(--ink-serif);
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
}

.arch-footer p {
  font-size: 0.7rem;
  color: #545b57;
  line-height: 1.42;
}

/* ==========================================================================
   FOOTER & MODAL
   ========================================================================== */
.sanctuary-footer {
  text-align: center;
  padding: 0.8rem 1rem 2.4rem;
}

.footer-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 0.45rem;
}

.footer-rule .line {
  width: 90px;
  height: 1px;
  background: #c8beac;
}

.manifesto {
  font-family: var(--ink-serif);
  font-style: italic;
  font-size: 0.98rem;
  color: #48504b;
}

.footer-brand {
  font-family: var(--ink-serif);
  font-size: 0.84rem;
  color: #656d67;
}

.footer-brand span {
  color: var(--gold-soft);
}

.studio-modal {
  margin: auto;
  border: 1px solid var(--studio-border);
  background: var(--studio-dark);
  color: var(--studio-text);
  border-radius: 10px;
  width: min(640px, 92vw);
  padding: 0;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}

.studio-modal::backdrop {
  background: rgba(8, 14, 16, 0.7);
}

.modal-inner {
  padding: 1.25rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

#modal-close {
  background: none;
  border: none;
  color: var(--studio-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

.modal-code {
  background: #091012;
  padding: 1rem;
  border-radius: 6px;
  font-size: 0.75rem;
  overflow-x: auto;
  color: #9de5d6;
  max-height: 380px;
}

@media (max-width: 1220px) {
  .workspace-container {
    grid-template-columns: 1fr;
  }
  .archetype-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .sanctuary-header {
    flex-direction: column;
    gap: 0.8rem;
    text-align: center;
  }
  .archetype-grid {
    grid-template-columns: 1fr;
  }
}