/* Sakura site: a slow summer afternoon. No fonts, no network, no framework. */

:root {
  --bg: #fcf6ea;
  --text: #3a3128;
  --muted: #65584a;
  --accent: #f5d283;
  --accent-deep: #e2a73f;
  --link: #85520f;
  --ring: #b06f12;
  --panel: rgba(255, 252, 243, 0.66);
  --panel-edge: rgba(224, 167, 63, 0.22);
  --shadow: rgba(139, 94, 28, 0.3);
  --btn-text: #392a0e;
  --petal: #f2c4d0;
  --bloom-a: rgba(250, 205, 108, 0.62);
  --bloom-b: rgba(244, 190, 190, 0.42);
  --bloom-c: rgba(255, 250, 232, 0.9);
  --grain-opacity: 0.07;
  --safety: rgba(246, 214, 138, 0.38);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1a1e;
    --text: #ece4e6;
    --muted: #b6aaaf;
    --link: #f3cf8a;
    --ring: #f3cf8a;
    --panel: rgba(255, 255, 255, 0.055);
    --panel-edge: rgba(243, 207, 138, 0.16);
    --shadow: rgba(0, 0, 0, 0.55);
    --petal: #d98ea5;
    --accent: #f5d283;
    --accent-deep: #e2a73f;
    --bloom-a: rgba(240, 168, 78, 0.2);
    --bloom-b: rgba(226, 140, 170, 0.1);
    --bloom-c: rgba(250, 210, 140, 0.07);
    --grain-opacity: 0.1;
    --safety: rgba(240, 180, 90, 0.11);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1d1a1e;
  --text: #ece4e6;
  --muted: #b6aaaf;
  --link: #f3cf8a;
  --ring: #f3cf8a;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-edge: rgba(243, 207, 138, 0.16);
  --shadow: rgba(0, 0, 0, 0.55);
  --petal: #d98ea5;
  --bloom-a: rgba(240, 168, 78, 0.2);
  --bloom-b: rgba(226, 140, 170, 0.1);
  --bloom-c: rgba(250, 210, 140, 0.07);
  --grain-opacity: 0.1;
  --safety: rgba(240, 180, 90, 0.11);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  overflow-x: hidden;
}

/* ---------- light ---------- */

.light, .petals, .grain {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.light { z-index: 0; }
.petals { z-index: 1; }
.grain {
  z-index: 3;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.4 0 0 0 0 0.4 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.bloom {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.bloom-a {
  width: 80vmax; height: 80vmax; left: -25vmax; top: -30vmax;
  background: radial-gradient(closest-side, var(--bloom-a), transparent);
  animation: drift-a 48s ease-in-out infinite alternate;
}
.bloom-b {
  width: 70vmax; height: 70vmax; right: -30vmax; top: 10vh;
  background: radial-gradient(closest-side, var(--bloom-b), transparent);
  animation: drift-b 58s ease-in-out infinite alternate;
}
.bloom-c {
  width: 60vmax; height: 60vmax; left: 10vw; bottom: -35vmax;
  background: radial-gradient(closest-side, var(--bloom-c), transparent);
  animation: drift-c 40s ease-in-out infinite alternate;
}
@keyframes drift-a { to { transform: translate3d(8vmax, 6vmax, 0) scale(1.08); } }
@keyframes drift-b { to { transform: translate3d(-9vmax, 7vmax, 0) scale(0.94); } }
@keyframes drift-c { to { transform: translate3d(7vmax, -6vmax, 0) scale(1.1); } }

.petal {
  position: absolute;
  top: 0;
  left: var(--x);
  width: var(--s);
  height: calc(var(--s) * 1.4);
  color: var(--petal);
  opacity: 0.32;
  transform: translate3d(0, -12vh, 0);
  animation: fall var(--d) linear infinite;
  animation-delay: var(--delay);
}
@keyframes fall {
  0% { transform: translate3d(0, -12vh, 0) rotate(0deg); }
  50% { transform: translate3d(var(--sway), 50vh, 0) rotate(160deg); }
  100% { transform: translate3d(0, 112vh, 0) rotate(320deg); }
}

/* ---------- layout ---------- */

.wrap {
  position: relative;
  z-index: 2;
  width: min(52rem, 100% - 32px);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 16px;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--link);
}
.skip:focus { top: 0.75rem; }

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem;
  font-size: 0.95rem;
}
.brand {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 300;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  color: var(--text);
  text-decoration: none;
}
.top-links { display: flex; align-items: center; gap: 1.25rem; }

a { color: var(--link); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

button { font: inherit; }

.theme {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}
.theme:hover { color: var(--text); }

section { padding-block: 0; }
section.hero { padding-block: clamp(1.5rem, 4vw, 3rem) clamp(2.5rem, 5vw, 4rem); }

h1, h2, h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  font-weight: 300;
  line-height: 1.25;
  margin: 0 0 1rem;
  letter-spacing: 0.005em;
}
h1 { font-size: clamp(2.3rem, 7vw, 4.4rem); line-height: 1.1; margin-bottom: 1.25rem; letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); margin-bottom: 0.5rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }

p { margin: 0 0 1rem; }
.sub { font-size: 1.2rem; color: var(--muted); max-width: 34rem; }

code, pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
p code, li code, dd code, td code {
  font-size: 0.88em;
  padding: 0.08em 0.35em;
  border-radius: 0.4em;
  background: var(--panel);
}

/* ---------- buttons and code ---------- */

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; margin: 1.5rem 0 0; }

.btn {
  display: inline-block;
  padding: 0.85rem 1.9rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #f9dd95, var(--accent));
  color: var(--btn-text);
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 14px 34px -12px var(--accent-deep), 0 2px 6px -2px var(--shadow);
  transition: box-shadow 0.6s ease-out;
}
.btn:hover { box-shadow: 0 18px 44px -10px var(--accent-deep), 0 2px 6px -2px var(--shadow); }

.cmd {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
  padding: 0.35rem 0.4rem 0.35rem 1.1rem;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 14px 30px -20px var(--shadow);
  border: 1px solid var(--panel-edge);
}
.cmd code { font-size: 0.95rem; white-space: nowrap; overflow-x: auto; scrollbar-width: none; padding-block: 0.4rem; }
.cmd code::-webkit-scrollbar { display: none; }
.cmd.static { padding-right: 1.1rem; }

.code { position: relative; margin: 1rem 0 0; }
.code pre {
  margin: 0;
  padding: 1.15rem 1.3rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.65;
  border-radius: 1.1rem;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  box-shadow: 0 26px 50px -30px var(--shadow);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.code pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
.code.has-copy pre { padding-top: 2.6rem; }

.copy {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--link);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
}
.copy:hover { background: var(--panel); }
.code .copy { position: absolute; top: 0.5rem; right: 0.6rem; }
.cmd .copy { background: var(--panel); }

/* ---------- reveal ---------- */

.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 800ms ease-out, transform 800ms ease-out; }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- fleet picture ---------- */

.fleet {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0 0.75rem;
}
.lane {
  padding: 1.1rem 1.1rem 1.25rem;
  border-radius: 1.4rem;
  background: linear-gradient(160deg, var(--safety), var(--panel));
  box-shadow: 0 24px 44px -30px var(--shadow);
  font-size: 0.9rem;
}
.lane code { display: block; }
.lane small { display: block; min-height: 1.6em; color: var(--muted); font-size: 0.78rem; }
.line { position: relative; height: 2px; margin-top: 0.9rem; background: rgba(224, 164, 60, 0.28); border-radius: 2px; overflow: hidden; }
.line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent-deep);
  transform-origin: left center;
  transform: scaleX(0);
  animation: fill var(--t, 16s) ease-in-out infinite alternate;
}
.lane:nth-child(2) .line::after { --t: 19s; }
.lane:nth-child(3) .line::after { --t: 22s; }
@keyframes fill { to { transform: scaleX(1); } }
.note { color: var(--muted); font-size: 0.95rem; }

/* ---------- safety ---------- */

.safety {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.5rem 2.5rem;
  align-items: start;
  padding: 1.5rem 1.75rem;
  border-radius: 1.6rem;
  background: linear-gradient(150deg, var(--safety), var(--panel));
  border: 1px solid var(--panel-edge);
  box-shadow: 0 30px 60px -36px var(--shadow);
}
.safety h2 { font-size: 1.4rem; margin: 0; }
.safety p { margin: 0; }

/* ---------- table ---------- */

.table-wrap { margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; line-height: 1.65; }
th, td { text-align: left; vertical-align: top; padding: 0.8rem 1.25rem 0.8rem 0; border-bottom: 1px solid var(--panel-edge); }
th { font-weight: 600; color: var(--muted); font-size: 0.85rem; }
tbody th { color: var(--text); font-size: 0.95rem; }
td strong { font-weight: 400; font-size: 1.3rem; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
td:last-child { color: var(--muted); }

/* ---------- single column ---------- */

.hero { text-align: center; }
.hero .sub { margin-inline: auto; }
.hero .actions { justify-content: center; margin-top: 1.75rem; }
.hero .code { margin-top: 2rem; text-align: left; }
.hero .code pre { font-size: 0.85rem; }

.bento { display: flex; flex-direction: column; gap: clamp(2.25rem, 5vw, 3.25rem); padding-bottom: 1.5rem; }
#codex-like p { font-size: 1.15rem; margin: 0; }
#codex-like h2, .safety h2 { margin-bottom: 0.4rem; }
.safety { display: block; }
.safety p { margin: 0; }
.qa { padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--panel-edge); }
.qa h3 { margin: 0 0 0.25rem; }
.qa p { margin: 0; }
#faq > h2 { margin-bottom: 0; }

@media (max-width: 42rem) {
  thead { position: absolute; left: -9999px; }
  table, tbody, tr, th, td { display: block; }
  tr { padding: 1rem 0; border-bottom: 1px solid var(--panel-edge); }
  th, td { border: 0; padding: 0.15rem 0; }
  td::before { content: attr(data-label); display: block; font-size: 0.75rem; color: var(--muted); margin-top: 0.4rem; }
  .safety { padding: 1.25rem; }
}

/* ---------- faq, footer ---------- */

.faq p { color: var(--muted); }

footer {
  padding-block: 2.5rem 3rem;
  font-size: 0.95rem;
  color: var(--muted);
}
footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- reduced motion: nothing moves ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  .petals { display: none; }
  .line::after { transform: scaleX(0.6); }
}
