/* reafit.ai — One Page · Design Nursery */

:root {
  --color-background: #111111;
  --color-foreground: #fafafa;
  --color-muted: #1e1e1e;
  --color-muted-foreground: #6c6c6c;
  --color-border: #2a2a2a;
  --color-input: #1e1e1e;

  --color-primary: #2EC281;
  --color-primary-foreground: #111111;

  --color-secondary: #1e1e1e;
  --color-accent: #1e1e1e;
  --color-card: #181818;
  --color-popover: #232323;
  --color-destructive: #ef4444;
  --color-indigo: #818cf8;

  --tint-primary-soft: rgba(46, 194, 129, 0.05);
  --tint-primary-mid:  rgba(46, 194, 129, 0.10);
  --tint-primary-strong: rgba(46, 194, 129, 0.18);
  --tint-accent-hover: rgba(42, 42, 42, 0.5);

  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;

  --topnav-height: 3.5rem;
}

html.light {
  --color-background: #ffffff;
  --color-foreground: #18181b;
  --color-muted: #f4f4f5;
  --color-muted-foreground: #71717a;
  --color-border: #e4e4e7;
  --color-input: #ffffff;
  --color-primary: #1fa86e;
  --color-primary-foreground: #ffffff;
  --color-secondary: #f4f4f5;
  --color-accent: #f4f4f5;
  --color-card: #ffffff;
  --color-popover: #ffffff;
  --color-destructive: #dc2626;
  --color-indigo: #4f46e5;
  --tint-primary-soft: rgba(22, 163, 106, 0.05);
  --tint-primary-mid: rgba(22, 163, 106, 0.10);
  --tint-primary-strong: rgba(22, 163, 106, 0.18);
  --tint-accent-hover: rgba(228, 228, 231, 0.7);
}

html.light body { color-scheme: light; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 21px;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

@media (max-width: 600px) {
  html, body { font-size: 18px; }
}
@media (max-width: 400px) {
  html, body { font-size: 16px; }
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ── Top navigation ─────────────────────────────────────────────────────── */

.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topnav-height);
  background: rgba(22, 22, 22, 0.85);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
}

html.light .topnav {
  background: rgba(255, 255, 255, 0.85);
}

.topnav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 100%;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 0 2.5rem;
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: 2rem;
  min-width: 0;
}

.topnav-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

.topnav-logo {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
}

.topnav-logo svg {
  width: 100%;
  height: 100%;
}

.topnav-title {
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topnav-links a {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--color-muted-foreground);
  border-bottom: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  height: 2.25rem;
}

.topnav-links a:hover {
  background: var(--tint-accent-hover);
  color: var(--color-foreground);
}

.topnav-links a.active {
  color: var(--color-foreground);
  font-weight: 500;
  border-bottom-color: var(--color-primary);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.topnav-controls {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.topnav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-muted-foreground);
  cursor: pointer;
  flex-shrink: 0;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.topnav-btn:hover:not(:disabled) {
  background: var(--tint-accent-hover);
  color: var(--color-foreground);
  border-color: var(--color-primary);
}

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

.font-btn {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 0.9375rem;
}

.theme-toggle svg {
  width: 1rem;
  height: 1rem;
}

html.light .theme-toggle .icon-moon { display: none; }
html.light .theme-toggle .icon-sun  { display: block; }
html:not(.light) .theme-toggle .icon-moon { display: block; }
html:not(.light) .theme-toggle .icon-sun  { display: none; }

/* ── Burger button (hidden on desktop) ───────────────────────────────────── */

.burger-toggle {
  display: none;
  padding: 0;
  min-width: 2.25rem;
  height: 2.25rem;
}

.burger-toggle svg { width: 1.125rem; height: 1.125rem; }
.burger-toggle .burger-close { display: none; }
.burger-toggle.open .burger-open { display: none; }
.burger-toggle.open .burger-close { display: block; }

/* Controls inside mobile menu (hidden on desktop) */
.topnav-links-controls { display: none; }

@media (max-width: 900px) {
  .topnav { height: var(--topnav-height); }
  .topnav-inner { padding: 0 1rem; }
  .topnav-right { display: none; }
  .burger-toggle { display: inline-flex; }

  .topnav-links {
    display: none;
    position: absolute;
    top: var(--topnav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem;
    gap: 0.25rem;
    z-index: 99;
  }

  html.light .topnav-links {
    background: var(--color-card);
  }

  .topnav-links.open {
    display: flex;
  }

  .topnav-links a {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    border-bottom: none;
    border-left: 2px solid transparent;
    border-radius: var(--radius-md);
    height: auto;
  }

  .topnav-links a.active {
    border-left-color: var(--color-primary);
    background: var(--tint-primary-soft);
    border-bottom: none;
  }

  .topnav-links-controls {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 0 0.25rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--color-border);
  }
}

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

.hero {
  min-height: calc(100vh - var(--topnav-height));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
}

@media (max-width: 600px) {
  .hero { padding: 3rem 1.25rem; min-height: 80vh; }
}

.hero-logo {
  width: 9rem;
  height: 9rem;
  color: var(--color-primary);
  margin-bottom: 2.5rem;
  animation: heroLogoIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (max-width: 600px) {
  .hero-logo { width: 6rem; height: 6rem; margin-bottom: 1.5rem; }
}

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

.hero h1 {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  line-height: 1;
  background: linear-gradient(180deg, var(--color-foreground) 0%, var(--color-muted-foreground) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: heroIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.hero-tagline {
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  color: var(--color-muted-foreground);
  margin: 0 0 3rem;
  max-width: 38rem;
  line-height: 1.5;
  font-style: italic;
  animation: heroIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  animation: heroIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both;
}

@media (max-width: 480px) {
  .hero-cta { flex-direction: column; align-items: center; gap: 0.75rem; }
  .hero-cta .btn { width: 100%; max-width: 16rem; }
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--color-muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  animation: bounce 2.4s ease-in-out infinite;
  opacity: 0.7;
}

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

@keyframes heroLogoIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes bounce {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, 8px); }
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 1.5rem;
  border-radius: 9999px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-foreground);
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.btn:hover {
  background: var(--tint-accent-hover);
  border-color: var(--color-primary);
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-foreground);
  border-color: var(--color-primary);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--color-primary);
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-arrow::after {
  content: "→";
  font-size: 1.125rem;
  transition: transform 0.2s;
}

.btn-arrow:hover::after {
  transform: translateX(3px);
}

/* ── Product sections (Apple style) ─────────────────────────────────────── */

.product-section {
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8rem 2.5rem;
  border-top: 1px solid var(--color-border);
  position: relative;
  overflow: hidden;
}

.product-section:nth-child(odd) {
  background: linear-gradient(180deg, var(--color-background) 0%, rgba(62, 207, 142, 0.015) 100%);
}

.product-inner {
  max-width: 1200px;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: center;
}

.product-section.reverse .product-text { order: 2; }
.product-section.reverse .product-visual { order: 1; }

@media (max-width: 900px) {
  .product-section { padding: 5rem 1.5rem; min-height: auto; }
  .product-inner {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  .product-section.reverse .product-text { order: 1; }
  .product-section.reverse .product-visual { order: 2; }
  .product-desc { max-width: 100%; }
}

@media (max-width: 600px) {
  .product-section { padding: 3.5rem 1.25rem; }
  .product-inner { gap: 2rem; }
  .product-visual { min-height: 14rem; }
  .visual-card { max-width: 18rem; padding: 1.5rem; border-radius: 1rem; }
  .product-eyebrow { margin-bottom: 0.75rem; }
  .product-subtitle { margin-bottom: 1rem; }
  .product-desc { margin-bottom: 1.25rem; }
}

@media (max-width: 480px) {
  .product-visual { min-height: 12rem; }
  .visual-card { max-width: 14rem; padding: 1.25rem; }
}

.product-eyebrow {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-primary);
  margin-bottom: 1.5rem;
}

.product-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0 0 1.5rem;
  color: var(--color-foreground);
}

.product-title em {
  font-style: italic;
  color: var(--color-primary);
}

.product-subtitle {
  display: none;
}

.product-desc {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--color-foreground);
  margin: 0 0 2rem;
  max-width: 32rem;
}

.product-desc::first-letter {
  float: left;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 0.85;
  color: var(--color-primary);
  margin-right: 0.375rem;
  margin-top: 0.125rem;
}

.product-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-primary);
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: gap 0.2s;
}

.product-link::after {
  content: "→";
  transition: transform 0.2s;
}

.product-link:hover::after {
  transform: translateX(4px);
}

/* ── Visuels stylisés (placeholders géométriques inspirés du logo) ──────── */

.product-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 26rem;
  position: relative;
}

.product-visual svg {
  width: 100%;
  max-width: 26rem;
  height: auto;
  color: var(--color-primary);
}

.visual-card {
  position: relative;
  width: 100%;
  max-width: 28rem;
  aspect-ratio: 1;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 1.5rem;
  padding: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.visual-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, var(--tint-primary-soft) 0%, transparent 60%);
  pointer-events: none;
}

.visual-card svg {
  position: relative;
  z-index: 1;
}

/* Animations des visuels produits */
@keyframes gearSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.35; } }
@keyframes nodeFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes flowRight { 0% { stroke-dashoffset: 40; } 100% { stroke-dashoffset: 0; } }

/* Nursery — hub pulse + nodes flottants */
.visual-card .nursery-hub { animation: pulse 4s ease-in-out infinite; }
.visual-card .nursery-node:nth-child(odd) { animation: nodeFloat 3s ease-in-out infinite; }
.visual-card .nursery-node:nth-child(even) { animation: nodeFloat 3s ease-in-out 1.5s infinite; }

/* Reaf — flux directionnel */
.visual-card .reaf-flow { stroke-dasharray: 8 12; animation: flowRight 2s linear infinite; }

/* Ephaistos — rotation crantée */
.gear-single { animation: gearSpin 30s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .gear-single, .visual-card .nursery-hub, .visual-card .nursery-node, .visual-card .reaf-flow { animation: none; }
}

/* ── Section finale (white paper CTA) ───────────────────────────────────── */

.product-final {
  text-align: center;
  background: linear-gradient(180deg, var(--color-background) 0%, rgba(62, 207, 142, 0.03) 100%);
}

.product-final .product-inner {
  grid-template-columns: 1fr;
  max-width: 720px;
  text-align: center;
  margin: 0 auto;
}

.product-final .product-desc {
  margin-left: auto;
  margin-right: auto;
}

.product-final .product-eyebrow,
.product-final .product-title,
.product-final .product-subtitle {
  text-align: center;
}

/* ── White paper layout ─────────────────────────────────────────────────── */

.main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.wp-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 2.5rem;
  padding: 2rem 2.5rem 4rem;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 900px) {
  .wp-layout { grid-template-columns: 1fr; padding: 1.5rem; gap: 1.5rem; }
}

.wp-sections {
  background: transparent;
  position: sticky;
  top: 5rem;
  display: flex;
  flex-direction: column;
}

.wp-sections-header {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  padding: 0 0 0.875rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-foreground);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1rem;
}

.wp-sections .section {
  display: block;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  border-left: 2px solid var(--color-border);
  color: var(--color-muted-foreground);
  margin-bottom: 0.25rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.wp-sections .section:hover {
  background: var(--tint-primary-soft);
  color: var(--color-foreground);
  border-left-color: var(--color-primary);
}

.wp-sections .section.active {
  background: var(--tint-primary-mid);
  color: var(--color-foreground);
  font-weight: 600;
  border-left-color: var(--color-primary);
}

.wp-content {
  background: transparent;
  padding: 0;
  min-height: 60vh;
  max-width: 42rem;
}

/* ── Markdown ───────────────────────────────────────────────────────────── */

.markdown {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--color-foreground);
  font-weight: 450;
}

.markdown > *:first-child { margin-top: 0; }

.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
  color: var(--color-foreground);
}

.markdown h1 { font-size: 2.25rem; font-weight: 500; margin: 0 0 2rem; padding-bottom: 1rem; border-bottom: 1px solid var(--color-border); }
.markdown h2 { font-size: 1.625rem; margin: 2.5rem 0 1rem; color: var(--color-primary); }
.markdown h3 { font-size: 1.25rem; margin: 2rem 0 0.75rem; }
.markdown h4 { font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin: 1.75rem 0 0.5rem; color: var(--color-muted-foreground); }

.markdown p { margin: 0.875rem 0; }
.markdown ul, .markdown ol { margin: 1rem 0; padding-left: 1.5rem; }
.markdown li { margin: 0.375rem 0; }
.markdown li::marker { color: var(--color-primary); }

.markdown blockquote {
  border-left: 3px solid var(--color-primary);
  background: var(--tint-primary-soft);
  margin: 1.5rem 0;
  padding: 0.875rem 1.25rem;
  font-style: italic;
  color: var(--color-foreground);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.markdown code {
  background: var(--color-muted);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.875em;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.markdown pre {
  background: var(--color-muted);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  border: 1px solid var(--color-border);
  margin: 1.25rem 0;
  font-size: 0.875rem;
}

.markdown pre code { background: transparent; padding: 0; }

.markdown a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-color: var(--tint-primary-strong);
  text-underline-offset: 0.15em;
}

.markdown a:hover { text-decoration-color: var(--color-primary); }
.markdown hr { border: none; border-top: 1px solid var(--color-border); margin: 2.5rem 0; }
.markdown strong { color: var(--color-foreground); font-weight: 700; }

.loading, .empty {
  padding: 2rem;
  text-align: center;
  color: var(--color-muted-foreground);
  font-size: 0.875rem;
}

.error-banner {
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: #fca5a5;
  margin: 1rem 0;
  font-size: 0.8125rem;
}

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

.site-footer {
  padding: 2rem 2.5rem 2.5rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-muted-foreground);
  letter-spacing: 0.02em;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

.site-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--color-foreground);
  font-weight: 600;
}

.site-footer-brand svg {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--color-primary);
}

.site-footer-contact {
  display: block;
  margin: 0.5rem 0;
  font-size: 0.8125rem;
  color: var(--color-muted-foreground);
}

.site-footer-email {
  color: var(--color-primary);
  cursor: pointer;
  text-decoration: none;
}

.site-footer-email:hover { text-decoration: underline; }
.at-hide, .dot-hide { font-size: 0; opacity: 0; position: absolute; }

.site-footer-license {
  display: block;
  margin-top: 0.5rem;
}
