@import url("https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700;900&family=Crimson+Pro:ital,wght@0,400;0,600;1,400&family=Share+Tech+Mono&display=swap");

/* ═══════════════════════════════════════════════════════════
   Common stylesheet for every page in "Where The X am AI?"
   Source of truth: improvements/styles.css
   Deployed copies: html/styles.css, service/aime/frontend/styles.css

   Sections:
     1. Design tokens / reset / base (shared)
     2. Landing page  (html/index.html)
     3. Chat page     (service/aime/frontend/index.html)
   ═══════════════════════════════════════════════════════════ */

/* ─── 1. Design Tokens ──────────────────────────────────── */

:root {
  --gold:       #D4A017;
  --gold-lt:    #FFD700;
  --gold-dim:   #8B6914;
  --parchment:  #1a1005;
  --ink:        #0d0802;
  --circuit:    #2a1e00;
  --text:       #e8d5a0;
  --text-dim:   #9a8050;
  --shadow:     0 20px 60px rgba(0, 0, 0, 0.6);
  --serif:      "Crimson Pro", Georgia, serif;
  --sans:       "Share Tech Mono", system-ui, sans-serif;
}

/* ─── Reset ─────────────────────────────────────────────── */

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

/* ─── Base ──────────────────────────────────────────────── */

html, body {
  min-height: 100%;
  background: var(--ink);
  color: var(--text);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  position: relative;
  overflow-x: hidden;
}

/* Scanline overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.08) 3px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 999;
}

/* Circuit grid background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--circuit) 1px, transparent 1px),
    linear-gradient(90deg, var(--circuit) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  pointer-events: none;
}

/* Shared X-mark accent */
.x-mark {
  color: var(--gold-lt);
  font-weight: 700;
  letter-spacing: 0.12em;
}

/* ─── Shared keyframes ──────────────────────────────────── */

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-12px); }
}

@keyframes pulse-ring {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50%       { opacity: 0.5;  transform: scale(1.04); }
}

@keyframes flicker {
  0%, 92%, 95%, 100% { opacity: 1; }
  93%                 { opacity: 0.85; }
  94%                 { opacity: 1; }
}

@keyframes spin-wobble {
  0%, 100% { transform: rotate(0deg)  scale(1); }
  25%       { transform: rotate(3deg)  scale(1.05); }
  75%       { transform: rotate(-3deg) scale(1.05); }
}


/* ═══════════════════════════════════════════════════════════
   2. LANDING PAGE  (html/index.html)
   ═══════════════════════════════════════════════════════════ */

main {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  gap: 2rem;
}

/* ─── Hero Icon ──────────────────────────────────────────── */

.icon-hero {
  position: relative;
  width: 160px;
  height: 160px;
  animation: float 4s ease-in-out infinite;
}

.icon-hero svg {
  width: 100%;
  height: 100%;
}

.icon-hero::before {
  content: "";
  position: absolute;
  inset: -14px;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  animation: pulse-ring 3s ease-in-out infinite;
}

.icon-hero::after {
  content: "";
  position: absolute;
  inset: -28px;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  opacity: 0.4;
  animation: pulse-ring 3s ease-in-out 0.6s infinite;
}

/* ─── Headline ───────────────────────────────────────────── */

.headline {
  font-family: "Cinzel Decorative", serif;
  font-weight: 900;
  font-size: clamp(2rem, 6vw, 4rem);
  color: var(--gold);
  text-align: center;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-shadow: rgba(212, 160, 23, 0.3) 0px 0px 40px;
  animation: flicker 8s ease-in-out infinite;
}

.headline .x-mark {
  color: var(--gold-lt);
  display: inline-block;
  animation: spin-wobble 6s ease-in-out infinite;
}

/* ─── Subtitle ───────────────────────────────────────────── */

.subtitle {
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(0.75rem, 2vw, 1rem);
  color: var(--text-dim);
  letter-spacing: 0.25em;
  text-align: center;
  text-transform: uppercase;
}

/* ─── Slogan ─────────────────────────────────────────────── */

.slogan {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-size: clamp(14px, 2.5vw, 20px);
  line-height: 1.4;
  letter-spacing: 0.08em;
  color: rgba(255, 215, 120, 0.85);
  margin-top: 0;
  gap: 0.3em;
}

.slogan span      { display: block; }
.slogan .highlight { font-style: italic; opacity: 0.95; }

/* ─── Divider ────────────────────────────────────────────── */

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: min(480px, 90%);
}

.divider-line {
  flex: 1;
  height: 1px;
  background: var(--gold-dim);
  opacity: 0.4;
}

.divider-node {
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--gold);
}

/* ─── Map Card ───────────────────────────────────────────── */

.map-card {
  width: min(520px, 90%);
  background: rgba(26, 16, 5, 0.8);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  padding: 2rem 2.5rem;
  position: relative;
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--text);
}

/* Inner dashed border */
.map-card::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(139, 105, 20, 0.25);
  border-radius: 2px;
  pointer-events: none;
}

/* Corner dots */
.map-card .corner {
  position: absolute;
  width: 10px;
  height: 10px;
}

.map-card .corner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gold);
  border-radius: 50%;
}

.map-card .corner.tl { top: -1px;    left: -1px; }
.map-card .corner.tr { top: -1px;    right: -1px; }
.map-card .corner.bl { bottom: -1px; left: -1px; }
.map-card .corner.br { bottom: -1px; right: -1px; }

.map-card p + p { margin-top: 1rem; }

.map-card em {
  color: var(--gold);
  font-style: italic;
}

.map-card code {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.85em;
  color: var(--gold-lt);
  background: rgba(255, 215, 0, 0.08);
  padding: 1px 5px;
  border-radius: 2px;
}

/* ─── Swatch Row ─────────────────────────────────────────── */

.swatch-row {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.swatch img,
.swatch svg {
  image-rendering: pixelated;
  border-radius: 4px;
}

.swatch-label {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
}

/* ─── Footer ─────────────────────────────────────────────── */

footer {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-align: center;
  padding-bottom: 1.5rem;
  opacity: 0.6;
  line-height: 2;
}

footer a {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px dashed var(--gold-dim);
  transition: color 0.2s, border-color 0.2s;
}

footer a:visited { color: var(--text-dim); }

footer a:hover,
footer a:active {
  color: var(--gold-lt);
  border-bottom-color: var(--gold);
}

footer .footer-divider {
  display: inline-block;
  margin: 0 0.5em;
  color: var(--gold-dim);
  opacity: 0.5;
}

footer .attribution {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  opacity: 0.75;
  font-weight: 700;
}

footer .attribution em {
  color: var(--gold);
  font-style: normal;
}


/* ═══════════════════════════════════════════════════════════
   3. CHAT PAGE  (service/aime/frontend/index.html)
   ═══════════════════════════════════════════════════════════ */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  align-items: center;
  padding: 56px 64px;
}

@media (max-width: 900px) {
  .stage {
    grid-template-columns: 1fr;
    padding: 32px 20px;
    gap: 28px;
  }
}

/* ─── Profile ────────────────────────────────────────────── */

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.oval-mat {
  position: relative;
  width: 220px;
  height: 260px;
  border-radius: 50%;
  background: var(--parchment);
  padding: 12px;
  box-shadow: var(--shadow), inset 0 0 0 2px var(--gold-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold);
  /* gentle float + breathing gold aura, echoing the hero icon */
  animation: float 5s ease-in-out infinite, mat-glow 4s ease-in-out infinite;
}

@keyframes mat-glow {
  0%, 100% { box-shadow: var(--shadow), inset 0 0 0 2px var(--gold-dim), 0 0 0 rgba(212,160,23,0); }
  50%      { box-shadow: var(--shadow), inset 0 0 0 2px var(--gold-dim), 0 0 28px rgba(212,160,23,0.28); }
}

/* faint pulsing ring around the portrait, like the hero's ring */
.oval-mat::before {
  content: '';
  position: absolute;
  inset: -12px;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
  animation: pulse-ring 3s ease-in-out infinite;
}

.oval-mat img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--parchment);
  filter: sepia(0.3) contrast(1.1); /* slight map/vintage filter */
}

.info-card {
  width: 240px;
  background: rgba(26, 16, 5, 0.85);
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  padding: 14px 20px;
  text-align: center;
  box-shadow: var(--shadow);
  position: relative;
}

.info-card::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(139, 105, 20, 0.25);
  border-radius: 2px;
  pointer-events: none;
}

.info-name {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  text-shadow: 0 0 24px rgba(212,160,23,0.35); /* gold glow, like the headline */
}

.info-dob {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Back to the map — mirrors the footer links. Every state is set
   explicitly so the browser never falls back to default link colors. */
.back-link,
.back-link:link,
.back-link:visited,
.back-link:hover,
.back-link:focus,
.back-link:active {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 1px dashed var(--gold-dim);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.back-link:hover,
.back-link:focus,
.back-link:active {
  color: var(--gold-lt);
  border-bottom-color: var(--gold);
}
.back-link .x-mark { color: var(--gold-lt); margin-right: 0.15em; }

/* ─── Painting frame ─────────────────────────────────────── */

.frame {
  position: relative;
  padding: 26px;
  border-radius: 8px;
  background: linear-gradient(145deg, #2a1a0a 0%, var(--parchment) 40%, #0d0802 100%);
  border: 1px solid var(--gold-dim);
  box-shadow:
    var(--shadow),
    inset 0 0 0 2px var(--gold-dim);
}

/* glowing corner nodes, echoing the map-card */
.frame .corner { position: absolute; width: 10px; height: 10px; z-index: 2; }
.frame .corner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--gold);
}
.frame .corner.tl { top: -3px;    left: -3px;   }
.frame .corner.tr { top: -3px;    right: -3px;  }
.frame .corner.bl { bottom: -3px; left: -3px;   }
.frame .corner.br { bottom: -3px; right: -3px;  }

.frame-inner {
  position: relative;
  background: rgba(13, 8, 2, 0.6);
  border: 1px dashed rgba(139, 105, 20, 0.3);
  border-radius: 4px;
  padding: 28px 30px 22px;
  height: 600px;
  max-height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
}

.frame-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  color: var(--gold);
  margin-bottom: 14px;
  letter-spacing: 0.04em;
  text-shadow: 0 0 30px rgba(212,160,23,0.3); /* gold glow, matching .headline */
  animation: flicker 8s ease-in-out infinite;  /* same subtle flicker as the landing page */
}

.frame-title .x-mark {
  display: inline-block;
  animation: spin-wobble 6s ease-in-out infinite;
}

.frame-title::after {
  content: "";
  display: block;
  width: 80px;
  height: 1px;
  background: var(--gold-dim);
  margin: 8px auto 0;
  opacity: 0.6;
}

/* ─── Chat ───────────────────────────────────────────────── */

.chat {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 4px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-dim) transparent;
}

.chat::-webkit-scrollbar {
  width: 8px;
}
.chat::-webkit-scrollbar-track {
  background: transparent;
}
.chat::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 4px;
}
.chat::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

.bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 1.05rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: bubble-in 0.35s ease both; /* gentle reveal */
}

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubble.user {
  align-self: flex-end;
  background: var(--parchment);
  border: 1px solid var(--gold-dim);
  color: var(--text);
}

.bubble.ai {
  align-self: flex-start;
  background: rgba(42, 30, 0, 0.4);
  border: 1px solid rgba(214, 160, 23, 0.3);
  color: var(--text);
}

.bubble.ai.refusal {
  background: rgba(139, 74, 43, 0.2);
  border-color: #ff6b6b;
  color: #ffb3b3;
}

.bubble.typing {
  font-family: var(--sans);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

/* ─── Composer ───────────────────────────────────────────── */

.composer {
  display: flex;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px dashed rgba(139, 105, 20, 0.3);
}

.input {
  flex: 1;
  font-family: var(--serif);
  font-size: 1.1rem;
  padding: 12px 16px;
  border-radius: 4px;
  background: rgba(13, 8, 2, 0.6);
  border: 1px solid var(--gold-dim);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input::placeholder {
  color: var(--text-dim);
  opacity: 0.7;
  font-style: italic;
}

.input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-dim), 0 0 18px rgba(212,160,23,0.22);
}

.send {
  flex-shrink: 0;
  align-self: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--gold-dim);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.send:hover {
  background: rgba(212, 160, 23, 0.12);
  border-color: var(--gold);
}

.send:active {
  transform: scale(0.93);
}

.send svg {
  width: 18px;
  height: 18px;
}

.send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.counter {
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: right;
  margin-top: 6px;
  letter-spacing: 0.1em;
}

/* ─── Site footer (mirrors the landing footer) ───────────── */

.site-footer {
  position: relative;
  z-index: 1;
  font-family: var(--sans);
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-align: center;
  padding: 0 1.5rem 1.75rem;
  opacity: 0.65;
  line-height: 2;
}

.site-footer a,
.site-footer a:link,
.site-footer a:visited {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px dashed var(--gold-dim);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.site-footer a:hover,
.site-footer a:focus,
.site-footer a:active {
  color: var(--gold-lt);
  border-bottom-color: var(--gold);
}

.site-footer .footer-divider {
  display: inline-block;
  margin: 0 0.5em;
  color: var(--gold-dim);
  opacity: 0.5;
}

.site-footer .attribution {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  opacity: 0.75;
  font-weight: 700;
}
.site-footer .attribution em {
  color: var(--gold);
  font-style: normal;
}
