/* LaFonten — studio site.
   The page itself is a neutral "paper" canvas; each product block carries
   its own app's palette (Ariadne: cream / navy / amethyst / gold thread,
   +3-1: white / iOS blue / green + / orange -) so the apps read as themselves. */

:root {
  color-scheme: light;
  --paper: #f6f4ef;
  --ink: #12141a;
  --ink-soft: #4a4f5c;
  --line: rgba(18, 20, 26, 0.1);
  --card: #ffffff;

  /* Ariadne (from mobile/src/theme/colors.js) */
  --ar-bg: #f8f1ea;
  --ar-glow: #efe6f7;
  --ar-text: #1b1a33;
  --ar-muted: #6b6785;
  --ar-purple: #8c7cd6;
  --ar-purple-deep: #6c5cc4;
  --ar-navy: #232049;
  --ar-gold: #d39a3c;

  /* +3-1 (from README design system) */
  --p31-blue: #007aff;
  --p31-green: #34c759;
  --p31-orange: #ff9500;
  --p31-text: #1c1c1e;

  /* Finance / history (the original 2024 site's dark navy + mint) */
  --fin-bg: #070d14;
  --fin-surface: rgba(255, 255, 255, 0.04);
  --fin-line: rgba(255, 255, 255, 0.1);
  --fin-accent: #6dffe3;
  --fin-text: #eef6fa;
  --fin-muted: rgba(238, 246, 250, 0.62);


  --radius: 22px;
  --gutter: clamp(16px, 4vw, 56px);
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; }
p { margin: 0; }

.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.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;
}

:focus-visible { outline: 2px solid var(--p31-blue); outline-offset: 3px; border-radius: 6px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  background: rgba(246, 244, 239, 0.82);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.32em;
  font-size: 0.9rem;
  text-decoration: none;
}
.nav { display: flex; gap: 28px; font-size: 0.95rem; }
.nav a { text-decoration: none; color: var(--ink-soft); transition: color .2s; }
.nav a:hover { color: var(--ink); }

.lang-switch {
  display: inline-flex; padding: 3px; gap: 2px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
}
.lang-btn {
  font: 600 0.75rem/1 var(--sans); letter-spacing: 0.12em;
  border: 0; border-radius: 999px; padding: 8px 12px; cursor: pointer;
  background: transparent; color: var(--ink-soft);
}
.lang-btn.active { background: var(--ink); color: #fff; }

/* ---------- Shared bits ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.section-head { margin-bottom: clamp(28px, 4vw, 44px); max-width: 720px; }
.section-head h2 { font-size: clamp(2rem, 4.2vw, 3rem); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  font: 600 0.98rem/1 var(--sans); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: transform .15s, background .2s, border-color .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #2a2e38; }
.btn-ghost { border-color: var(--line); background: var(--card); }
.btn-ghost:hover { border-color: rgba(18, 20, 26, 0.3); }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding-block: clamp(48px, 9vw, 112px) clamp(56px, 8vw, 96px);
}
.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.6rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}
.hero h1 em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.hero h1 em:first-of-type { color: var(--ar-purple-deep); }
.hero h1 em:last-of-type { color: var(--p31-blue); }
.lead { margin-top: 22px; max-width: 540px; color: var(--ink-soft); font-size: 1.12rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.hero-visual { display: grid; gap: 18px; position: relative; }
.mini {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center;
  padding: 20px 22px; border-radius: var(--radius);
  text-decoration: none; box-shadow: 0 20px 50px -24px rgba(18, 20, 26, 0.35);
}
.mini strong { display: block; font-size: 1.2rem; }
.mini span { font-size: 0.95rem; }
.mini img { border-radius: 14px; }
.mini-ariadne { background: var(--ar-bg); color: var(--ar-text); transform: rotate(-1.5deg); margin-right: 32px; }
.mini-ariadne span { color: var(--ar-muted); font-family: var(--serif); font-style: italic; }
.mini-thread { grid-column: 1 / -1; width: 100%; height: 52px; }
.mini-thread path {
  stroke: var(--ar-gold); stroke-width: 3.5; stroke-linecap: round;
  stroke-dasharray: 420; stroke-dashoffset: 420;
  animation: draw 2.4s .3s ease-out forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
.mini-p31 { background: #fff; color: var(--p31-text); transform: rotate(1.2deg); margin-left: 32px; }
.mini-p31 span { color: #6e6e73; }
.mini-guesses {
  grid-column: 1 / -1; list-style: none; margin: 4px 0 0; padding: 0;
  display: grid; gap: 6px; font-family: var(--mono);
}
.mini-guesses li {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 12px; border-radius: 12px; background: #f2f2f7;
}
.mini-guesses li span { flex: 1; color: var(--p31-text); letter-spacing: 0.3em; font-size: 1rem; }
.mini-guesses li:last-child { background: rgba(52, 199, 89, 0.14); }

.plus { color: var(--p31-green); font-family: var(--mono); }
.minus { color: var(--p31-orange); font-family: var(--mono); }

.p31-tile {
  display: grid; place-items: center;
  width: 72px; height: 72px; border-radius: 18px;
  background: linear-gradient(145deg, #2b95ff, var(--p31-blue));
  color: #fff; font: 700 1.05rem/1 var(--mono); letter-spacing: -0.04em;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}
.p31-tile-sm { width: 56px; height: 56px; border-radius: 14px; font-size: 0.85rem; }

/* ---------- Apps ---------- */
.apps { padding-block: clamp(40px, 6vw, 72px); }
.app {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(28px, 4vw, 56px);
  padding: clamp(24px, 4.5vw, 56px);
  border-radius: calc(var(--radius) + 6px);
  margin-bottom: 28px;
}
/* Grid items default to min-width:auto, so one wide child (the demo input)
   would stretch the whole column past the viewport on phones. */
.hero > *, .app > * { min-width: 0; }
.app-id { display: flex; align-items: center; gap: 18px; margin-bottom: 26px; }
.app-icon { border-radius: 18px; box-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.3); }
.app h3 { font-size: clamp(1.9rem, 3.4vw, 2.5rem); }
.app-meta { font-size: 0.9rem; margin-top: 6px; }
.app-tagline { font-size: clamp(1.35rem, 2.4vw, 1.75rem); font-weight: 500; line-height: 1.25; margin-bottom: 14px; }
.app-lead { font-size: 1.05rem; }
.store-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.store-btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 20px; border-radius: 14px;
  text-decoration: none; font-weight: 600; font-size: 1.02rem; line-height: 1.1;
  transition: transform .15s, opacity .2s;
}
.store-btn:hover { opacity: 0.9; }
.store-btn svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
.store-btn small { display: block; font-size: 0.68rem; font-weight: 500; opacity: 0.8; letter-spacing: 0.04em; }
.app-note { margin-top: 18px; font-size: 0.85rem; }

/* Ariadne block */
.app-ariadne {
  background:
    radial-gradient(120% 80% at 100% 0%, var(--ar-glow) 0%, transparent 60%),
    var(--ar-bg);
  color: var(--ar-text);
}
.app-ariadne .app-meta, .app-ariadne .app-lead, .app-ariadne .app-note { color: var(--ar-muted); }
.app-ariadne .app-tagline { font-family: var(--serif); font-weight: 500; }
.app-story {
  margin: 22px 0 0; padding: 14px 0 14px 18px;
  border-left: 3px solid var(--ar-gold);
  font-family: var(--serif); font-style: italic; font-size: 1.08rem; color: var(--ar-text);
}
.store-dark { background: var(--ar-navy); color: #fff; }
.store-ghost { border: 1px solid rgba(27, 26, 51, 0.16); color: var(--ar-purple-deep); background: rgba(255, 255, 255, 0.6); }

.steps {
  list-style: none; margin: 0; padding: clamp(20px, 3vw, 30px);
  display: grid; gap: 4px; align-content: center;
  background: var(--ar-navy); color: #fff; border-radius: var(--radius);
}
.steps li {
  display: grid; grid-template-columns: auto 1fr; gap: 16px;
  padding: 16px 4px; border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.steps li:last-child { border-bottom: 0; }
.step-n { font-family: var(--mono); font-size: 0.85rem; color: var(--ar-gold); padding-top: 3px; }
.steps strong { font-size: 1.12rem; font-weight: 600; }
.steps p { color: rgba(255, 255, 255, 0.66); font-size: 0.96rem; margin-top: 4px; }

/* +3-1 block */
.app-p31 { background: #fff; color: var(--p31-text); border: 1px solid var(--line); }
.app-p31 .app-meta, .app-p31 .app-lead { color: #5c5c63; }
.app-p31 .app-lead b { font-weight: 700; }
.features { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 10px; }
.features li { position: relative; padding-left: 28px; }
.features li::before {
  content: ""; position: absolute; left: 0; top: 0.42em;
  width: 14px; height: 14px; border-radius: 4px;
  background: var(--p31-blue); opacity: 0.85;
}
.features li:nth-child(2n)::before { background: var(--p31-green); }
.features li:nth-child(3)::before { background: var(--p31-orange); }
.store-blue { background: var(--p31-text); color: #fff; }
.app-p31 .store-ghost { color: var(--p31-blue); border-color: rgba(0, 0, 0, 0.12); background: #fff; }

.demo {
  align-self: start;
  background: #f2f2f7; border-radius: var(--radius);
  padding: clamp(20px, 3vw, 28px);
}
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.demo-head strong { font-size: 1.2rem; }
.demo-reset {
  border: 0; background: transparent; color: var(--p31-blue);
  font: 600 0.95rem var(--sans); cursor: pointer; padding: 6px 0;
}
.demo-hint { color: #6e6e73; font-size: 0.93rem; margin-top: 6px; }
.demo-form { display: flex; gap: 10px; margin-top: 18px; }
.demo-input {
  flex: 1; min-width: 0; width: 100%; height: 52px; padding: 0 16px;
  border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 14px; background: #fff;
  font: 700 1.4rem/1 var(--mono); letter-spacing: 0.4em; color: var(--p31-text);
}
.demo-input:focus { outline: 2px solid var(--p31-blue); outline-offset: 0; border-color: transparent; }
.btn-p31 { background: var(--p31-blue); color: #fff; border-radius: 14px; min-height: 52px; }
.btn-p31:hover { background: #0a6fe0; }
.demo-msg { min-height: 1.5em; margin-top: 10px; font-size: 0.93rem; color: #6e6e73; }
.demo-msg.error { color: #d70015; }
.demo-msg.win { color: #248a3d; font-weight: 600; }
.demo-list {
  list-style: none; margin: 6px 0 0; padding: 0;
  display: grid; gap: 6px; max-height: 300px; overflow-y: auto;
  font-family: var(--mono);
}
.demo-list li {
  display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: center;
  padding: 10px 14px; background: #fff; border-radius: 12px;
  animation: pop .25s ease-out;
}
.demo-list li.solved { background: rgba(52, 199, 89, 0.16); }
.demo-list .n { color: #a1a1a6; font-size: 0.8rem; }
.demo-list .g { letter-spacing: 0.3em; font-size: 1.05rem; }
.demo-list b { font-size: 1.05rem; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- History teaser (home) ---------- */
.history-teaser {
  display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center;
  margin-top: clamp(24px, 4vw, 40px);
  padding: 24px clamp(22px, 3.5vw, 36px); border-radius: var(--radius);
  background: var(--fin-bg); color: var(--fin-text); text-decoration: none;
  transition: transform .2s;
}
.history-teaser:hover { transform: translateY(-2px); }
.history-teaser .eyebrow { margin: 0; color: var(--fin-accent); }
.teaser-text { font-size: 1.08rem; }
.teaser-cta { font-weight: 600; color: var(--fin-accent); white-space: nowrap; }

/* ---------- History page ---------- */
.page-hero { padding-block: clamp(48px, 8vw, 104px) clamp(32px, 5vw, 56px); }
.page-hero h1 { font-size: clamp(2.4rem, 5.6vw, 4.2rem); font-weight: 600; letter-spacing: -0.035em; max-width: 900px; }
.page-hero h1 em { font-family: var(--serif); font-style: italic; font-weight: 500; color: var(--ar-purple-deep); }
.page-hero .lead { max-width: 680px; }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

.history { padding-bottom: clamp(48px, 7vw, 88px); }
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.timeline li {
  display: grid; grid-template-columns: 170px 1fr; gap: 24px;
  padding: 24px 0; border-bottom: 1px solid var(--line);
}
.tl-date { font-family: var(--mono); font-size: 0.9rem; color: var(--ink-soft); padding-top: 3px; }
.tl-date::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 10px; vertical-align: 1px; background: var(--ink-soft);
}
.tl-fin .tl-date::before { background: #2bbfa4; }
.tl-app .tl-date::before { background: var(--p31-blue); }
.timeline strong { display: block; font-size: 1.2rem; font-weight: 600; }
.timeline p { margin-top: 4px; color: var(--ink-soft); }

.finance {
  background:
    radial-gradient(70% 60% at 85% 0%, rgba(109, 255, 227, 0.08), transparent 70%),
    var(--fin-bg);
  color: var(--fin-text);
  padding-block: clamp(64px, 9vw, 112px);
}
.finance .eyebrow { color: var(--fin-accent); }
.section-lead { margin-top: 16px; font-size: 1.05rem; color: var(--fin-muted); }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--fin-line); border-radius: var(--radius); overflow: hidden;
  margin-bottom: 24px;
}
.stat { padding: 24px; border-right: 1px solid var(--fin-line); }
.stat:last-child { border-right: 0; }
.stat strong { display: block; font: 700 clamp(1.7rem, 3vw, 2.3rem)/1 var(--mono); color: var(--fin-accent); }
.stat span { display: block; margin-top: 10px; font-size: 0.9rem; color: var(--fin-muted); }
.fin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.fin-card { padding: 24px; border-radius: 18px; background: var(--fin-surface); border: 1px solid var(--fin-line); }
.fin-card h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; }
.fin-card p { margin-top: 10px; color: var(--fin-muted); font-size: 0.95rem; }

.bridge { padding-block: clamp(64px, 9vw, 112px); }
.bridge h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); max-width: 720px; }
.bridge p { margin: 16px 0 28px; max-width: 680px; color: var(--ink-soft); font-size: 1.08rem; }

/* ---------- Contact ---------- */
.contact { padding-block: clamp(32px, 5vw, 56px) clamp(56px, 8vw, 96px); }
.contact-card {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: clamp(28px, 4.5vw, 52px); border-radius: calc(var(--radius) + 6px);
  background: var(--card); border: 1px solid var(--line);
}
.contact-card h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
.contact-card p { margin-top: 10px; color: var(--ink-soft); max-width: 520px; }

/* ---------- Footer ---------- */
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px;
  padding-block: 28px 40px; border-top: 1px solid var(--line);
  color: var(--ink-soft); font-size: 0.92rem;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero, .app { grid-template-columns: 1fr; }
  .hero-visual { max-width: 520px; }
  .fin-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--fin-line); }
  .timeline li { grid-template-columns: 1fr; gap: 6px; }
  .history-teaser { grid-template-columns: 1fr; gap: 10px; }
  .mini-ariadne { margin-right: 12px; }
  .mini-p31 { margin-left: 12px; }
}
@media (max-width: 480px) {
  body { font-size: 16px; }
  .demo-form { flex-direction: column; }
  .fin-grid { grid-template-columns: 1fr; }
  .store-btn { flex: 1 1 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mini-thread path { animation: none; stroke-dashoffset: 0; }
  .demo-list li { animation: none; }
}
