/* oddo.cloud homepage */

:root {
  color-scheme: light dark;
  --lift: -14vh;   /* fallback composition sits above the copy on phones */
  --shift: 0px;    /* ...and to the right of it on wide screens */

  /* Page: ivory with the shield's navy and gold */
  --bg: #f4f0e6;
  --bg-2: #ebe4d3;
  --fg: #10204a;
  --fg-muted: #5a6180;
  --line: rgba(16, 32, 74, 0.12);
  --card: rgba(255, 255, 255, 0.55);

  /* Brand */
  --accent: #c99f2a;          /* gold button */
  --accent-ink: #0b1a3d;      /* navy text on gold */
  --accent-soft: rgba(201, 159, 42, 0.18);
  --eyebrow: #9a7a1b;

  /* 3D scene colours (read by main.js) */
  --gold: #d6ab3c;
  --gold-light: #f6dd8a;
  --navy: #0b1f5c;
  --ring: #c99f2a;
  --dots: #7a86ab;
  --sky: #fff8ea;
  --ground: #9aa3bf;

  --shadow: 0 18px 50px rgba(16, 32, 74, 0.18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070d1f;
    --bg-2: #0d1736;
    --fg: #f3eedd;
    --fg-muted: #a7acc2;
    --line: rgba(243, 238, 221, 0.12);
    --card: rgba(255, 255, 255, 0.05);

    --accent: #e2b93b;
    --accent-ink: #0b1a3d;
    --accent-soft: rgba(226, 185, 59, 0.18);
    --eyebrow: #e2b93b;

    --gold: #e2b93b;
    --gold-light: #ffe9a6;
    --navy: #122a74;
    --ring: #e2b93b;
    --dots: #c9b26a;
    --sky: #3a4a86;
    --ground: #05091a;

    --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

/* Header */
.top {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(14px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
  pointer-events: none;
}
.top > * { pointer-events: auto; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.brand-mark {
  width: 26px; height: 26px; border-radius: 50%;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25));
}
.brand-text { font-size: 15px; color: var(--fg); }

.nav-link {
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--fg-muted);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: color .2s, border-color .2s;
}
.nav-link:hover { color: var(--fg); border-color: var(--accent); }

/* Hero */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: calc(96px + env(safe-area-inset-top)) 20px 72px;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 55%);
}

.scene {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.scene canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  touch-action: pan-y;
  opacity: 0;
  transition: opacity .9s ease;
}
html.has-3d .scene canvas { opacity: 1; }

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  margin: 0 auto;
  text-align: center;
  /* leave room: the orb sits above the copy on phones, behind it on wide screens */
  padding-top: clamp(150px, 34vh, 300px);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--eyebrow);
}

.wordmark {
  margin: 0;
  font-size: clamp(64px, 14vw, 148px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.95;
  color: var(--fg);
  text-shadow: 0 1px 0 rgba(255,255,255,0.25);
}
@media (prefers-color-scheme: dark) { .wordmark { text-shadow: none; } }

.tagline {
  margin: 18px auto 0;
  max-width: 34ch;
  font-size: clamp(17px, 2.2vw, 21px);
  color: var(--fg-muted);
}
.tagline br { display: none; }
@media (min-width: 560px) { .tagline br { display: inline; } }

.actions {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 26px 15px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 17px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.button:active { transform: translateY(0); }
.button:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.button-glyph {
  width: 10px; height: 10px; border-radius: 50%;
  background: currentColor;
  opacity: .85;
  box-shadow: 0 0 0 4px rgba(11,26,61,0.18);
}

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--fg-muted);
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1;
  width: 26px; height: 42px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  opacity: .8;
}
.scroll-cue span {
  position: absolute; left: 50%; top: 8px;
  width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px;
  background: var(--fg-muted);
  animation: cue 2.2s ease-in-out infinite;
}
@keyframes cue { 0%, 100% { transform: translateY(0); opacity: .9; } 55% { transform: translateY(14px); opacity: .2; } }

/* Wide, landscape screens: copy on the left, orb on the right. */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  :root { --lift: 0px; --shift: min(22vw, 430px); }
  .hero { padding-top: calc(72px + env(safe-area-inset-top)); }
  .hero-copy { padding-top: 0; text-align: left; width: min(100%, 1100px); }
  .hero-copy > * { max-width: 580px; }
  .tagline { margin-left: 0; }
  .actions { align-items: flex-start; }
  .hint { padding-left: 6px; }
}

/* Static fallback (no WebGL, or before the canvas fades in) */
.fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity .9s ease;
}
html.has-3d .fallback { opacity: 0; }

.fallback-shield {
  width: clamp(190px, 38vmin, 340px);
  height: auto;
  filter: drop-shadow(0 30px 60px rgba(16, 32, 74, 0.35));
  animation: breathe 7s ease-in-out infinite;
  transform: translate(var(--shift), var(--lift));
}

.fallback-ring {
  position: absolute;
  width: clamp(290px, 60vmin, 560px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--ring) 45%, transparent);
  transform: translate(var(--shift), var(--lift)) rotateX(62deg);
}

.fallback-dot {
  position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  top: 50%; left: 50%;
  margin: -8px 0 0 -8px;
  --r: clamp(145px, 30vmin, 280px);
  animation: orbit 26s linear infinite;
  animation-delay: var(--d);
}
.fallback-dot { background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold) 70%); }
.fallback-dot.d1 { --d: 0s; }
.fallback-dot.d2 { --d: -5.2s; }
.fallback-dot.d3 { --d: -10.4s; }
.fallback-dot.d4 { --d: -15.6s; }
.fallback-dot.d5 { --d: -20.8s; }

@keyframes orbit {
  from { transform: translate(var(--shift), var(--lift)) rotate(0turn) translateX(var(--r)); }
  to   { transform: translate(var(--shift), var(--lift)) rotate(1turn) translateX(var(--r)); }
}
@keyframes breathe { 0%, 100% { transform: translate(var(--shift), var(--lift)) scale(1); } 50% { transform: translate(var(--shift), var(--lift)) scale(1.04); } }

/* About + footer */
.about {
  position: relative;
  padding: 56px 20px 40px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.about-grid {
  width: min(100%, 980px);
  margin: 0 auto;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card {
  padding: 22px 22px 20px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
}
.card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.card p { margin: 0; color: var(--fg-muted); font-size: 15.5px; }

.foot {
  padding: 24px 20px calc(28px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 13px;
  color: var(--fg-muted);
}
.foot p { margin: 0; }

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  .scroll-cue span, .fallback-shield, .fallback-dot { animation: none; }
  .fallback-dot { transform: translate(var(--shift), var(--lift)) rotate(var(--a)) translateX(var(--r)); }
  .fallback-dot.d1 { --a: 0turn; }
  .fallback-dot.d2 { --a: .2turn; }
  .fallback-dot.d3 { --a: .4turn; }
  .fallback-dot.d4 { --a: .6turn; }
  .fallback-dot.d5 { --a: .8turn; }
  .scene canvas, .fallback, .button { transition: none; }
}

/* Call-to-action variants (home.js toggles these) */
.hidden { display: none !important; }

.apple-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 28px 15px 22px;
  border-radius: 999px;
  background: #000;
  color: #fff;
  font-weight: 600;
  font-size: 17px;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .2s ease, filter .2s ease;
}
.apple-button:hover { transform: translateY(-1px); filter: brightness(1.15); }
.apple-button:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.apple-logo { width: 18px; height: 18px; fill: currentColor; margin-top: -2px; }
@media (prefers-color-scheme: dark) {
  .apple-button { background: #fff; color: #000; }
  .apple-button:hover { filter: brightness(0.95); }
}

.alt-link {
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.alt-link:hover { color: var(--fg); }
@media (prefers-reduced-motion: reduce) { .apple-button { transition: none; } }

/* ===== Ask Oddo AI ===== */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.ask { margin-top: 26px; width: 100%; }

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.composer:focus-within { border-color: var(--accent); }
.composer input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 17px;
  padding: 10px 0;
  outline: none;
}
.composer input::placeholder { color: var(--fg-muted); }
.composer input:disabled { cursor: not-allowed; }
.send {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease, opacity .2s;
}
.send svg { width: 20px; height: 20px; }
.send:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.05); }
.send:disabled { opacity: .45; cursor: not-allowed; }
.composer.busy .send { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .6; } 50% { opacity: 1; } }

.ask .actions { margin-top: 18px; }

.signed {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 14px;
  color: var(--fg-muted);
}
.signed a, .linkish {
  color: var(--fg-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
}
.signed a:hover, .linkish:hover { color: var(--fg); }

.thread {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(46vh, 420px);
  overflow-y: auto;
  padding: 4px 2px;
  text-align: left;
  scrollbar-width: thin;
}
.msg {
  max-width: 88%;
  padding: 11px 15px;
  border-radius: 18px;
  font-size: 15.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-ink);
  border-bottom-right-radius: 6px;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--fg);
  border-bottom-left-radius: 6px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.msg.error { align-self: flex-start; background: transparent; color: var(--fg-muted); font-size: 14px; padding: 4px 2px; }
.msg.pending { opacity: .7; }

/* ===== Games ===== */
.games {
  position: relative;
  padding: 64px 20px 56px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.games-inner { width: min(100%, 980px); margin: 0 auto; text-align: center; }
.games h2 {
  margin: 6px 0 10px;
  font-size: clamp(32px, 5vw, 44px);
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.games-lead { margin: 0 auto 28px; max-width: 48ch; color: var(--fg-muted); }
.games-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.game {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 24px 22px 20px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  text-decoration: none;
  text-align: left;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.game:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.game-icon { font-size: 34px; line-height: 1; margin-bottom: 6px; }
.game-icon.big { font-size: 64px; display: block; margin: 0 auto 10px; }
.game-title { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; color: var(--fg); }
.game-desc { color: var(--fg-muted); font-size: 15px; }
.game-tag {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--eyebrow);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Placeholder game pages */
.game-page { background: var(--bg); }
.game-main {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: calc(96px + env(safe-area-inset-top)) 20px 60px;
  gap: 8px;
}
.game-main h1 { margin: 0; font-size: clamp(44px, 9vw, 80px); letter-spacing: -0.04em; line-height: 1; }
.game-main .tagline { margin-top: 8px; }
.game-soon { color: var(--fg-muted); margin: 8px 0 22px; }

@media (prefers-reduced-motion: reduce) {
  .composer.busy .send { animation: none; }
  .game, .send { transition: none; }
}

/* Mac app page */
.game-main .fallback-shield { width: 160px; height: 160px; animation: none; transform: none; margin-bottom: 6px; }
