/* ==========================================================
   Unchaos — shared base styles
   ========================================================== */

:root {
  /* defaults — overridden by tokens.js */
  --bg: #FBF4E4;
  --bg-alt: #F5EAD2;
  --ink: #2A1D12;
  --ink-soft: #5C4A37;
  --muted: #8B7555;
  --accent: #D98B5F;
  --accent-deep: #A85F2C;
  --accent-2: #F5D77A;
  --accent-3: #7A8F5A;
  --line: #E7D7B3;
  --card: #FFFBEF;

  --serif: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 28px;
  --shadow-sm: 0 2px 10px rgba(42,20,28,.06);
  --shadow: 0 16px 50px rgba(42,20,28,.10);
  --shadow-lg: 0 30px 80px rgba(42,20,28,.14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 19px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}

/* subtle paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: .35;
  z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}
body > * { position: relative; z-index: 2; }

img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { color: var(--accent); }

h1, h2, h3, h4, h5 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: var(--ink);
}
h1 { font-size: clamp(54px, 7.4vw, 108px); font-weight: 300; }
h2 { font-size: clamp(40px, 4.8vw, 64px); }
h3 { font-size: clamp(28px, 3vw, 40px); }
h4 { font-size: 24px; }

em, i { font-style: italic; color: var(--accent-deep); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 28px; }
.wrap-narrow { max-width: 880px; margin: 0 auto; padding: 0 28px; }

/* Eyebrow */
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: ""; width: 24px; height: 1px; background: currentColor;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 26px;
  border-radius: 999px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.01em;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  cursor: pointer;
  border: 1.5px solid transparent;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--bg); background: var(--accent-deep); }
.btn-accent { background: var(--accent); color: var(--bg); }
.btn-accent:hover { transform: translateY(-2px); box-shadow: var(--shadow); background: var(--accent-deep); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-outline:hover { border-color: var(--ink); }

/* NAV */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid color-mix(in oklab, var(--line) 60%, transparent);
}
.topnav-inner {
  max-width: 1280px; margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.topnav-brand { display: flex; align-items: center; gap: 10px; }
.topnav-brand img { width: 38px; height: 38px; }
.topnav-brand-text {
  font-family: var(--serif); font-weight: 500; font-size: 22px; letter-spacing: -0.02em;
}
.topnav-links { display: flex; align-items: center; gap: 6px; }
.topnav-links a {
  padding: 10px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 500; color: var(--ink-soft);
}
.topnav-links a:hover, .topnav-links a.active { background: var(--ink); color: var(--bg); }

.audience-switch {
  display: flex; background: var(--bg-alt); border-radius: 999px;
  padding: 4px; border: 1px solid var(--line);
}
.audience-switch a {
  padding: 8px 18px; border-radius: 999px; font-size: 13px; font-weight: 500;
  color: var(--ink-soft);
}
.audience-switch a.active { background: var(--ink); color: var(--bg); }

/* Sections */
section { padding: 64px 0; position: relative; }
section.tight { padding: 40px 0; }

/* FOOTER */
.sitefoot {
  padding: 80px 0 40px;
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
}
.sitefoot-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.sitefoot h5 {
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink);
  margin-bottom: 16px;
}
.sitefoot ul { list-style: none; }
.sitefoot li { margin-bottom: 8px; }
.sitefoot a { color: var(--ink-soft); font-size: 14px; }
.sitefoot a:hover { color: var(--accent-deep); }
.sitefoot-tag { font-family: var(--serif); font-style: italic; font-size: 20px; margin: 10px 0 16px; color: var(--accent-deep); }
.sitefoot-bottom {
  border-top: 1px solid var(--line);
  padding-top: 24px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--muted);
}

/* ================= Aesthetic: EDITORIAL (default) ================= */
[data-aesthetic="editorial"] .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: transform .3s ease, box-shadow .3s ease;
}
[data-aesthetic="editorial"] .card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}
[data-aesthetic="editorial"] .chip {
  display: inline-flex; padding: 6px 14px;
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: 999px; font-size: 13px; color: var(--ink-soft);
}

/* ================= Aesthetic: COLLAGE ================= */
[data-aesthetic="collage"] .card {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 6px 6px 0 var(--ink);
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
}
[data-aesthetic="collage"] .card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 10px 10px 0 var(--ink);
}
[data-aesthetic="collage"] .chip {
  display: inline-flex; padding: 6px 14px;
  background: var(--accent-2); border: 1.5px solid var(--ink);
  border-radius: 999px; font-size: 13px; color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 500;
}
[data-aesthetic="collage"] .btn-primary { border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
[data-aesthetic="collage"] .btn-primary:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
[data-aesthetic="collage"] .btn-accent { border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
[data-aesthetic="collage"] .btn-accent:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }

/* Decorative SVG accents */
.decor { position: absolute; pointer-events: none; }
.decor.star { width: 28px; height: 28px; color: var(--accent); }
.decor.squiggle { color: var(--accent-deep); }

/* Floating blob backgrounds */
.blob {
  position: absolute; border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  opacity: .5;
  animation: floaty 18s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translate(0,0) scale(1); }
  50%      { transform: translate(-20px, -28px) scale(1.08); }
}

/* Reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Marquee */
.marquee {
  display: flex;
  overflow: hidden;
  gap: 48px;
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  padding: 20px 0;
}
.marquee-track {
  display: flex; gap: 48px;
  animation: slide 40s linear infinite;
  white-space: nowrap;
  flex-shrink: 0;
}
@keyframes slide { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.marquee span {
  font-family: var(--serif); font-style: italic; font-size: clamp(28px, 3vw, 42px);
  color: var(--ink); opacity: .8;
}
.marquee span::after { content: "✦"; margin-left: 48px; color: var(--accent); font-style: normal; }

/* Image placeholder (paper/diagonal-stripe) */
.ph-img {
  background: var(--bg-alt);
  background-image:
    repeating-linear-gradient(135deg, transparent 0 22px, color-mix(in oklab, var(--line) 70%, transparent) 22px 23px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  text-align: center; padding: 20px;
}

/* ContentEditable indicator only when edit mode is on */
html[data-edit="on"] [data-editable]:hover {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  cursor: text;
  border-radius: 4px;
}
html[data-edit="on"] [data-editable]:focus {
  outline: 2px solid var(--accent-deep);
  outline-offset: 4px;
  background: color-mix(in oklab, var(--accent-2) 30%, transparent);
}

/* Drag handles */
.drag-handle {
  display: none;
  position: absolute;
  top: 10px; left: 10px;
  width: 36px; height: 36px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 10px;
  align-items: center; justify-content: center;
  cursor: grab;
  font-size: 18px;
  z-index: 20;
  box-shadow: var(--shadow-sm);
}
.drag-handle:active { cursor: grabbing; }
html[data-edit="on"] .draggable { position: relative; outline: 1px dashed color-mix(in oklab, var(--accent) 60%, transparent); outline-offset: 6px; border-radius: 8px; }
html[data-edit="on"] .draggable > .drag-handle { display: flex; }
.dragging { opacity: .4; }
.drag-over { outline: 2px solid var(--accent) !important; outline-offset: 6px; }

/* Tweaks panel */
.tweaks-panel {
  position: fixed; right: 24px; bottom: 24px; z-index: 600;
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: 18px;
  padding: 20px;
  width: 320px;
  box-shadow: 6px 6px 0 var(--ink);
  display: none;
  font-family: var(--sans);
}
.tweaks-panel.open { display: block; animation: pop .25s ease; }
@keyframes pop { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.tweaks-panel h5 {
  font-family: var(--serif); font-size: 20px; margin-bottom: 12px;
}
.tweaks-panel .row { margin-bottom: 16px; }
.tweaks-panel .label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 8px;
}
.swatch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.swatch-btn {
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 8px; background: var(--card);
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  transition: border-color .2s;
}
.swatch-btn.active { border-color: var(--ink); }
.swatch-row { display: flex; gap: 3px; }
.swatch-row span { width: 14px; height: 14px; border-radius: 4px; }
.swatch-btn .name { font-size: 11px; color: var(--ink); font-weight: 500; }
.aesthetic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.aesthetic-btn {
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px; background: var(--card);
  font-size: 12px; text-align: left;
}
.aesthetic-btn.active { border-color: var(--ink); background: var(--accent-2); }
.aesthetic-btn .nm { display: block; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.aesthetic-btn .ds { display: block; color: var(--muted); font-size: 11px; line-height: 1.3; }

/* Edit mode toolbar */
.edit-toolbar {
  position: fixed; top: 88px; right: 24px; z-index: 550;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  display: none;
  align-items: center; gap: 12px;
  box-shadow: var(--shadow);
}
.edit-toolbar.on { display: flex; animation: pop .3s ease; }
.edit-toolbar .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #6EE7B7;
  animation: blink 1.5s infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.edit-toolbar button {
  background: var(--bg); color: var(--ink); padding: 6px 14px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
}

/* Mobile */
@media (max-width: 820px) {
  .topnav-links { display: none; }
  .sitefoot-grid { grid-template-columns: 1fr 1fr; }
  section { padding: 44px 0; }
  h1 { font-size: clamp(40px, 10vw, 56px); }
}
