/* ══════════════════════════════════════════════════════════
   Fennel OS — shared styles (portal + admin)
   Font URLs are root-absolute so they resolve from any path
   (e.g. /admin/ as well as /).
   ══════════════════════════════════════════════════════════ */
@font-face {
  font-family: 'DxGrafik';
  src: url('/fonts/DxGrafik-SemiBold.otf') format('opentype');
  font-weight: 600;
  font-style: normal;
}
@font-face {
  font-family: 'PPNeueMontreal';
  src: url('/fonts/PPNeueMontreal-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
}

*, *::before, *::after { box-sizing: border-box; }
h1, h2, h3 { margin: 0; font-weight: inherit; }
p { margin: 0; }

html, body { height: 100%; margin: 0; padding: 0; }

body {
  font-family: 'PPNeueMontreal', 'DM Sans', -apple-system, system-ui, sans-serif;
  background: #FFEAD2;
  color: #000;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────── */
.header {
  padding: 18px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFEAD2;
  border-bottom: 1px solid #000;
  flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.wordmark {
  font-family: 'DxGrafik', 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.015em;
}
.header-right { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', 'PPNeueMontreal', sans-serif;
  font-weight: 500;
  font-size: 14px;
  color: #000;
  background: transparent;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Hero ───────────────────────────────────────────── */
.hero {
  position: relative;
  flex-shrink: 0;
  background: #1A00FF;
  color: #fff;
  padding: 32px 40px 30px;
  overflow: hidden;
  border-bottom: 1px solid #000;
}
.hero-burst { position: absolute; pointer-events: none; }
.hero-content { position: relative; z-index: 1; padding-right: clamp(0px, 18.75vw, 240px); }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'DM Sans', 'PPNeueMontreal', sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  margin-bottom: 10px;
}
.eyebrow-bar { display: inline-block; width: 22px; height: 1px; background: #FFE357; flex-shrink: 0; }
.hero-headline {
  font-family: 'DxGrafik', 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: clamp(40px, 5.625vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin: 0;
  color: #fff;
  text-wrap: balance;
}
.hero-headline .sundial { color: #FFE357; }
.hero-body {
  font-family: 'PPNeueMontreal', 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  max-width: 560px;
  opacity: 0.9;
  margin-top: 14px;
  font-weight: 400;
}

/* ── Board ──────────────────────────────────────────── */
.board {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
  min-height: 0;
}

/* ── Cells ──────────────────────────────────────────── */
.cell {
  position: relative;
  overflow: hidden;
  padding: 28px 30px 24px;
  background: var(--bg);
  color: var(--fg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
}
.cell:not(.cell--inactive) { cursor: pointer; }
.cell--inactive { opacity: 0.72; cursor: default; }
.cell-top { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-start; }
.cell-pill {
  display: inline-block;
  font-family: 'DM Sans', 'PPNeueMontreal', sans-serif;
  font-weight: 500;
  font-size: 13px;
  padding: 5px 11px;
  border: 1px solid var(--fg);
  border-radius: 40px;
  line-height: 1.2;
}
.cell-name {
  font-family: 'DxGrafik', 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: clamp(32px, 5.3125vw, 68px);
  line-height: 0.9;
  letter-spacing: -0.035em;
  margin: 0;
  position: relative;
  z-index: 1;
}
.cell-bottom { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.cell-desc {
  font-family: 'PPNeueMontreal', 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.35;
  max-width: 62%;
  font-weight: 400;
  text-wrap: pretty;
}
.cell-launch {
  display: inline-block;
  font-family: 'DM Sans', 'PPNeueMontreal', sans-serif;
  font-weight: 500;
  font-size: 15px;
  padding: 8px 15px;
  border: 1px solid var(--fg);
  border-radius: 40px;
  background: transparent;
  color: var(--fg);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .2s ease, color .2s ease;
}
.cell:not(.cell--inactive):hover .cell-launch { background: var(--fg); color: var(--bg); }
.cell--inactive .cell-launch { opacity: 0.45; }
.cell:focus-visible { outline: 2px solid #1A00FF; outline-offset: -2px; }

/* ── Footer ─────────────────────────────────────────── */
.footer {
  padding: 13px 36px;
  border-top: 1px solid #000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'PPNeueMontreal', 'DM Sans', sans-serif;
  font-size: 13px;
  color: #000;
  background: #FFEAD2;
  flex-shrink: 0;
}
.footer-status { display: inline-flex; align-items: center; gap: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4C78FF; display: inline-block; flex-shrink: 0; }
.status-dot.outage { background: #FF6138; }

/* ── Welcome dialog ─────────────────────────────────── */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 234, 210, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.dialog-overlay.hidden { display: none; }
.dialog { border: 1px solid #000; padding: 40px 48px; max-width: 440px; width: calc(100% - 48px); background: #FFEAD2; }
.dialog-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'DM Sans', 'PPNeueMontreal', sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #000;
  margin-bottom: 20px;
}
.dialog-eyebrow-bar { display: inline-block; width: 22px; height: 1px; background: #FF6138; flex-shrink: 0; }
.dialog-headline {
  font-family: 'DxGrafik', 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 38px;
  letter-spacing: -0.02em;
  line-height: 1.0;
  color: #000;
  margin-bottom: 10px;
}
.dialog-headline .accent { color: #FF6138; }
.dialog-body { font-size: 14px; line-height: 1.6; opacity: 0.6; margin-bottom: 24px; font-family: 'PPNeueMontreal', 'DM Sans', sans-serif; }
.dialog input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: 'PPNeueMontreal', 'DM Sans', sans-serif;
  border: 1px solid #000;
  border-radius: 0;
  background: transparent;
  outline: none;
  margin-bottom: 12px;
  transition: border-color .15s;
  color: #000;
}
.dialog input:focus { border-color: #1A00FF; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-btn-primary {
  flex: 1;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: 'DM Sans', 'PPNeueMontreal', sans-serif;
  background: #000;
  color: #fff;
  border: 1px solid #000;
  border-radius: 40px;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.dialog-btn-primary:hover { background: #1A00FF; border-color: #1A00FF; }
.dialog-btn-skip {
  padding: 12px 20px;
  font-size: 13px;
  font-family: 'PPNeueMontreal', 'DM Sans', sans-serif;
  background: transparent;
  color: #000;
  border: 1px solid #000;
  border-radius: 40px;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity .2s;
}
.dialog-btn-skip:hover { opacity: 0.7; }

/* ── Hero stat chip animations ──────────────────────── */
@keyframes float-a { 0%,100%{transform:translateY(0px) rotate(0deg);} 50%{transform:translateY(-9px) rotate(1.5deg);} }
@keyframes float-b { 0%,100%{transform:translateY(-5px) rotate(-1deg);} 50%{transform:translateY(6px) rotate(0.8deg);} }
@keyframes float-c { 0%,100%{transform:translateY(3px) rotate(0.5deg);} 50%{transform:translateY(-7px) rotate(-1.5deg);} }
@keyframes float-d { 0%,100%{transform:translateY(-7px) rotate(-0.5deg);} 50%{transform:translateY(5px) rotate(1.2deg);} }
@keyframes deco-sparkle {
  0%, 60%, 100% { transform: rotate(var(--r, 0deg)) scale(1);                  opacity: 1;    }
  65%            { transform: rotate(calc(var(--r, 0deg) + 32deg)) scale(1.22); opacity: 1;    }
  69%            { transform: rotate(calc(var(--r, 0deg) + 44deg)) scale(0.82); opacity: 0.7;  }
  73%            { transform: rotate(calc(var(--r, 0deg) + 38deg)) scale(1.14); opacity: 1;    }
  78%            { transform: rotate(calc(var(--r, 0deg) + 32deg)) scale(1);    opacity: 0.85; }
}
.hero-deco { position: absolute; pointer-events: none; z-index: 2; }
.hero-deco-svg { display: block; overflow: visible; animation: deco-sparkle 8s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .cell-launch { transition: none; }
  .hero-deco-svg { animation: none !important; transform: rotate(var(--r, 0deg)); }
}

/* ══════════════════════════════════════════════════════════
   Admin console (standalone page at /admin/)
   ══════════════════════════════════════════════════════════ */
.admin-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.admin-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid #000;
  background: #FFEAD2;
}
.admin-bar .admin-title {
  font-family: 'DxGrafik', 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.015em;
  margin-right: auto;
}
.admin-bar .admin-dirty { font-family: 'DM Sans', sans-serif; font-size: 12px; color: #FF6138; margin-right: 8px; opacity: 0; transition: opacity .2s; }
.admin-bar .admin-dirty.show { opacity: 1; }
.admin-bar .admin-saved { font-family: 'DM Sans', sans-serif; font-size: 12px; color: #1A00FF; margin-right: 8px; opacity: 0; transition: opacity .2s; }
.admin-bar .admin-saved.show { opacity: 1; }

.admin-layout { flex: 1; min-height: 0; display: flex; }
.admin-form { flex: 1; min-width: 0; overflow-y: auto; padding: 24px; }
.admin-form-inner { max-width: 680px; }

.admin-preview {
  width: 46%;
  max-width: 720px;
  flex-shrink: 0;
  border-left: 1px solid #000;
  background: #FFEAD2;
  padding: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-preview .preview-label { font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.55; }
.preview-stage { overflow: hidden; border: 1px solid #000; flex-shrink: 0; }
#previewFrame { border: 0; display: block; }

.admin-section { margin-bottom: 32px; }
.admin-section > h3 {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #000;
}

.admin-field { margin-bottom: 14px; }
.admin-field label { display: block; font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 500; margin-bottom: 5px; }
.admin-page input[type="text"],
.admin-page input[type="url"],
.admin-page textarea,
.admin-page select {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: 'PPNeueMontreal', 'DM Sans', sans-serif;
  border: 1px solid #000;
  border-radius: 8px;
  background: transparent;
  outline: none;
  color: #000;
}
.admin-page textarea { resize: vertical; min-height: 56px; line-height: 1.4; }
.admin-page input:focus, .admin-page textarea:focus, .admin-page select:focus { border-color: #1A00FF; }

.admin-tool { border: 1px solid #000; border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.admin-tool.off { opacity: 0.6; }
.admin-tool-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.admin-tool-head .admin-tool-name { font-family: 'DxGrafik', 'Space Grotesk', sans-serif; font-weight: 600; font-size: 18px; margin-right: auto; }
.admin-row { display: flex; gap: 12px; flex-wrap: wrap; }
.admin-row > .admin-field { flex: 1; min-width: 120px; }

.brand-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch-opt {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  background: var(--sw);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: transform .12s ease;
}
.swatch-opt:hover { transform: scale(1.12); }
.swatch-opt:focus-visible { outline: 2px solid #1A00FF; outline-offset: 2px; }
.swatch-opt.selected { box-shadow: 0 0 0 2px #FFEAD2, 0 0 0 3px #000; }
.swatch-opt.selected::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--check, #000);
}

.admin-toggle { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.admin-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.admin-toggle .track { width: 38px; height: 22px; border-radius: 999px; border: 1px solid #000; background: transparent; position: relative; transition: background .2s; flex-shrink: 0; }
.admin-toggle .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #000; transition: transform .2s, background .2s; }
.admin-toggle input:checked + .track { background: #1A00FF; border-color: #1A00FF; }
.admin-toggle input:checked + .track::after { transform: translateX(16px); background: #fff; }
.admin-toggle .track-label { font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 500; }

.admin-btn {
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', 'PPNeueMontreal', sans-serif;
  border: 1px solid #000;
  border-radius: 40px;
  background: transparent;
  color: #000;
  cursor: pointer;
  transition: background .2s, color .2s, opacity .2s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.admin-btn:hover { background: #000; color: #FFEAD2; }
.admin-btn.primary { background: #000; color: #fff; }
.admin-btn.primary:hover { background: #1A00FF; border-color: #1A00FF; }
.admin-btn.icon { padding: 6px 10px; font-size: 14px; border-radius: 8px; }
.admin-btn.icon:disabled { opacity: 0.3; cursor: default; }
.admin-btn.icon:disabled:hover { background: transparent; color: #000; }
.admin-btn.danger:hover { background: #FF6138; border-color: #FF6138; color: #fff; }
.admin-add { width: 100%; padding: 12px; border-style: dashed; justify-content: center; }

@media (max-width: 900px) {
  .admin-preview { display: none; }
}
