:root {
  --color-dark: #231334;
  --color-paper: #F5F3F7;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1280px;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-stack);
  color: var(--color-text);
  background: var(--color-paper);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Prevent horizontal overflow from SVGs and wide containers */
svg, .hero-svg-container, .sync-orb {
  max-width: 100%;
  height: auto;
}

/* Typography */
h1, h2, h3, h4 { font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 6.4vw, 5rem); margin-bottom: var(--gap); }
h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); margin-bottom: calc(var(--gap) * 0.8); }
h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); margin-bottom: calc(var(--gap) * 0.6); }
p { margin-bottom: var(--gap); max-width: 38em; }
a { color: inherit; text-decoration: none; }
ul, ol { margin-left: 1.5em; margin-bottom: var(--gap); }
li { margin-bottom: calc(var(--gap) * 0.4); }

/* Layout */
.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--gap); }
section { padding-top: var(--section-y); padding-bottom: var(--section-y); border-bottom: 1px solid rgba(28, 21, 35, 0.15); }
section:last-of-type { border-bottom: none; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.flex-row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; }

/* Face Variants */
.dark-face { background: var(--color-dark); color: var(--color-paper); }
.dark-face h1, .dark-face h2, .dark-face h3 { color: var(--color-paper); }
.paper-face { background: var(--color-paper); color: var(--color-text); }
.dark-face .card { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.2); box-shadow: none; }
.paper-face .card { background: var(--color-paper); border: var(--card-border); box-shadow: var(--card-shadow); }

/* Eyebrow & Highlights */
.eyebrow { display: block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; margin-bottom: calc(var(--gap) * 0.5); color: var(--color-brand); }
.dark-face .eyebrow { color: var(--color-accent); }
.hl { color: var(--color-brand); }
.dark-face .hl { color: var(--color-accent); }

/* Components */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  padding: 0 1.5em; height: 52px; border-radius: var(--radius-btn);
  font-weight: 600; font-size: 1rem; cursor: pointer; transition: transform 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--color-accent); color: var(--color-dark); }
.btn-primary:hover { transform: translateY(-2px); opacity: 0.9; }
.btn-primary:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn-secondary { border: 2px solid var(--color-text); color: var(--color-text); background: transparent; }
.btn-secondary:hover { background: rgba(28, 21, 35, 0.05); transform: translateY(-2px); }
.dark-face .btn-secondary { border-color: var(--color-paper); color: var(--color-paper); }
.dark-face .btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }
.btn svg { width: 20px; height: 20px; stroke-width: 2; flex-shrink: 0; }

.card { border-radius: var(--radius-card); padding: var(--gap); position: relative; }
.card-header { font-weight: 600; font-size: 1.1rem; margin-bottom: calc(var(--gap) * 0.5); display: flex; align-items: center; gap: 8px; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 8px; font-size: 0.75rem; font-weight: 600; margin-bottom: calc(var(--gap) * 0.5); }
.tag-problem { background: rgba(125, 20, 235, 0.1); color: var(--color-brand); }
.tag-action { background: rgba(237, 210, 110, 0.2); color: #6B5A1E; }
.tag-result { background: rgba(28, 21, 35, 0.08); color: var(--color-text); }
.dark-face .tag-problem { background: rgba(237, 210, 110, 0.15); color: var(--color-accent); }
.dark-face .tag-action { background: rgba(125, 20, 235, 0.2); color: #C49BF5; }
.dark-face .tag-result { background: rgba(255, 255, 255, 0.1); color: var(--color-paper); }

table { width: 100%; border-collapse: collapse; margin-bottom: var(--gap); }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid rgba(28, 21, 35, 0.15); }
th { font-weight: 600; background: rgba(28, 21, 35, 0.03); }
td { vertical-align: top; }
.dark-face table th { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.1); }
.dark-face table td { border-color: rgba(255, 255, 255, 0.1); }

.steps-horz { display: flex; gap: var(--gap); overflow-x: auto; padding-bottom: 8px; }
.step-item { flex: 1 1 200px; min-width: 0; }
.step-num { width: 32px; height: 32px; border-radius: 8px; background: var(--color-accent); color: var(--color-dark); display: flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 8px; }
.dark-face .step-num { background: var(--color-accent); color: var(--color-dark); }

details { border: 1px solid rgba(28, 21, 35, 0.2); border-radius: var(--radius-btn); margin-bottom: var(--gap); overflow: hidden; }
summary { padding: 16px 20px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.2em; font-weight: 400; }
details[open] summary::after { content: "-"; }
details p { padding: 0 20px 16px; margin: 0; }
.dark-face details { border-color: rgba(255, 255, 255, 0.2); }
.dark-face details p { color: var(--color-paper); }

article.news-card { border: 1px solid rgba(28, 21, 35, 0.15); border-radius: var(--radius-btn); padding: 20px; background: #fff; transition: transform 0.2s ease; }
article.news-card:hover { transform: translateY(-3px); }
.dark-face article.news-card { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.15); }
.news-date { font-size: 0.8rem; color: #666; margin-bottom: 6px; display: block; }
.dark-face .news-date { color: #aaa; }
.news-title { font-weight: 600; margin-bottom: 8px; display: block; }

/* Header & Footer */
header { position: sticky; top: 0; z-index: 100; background: var(--color-paper); border-bottom: 1px solid rgba(28, 21, 35, 0.1); backdrop-filter: blur(8px); }
.header-inner { display: flex; justify-content: space-between; align-items: center; height: 64px; }
.logo img { height: 32px; width: auto; vertical-align: middle; margin-right: 8px; }
nav a { margin-left: 24px; font-weight: 500; position: relative; }
nav a[aria-current="page"] { color: var(--color-brand); }
.dark-face nav a[aria-current="page"] { color: var(--color-accent); }
footer { background: var(--color-dark); color: var(--color-paper); padding: 48px 0; margin-top: var(--section-y); }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; }
.footer-grid h4 { font-size: 1rem; margin-bottom: 12px; color: var(--color-accent); }
.footer-grid ul { list-style: none; margin: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-grid a { color: rgba(255, 255, 255, 0.8); font-size: 0.9rem; }
.footer-grid a:hover { color: var(--color-paper); }
.copyright { text-align: center; margin-top: 32px; font-size: 0.85rem; color: rgba(255, 255, 255, 0.5); border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 24px; }

/* SVG Animation Classes */
.anim-orbit { animation: orbit-breathe 6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-orbit-slow { animation: orbit-breathe 8s ease-in-out infinite reverse; transform-box: fill-box; transform-origin: center; }
.anim-bubble { animation: bubble-float 4s ease-in-out infinite; }
.anim-draw { animation: dash-draw 5s linear infinite; stroke-dasharray: 1; stroke-dashoffset: 0; }
.anim-slide { animation: slide-in 1.5s ease-out forwards; }
.anim-typing span { animation: typing-pulse 1.4s infinite both; }
.anim-typing span:nth-child(2) { animation-delay: 0.2s; }
.anim-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes orbit-breathe {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 1; }
}
@keyframes bubble-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes dash-draw {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes slide-in {
  0% { transform: translateX(-20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes typing-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  .steps-horz { flex-direction: column; }
  .flex-row { flex-direction: column; align-items: flex-start; }
  h1 { font-size: clamp(2.2rem, 8vw, 3.5rem); }
}
