/* ============================================================
   Synastri — åndelighet.no
   Felles stilark for bestillingsskjema + rapport
   ============================================================ */

:root {
  /* Brand-farger */
  --paper:      #F2E9D7;
  --paper-2:    #F9F2E4;
  --paper-3:    #ECE1CC;
  --ink:        #221B12;
  --ink-2:      #6B6051;
  --ink-3:      #9E927C;
  --accent:     #B0664A;   /* terrakotta — tweakbar */
  --accent-deep:#8F4F37;
  --espresso:   #38291D;
  --night:      #221A12;
  --star:       #ECD9A8;

  /* avledede toner */
  --hairline:   rgba(34, 27, 18, 0.14);
  --hairline-2: rgba(34, 27, 18, 0.08);
  --paper-shadow: rgba(56, 41, 29, 0.12);

  /* aspekt-farger */
  --asp-hard:   #B23A2E;   /* hardt — rødt */
  --asp-soft:   #3E6E8E;   /* harmonisk — blått */
  --asp-conj:   #C49A4A;   /* konjunksjon — gull */

  /* typografi */
  --display: "Cormorant Garamond", Georgia, serif;
  --body:    "Manrope", system-ui, -apple-system, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, monospace;

  --maxw: 720px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* subtil papirstruktur */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(176,102,74,0.05), transparent 38%),
    radial-gradient(circle at 82% 78%, rgba(56,41,29,0.05), transparent 42%);
}

::selection { background: rgba(176,102,74,0.22); color: var(--ink); }

/* ---------- Typografi-hjelpere ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
}
.eyebrow .spark { color: var(--accent); font-size: 0.9em; }

h1, h2, h3 { color: var(--ink); font-family: var(--display); font-weight: 500; }

.display {
  font-family: var(--display);
  color: var(--ink);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.01em;
}
.display em { font-style: italic; color: var(--accent-deep); }

a { color: var(--accent-deep); text-decoration-thickness: 1px; text-underline-offset: 2px; }

/* ---------- Knapper ---------- */
.btn {
  font-family: var(--body);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  border: none;
  border-radius: 999px;
  padding: 0.95em 1.7em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  text-decoration: none;
}
.btn-primary {
  background: var(--espresso);
  color: var(--paper-2);
  box-shadow: 0 6px 22px -8px rgba(56,41,29,0.55);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -10px rgba(56,41,29,0.6); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--hairline);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-deep); }

/* ---------- Layout-skall ---------- */
.shell {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) clamp(20px, 5vw, 40px);
}

/* Stjerne-divider */
.starline {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-3);
  margin: clamp(34px, 6vw, 56px) 0;
}
.starline::before, .starline::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--hairline);
}
.starline .glyph { color: var(--accent); font-size: 0.9rem; }

/* footer-band */
.footer-band {
  background: var(--paper-3);
  border-top: 1px solid var(--hairline);
}

/* ---------- Skjema-felt (brevaktig) ---------- */
.field { margin: 0 0 clamp(20px, 3vw, 26px); }
.field .ask {
  font-family: var(--display);
  font-size: clamp(1.5rem, 4.4vw, 1.85rem);
  color: var(--ink);
  line-height: 1.15;
  display: block;
  margin-bottom: 0.15em;
}
.field .hint {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  display: block;
  margin-bottom: 0.7em;
}
.input, .selectish {
  font-family: var(--body);
  font-size: 1.08rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--hairline);
  padding: 0.45em 0.1em;
  width: 100%;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.input::placeholder { color: var(--ink-3); opacity: 0.7; }
.input:focus, .selectish:focus {
  outline: none;
  border-bottom-color: var(--accent);
}
.field-row { display: grid; gap: clamp(16px, 3vw, 26px); }
@media (min-width: 560px) { .field-row.two { grid-template-columns: 1fr 1fr; } }

/* relasjonsvelger */
.rel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}
.rel-chip {
  font-family: var(--body);
  font-size: 0.96rem;
  text-align: left;
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  color: var(--ink-2);
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.rel-chip .rel-glyph { font-size: 1.2rem; color: var(--ink-3); transition: color 0.18s ease; }
.rel-chip .rel-name { font-weight: 600; color: var(--ink); }
.rel-chip .rel-sub { font-size: 0.78rem; color: var(--ink-3); }
.rel-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.rel-chip[aria-pressed="true"] {
  background: var(--espresso);
  border-color: var(--espresso);
}
.rel-chip[aria-pressed="true"] .rel-name,
.rel-chip[aria-pressed="true"] .rel-sub,
.rel-chip[aria-pressed="true"] .rel-glyph { color: var(--paper-2); }

/* person-kort */
.person-card {
  background: var(--paper-2);
  border: 1px solid var(--hairline-2);
  border-radius: 20px;
  padding: clamp(22px, 4vw, 34px);
  box-shadow: 0 14px 40px -28px var(--paper-shadow);
}
.person-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  display: inline-block;
}

.amp {
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(2.2rem, 7vw, 3rem);
  color: var(--ink-3);
  margin: 6px 0;
  line-height: 1;
}

/* ---------- Rapport-typografi ---------- */
.report-section { margin: clamp(38px, 6vw, 60px) 0; }
.report-section h2 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  line-height: 1.08;
  margin: 0 0 0.5em;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.report-body p {
  font-size: 1.0625rem;
  line-height: 1.7;
  margin: 0 0 1.1em;
  color: var(--ink-2);
  text-wrap: pretty;
}
.report-body p strong { color: var(--ink); font-weight: 600; }
.report-body p:first-of-type::first-letter {
  /* subtil drop-ingress kun på første avsnitt i en seksjon hvis ønsket */
}

.section-head {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
}
.section-glyph {
  font-size: 1.7rem;
  line-height: 1;
  color: var(--accent);
  text-align: center;
  padding-top: 0.18em;
  opacity: 0.92;
}
@media (max-width: 520px) {
  .section-head { grid-template-columns: 34px 1fr; gap: 10px; }
  .section-glyph { font-size: 1.4rem; }
}

/* sitatboks */
.pullquote {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.5rem, 4.5vw, 1.95rem);
  line-height: 1.32;
  color: var(--ink);
  margin: clamp(28px, 5vw, 44px) 0;
  padding-left: 22px;
  border-left: 2px solid var(--accent);
  text-wrap: balance;
}

/* aspekt-kort */
.aspect-card {
  background: var(--paper-2);
  border: 1px solid var(--hairline-2);
  border-radius: 16px;
  padding: 18px 20px;
  margin: 22px 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}
.aspect-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display);
  font-size: 1.5rem;
  color: var(--ink);
  white-space: nowrap;
}
.aspect-badge .op { font-size: 1.1rem; }
.aspect-card .aspect-meta {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.aspect-card .aspect-text { font-size: 0.96rem; line-height: 1.55; color: var(--ink-2); }
.op.hard { color: var(--asp-hard); }
.op.soft { color: var(--asp-soft); }
.op.conj { color: var(--asp-conj); }
.aspect-meta.hard { color: var(--asp-hard); }
.aspect-meta.soft { color: var(--asp-soft); }
.aspect-meta.conj { color: var(--asp-conj); }

/* ---------- Mørkt panel for kart ---------- */
.sky-panel {
  background: var(--night);
  border-radius: 22px;
  padding: clamp(20px, 4vw, 34px);
  margin: clamp(28px, 5vw, 44px) 0;
  box-shadow: 0 22px 60px -30px rgba(34,26,18,0.85);
  position: relative;
  overflow: hidden;
}
.sky-panel::after {
  /* svake stjerner */
  content: "";
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, var(--star), transparent),
    radial-gradient(1px 1px at 70% 20%, rgba(236,217,168,0.7), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(236,217,168,0.5), transparent),
    radial-gradient(1.4px 1.4px at 85% 65%, var(--star), transparent),
    radial-gradient(1px 1px at 55% 45%, rgba(236,217,168,0.6), transparent);
  opacity: 0.55;
  pointer-events: none;
}
.sky-panel .panel-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--star);
  opacity: 0.85;
  position: relative;
  z-index: 1;
}
.charts-duo {
  display: grid;
  gap: 18px;
  margin-top: 16px;
  position: relative;
  z-index: 1;
}
@media (min-width: 620px) { .charts-duo { grid-template-columns: 1fr 1fr; } }
.chart-frame { text-align: center; }
.chart-frame .chart-name {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.35rem;
  color: var(--star);
  margin-top: 6px;
}
.chart-frame .chart-sub {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  color: rgba(236,217,168,0.6);
}
.biwheel-wrap { margin-top: 22px; position: relative; z-index: 1; text-align: center; }

/* SVG kart-stiler */
.natal svg, .biwheel svg { width: 100%; height: auto; display: block; }

/* aspekt-tegnforklaring */
.aspect-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 22px;
  justify-content: center;
  margin-top: 16px;
  position: relative; z-index: 1;
}
.aspect-legend .leg {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(236,217,168,0.78);
}
.aspect-legend .swatch { width: 18px; height: 2px; border-radius: 2px; display: inline-block; }

/* ---------- Streaming-tilstand ---------- */
.writing-cue {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin: 4px 0;
}
.pulse-star {
  display: inline-block;
  color: var(--accent);
  animation: pulseStar 1.4s ease-in-out infinite;
}
@keyframes pulseStar {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.15); }
}
/* caret etter siste ord under skriving */
.live-caret {
  display: inline-block;
  width: 0.5em;
  color: var(--accent);
  animation: caretBlink 1s steps(1) infinite;
  font-style: normal;
}
@keyframes caretBlink { 50% { opacity: 0; } }

.cast-loading {
  text-align: center;
  padding: clamp(40px, 9vw, 80px) 0;
}
.cast-loading .orbit {
  width: 76px; height: 76px;
  margin: 0 auto 26px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  position: relative;
  animation: spinSlow 9s linear infinite;
}
.cast-loading .orbit::before {
  content: "✦";
  position: absolute;
  top: -9px; left: 50%;
  transform: translateX(-50%);
  color: var(--accent);
  font-size: 1.1rem;
}
.cast-loading .orbit::after {
  content: "";
  position: absolute;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--star);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 14px 2px rgba(236,217,168,0.6);
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
.cast-loading .cast-title {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--ink);
}
.cast-loading .cast-sub {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--ink-3);
  margin-top: 8px;
}

/* måneskive */
.moondisc {
  width: 34px; height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 64% 38%, var(--star), #cdb878 70%);
  box-shadow: inset -7px -3px 10px rgba(34,26,18,0.45), 0 0 0 1px var(--hairline);
  display: inline-block;
  flex: none;
}

/* sluttkort */
.report-coda {
  background: var(--paper-2);
  border: 1px solid var(--hairline-2);
  border-radius: 20px;
  padding: clamp(24px, 5vw, 36px);
  text-align: center;
  margin-top: clamp(34px, 6vw, 52px);
}
.report-coda .coda-name {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--ink);
}
.report-coda .coda-meta { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; color: var(--ink-3); margin-top: 4px; }
.coda-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 22px 0 18px; }
.disclaimer {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-3);
  max-width: 40ch;
  margin: 0 auto;
  line-height: 1.5;
}

/* ---------- PRINT ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  body { background: #fff; font-size: 11.5pt; }
  body::before { display: none; }
  .no-print { display: none !important; }
  .shell { max-width: 100%; padding: 0; }
  .sky-panel {
    background: #fff;
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
  .sky-panel::after { display: none; }
  .sky-panel .panel-label, .chart-frame .chart-name, .chart-frame .chart-sub { color: var(--ink); }
  .aspect-legend .leg { color: var(--ink-2); }
  .natal .ring-bg, .biwheel .ring-bg { fill: #fff !important; }
  .natal text, .biwheel text { fill: var(--ink) !important; }
  .report-section { break-inside: avoid-page; }
  .pullquote { break-inside: avoid; }
  .aspect-card { background: #fff; border: 1px solid #ccc; break-inside: avoid; }
  .person-card, .report-coda { box-shadow: none; }
}
