/* ============================================================
   Cyncerity — Stylesheet v5.0
   Palette: warm paper / ink / amber
   Fonts: Cormorant Garamond + DM Mono + Instrument Sans
   ============================================================ */

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

:root {
  --ink:          #1a1714;
  --ink-faint:    #4a4540;
  --ink-dim:      rgba(26,23,20,0.35);
  --paper:        #f5f0e8;
  --paper-warm:   #ede8dc;
  --paper-deep:   #e4ddd0;
  --amber:        #c8873a;
  --amber-light:  #e8a85a;
  --amber-pale:   #f7e8d4;
  --rule:         rgba(26,23,20,0.12);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-ui:      'Instrument Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;

  --radius:    8px;
  --shadow:    0 2px 12px rgba(26,23,20,0.10);
}

/* ── Noise texture ─────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

body {
  font-family: var(--font-ui);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Header ────────────────────────────────────────────────── */
header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--rule);
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo-dot {
  color: var(--amber);
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.nav-link:hover { color: var(--ink); }

/* ── Main ──────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 2rem 4rem;
}

/* ── Hero line ─────────────────────────────────────────────── */
.hero-line {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 300;
  font-style: italic;
  color: var(--ink-faint);
  line-height: 1.5;
  margin-bottom: 2.5rem;
  max-width: 520px;
}

/* ── Input area ────────────────────────────────────────────── */
.input-area {
  margin-bottom: 2rem;
}

.message-input {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  resize: vertical;
  min-height: 140px;
  transition: border-color 0.2s;
}
.message-input:focus {
  outline: none;
  border-color: var(--amber);
}
.message-input::placeholder {
  color: var(--ink-dim);
  font-style: italic;
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
}

.input-footer-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.shortcut-hint {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--ink-dim);
  opacity: 0.5;
}

.word-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.analyse-btn {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--paper);
  background: var(--ink);
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.8rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}
.analyse-btn:hover:not(:disabled) {
  opacity: 0.85;
}
.analyse-btn:active:not(:disabled) {
  transform: scale(0.97);
}
.analyse-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ── Loading ───────────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 3rem 0;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--rule);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--ink-faint);
}

/* ── Result ────────────────────────────────────────────────── */
.result {
  padding-top: 1rem;
}

.mirror-line {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink);
  padding: 2rem 0;
  border-top: 1px solid var(--rule);
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Emotion + Need ────────────────────────────────────────── */
.emotion-need {
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
  animation: fadeIn 0.6s ease-out 0.15s both;
}

.emotion-text {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.emotion-text strong {
  color: var(--amber);
  font-weight: 500;
}

.need-text {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--ink-faint);
  font-style: italic;
}

/* ── Tell me more ──────────────────────────────────────────── */
.tell-more-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.5rem 1.2rem;
  cursor: pointer;
  margin-top: 1rem;
  transition: border-color 0.2s, color 0.2s;
  animation: fadeIn 0.6s ease-out 0.3s both;
}
.tell-more-btn:hover {
  border-color: var(--ink-dim);
  color: var(--ink);
}

.detail-panel {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--paper-warm);
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  animation: fadeIn 0.4s ease-out;
}

.detail-content {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--ink);
}

.detail-section {
  margin-bottom: 1.25rem;
}
.detail-section:last-child { margin-bottom: 0; }

.detail-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 1rem;
}

.detail-value {
  color: var(--ink);
}

.detail-score-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.detail-spectrum {
  margin-bottom: 1rem;
}

.detail-spectrum-bar {
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.detail-spectrum-labels {
  display: flex;
  justify-content: space-between;
}

.detail-spectrum-low,
.detail-spectrum-high {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
}

.detail-spectrum-low.active,
.detail-spectrum-high.active {
  color: var(--ink);
}

.detail-score-label {
  font-size: 0.85rem;
  color: var(--ink-faint);
  min-width: 160px;
}

.detail-score-bar {
  flex: 1;
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.detail-score-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease-out;
}

/* ── Reset button ──────────────────────────────────────────── */
.reset-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-dim);
  background: none;
  border: none;
  cursor: pointer;
  margin-top: 2rem;
  padding: 0;
  transition: color 0.2s;
  animation: fadeIn 0.6s ease-out 0.45s both;
}
.reset-btn:hover { color: var(--ink); }

/* ── Footer ────────────────────────────────────────────────── */
footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--rule);
}

.footer-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
}

.disclaimer {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
  line-height: 1.5;
}
.disclaimer a {
  color: var(--ink-faint);
}

.footer-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-dim);
  text-decoration: none;
  flex-shrink: 0;
}
.footer-link:hover { color: var(--ink-faint); }

/* ── About & Privacy pages ─────────────────────────────────── */
.page-content {
  max-width: 560px;
}

.page-content h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 2rem;
}

.page-content p {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: 1.25rem;
}

.page-content p.faint {
  color: var(--ink-faint);
  font-size: 0.9rem;
}

.page-content a {
  color: var(--amber);
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
  header { padding: 1rem 1.25rem; }
  main { padding: 2rem 1.25rem 3rem; }
  footer { padding: 1rem 1.25rem; }
  .footer-inner { flex-direction: column; gap: 0.75rem; }
  .hero-line { font-size: 1.15rem; }
  .mirror-line { font-size: 1.3rem; }
  .message-input { padding: 1rem 1.25rem; }
}
