/* ============================================================
   HOSHIZORA — a quiet corner of the internet
   Hand-written CSS. No frameworks, no external assets.
   ============================================================ */

:root {
  --bg: #05070c;
  --bg-soft: #0a111a;
  --ink: #f3ecdf;
  --ink-soft: rgba(243, 236, 223, 0.74);
  --ink-dim: rgba(243, 236, 223, 0.56);
  --ink-faint: rgba(243, 236, 223, 0.34);
  --line: rgba(243, 236, 223, 0.14);
  --line-strong: rgba(243, 236, 223, 0.28);
  --accent: #ffbe7a;
  --accent-rgb: 255, 190, 122;
  --accent-2: #8fe3d5;
  --surface: rgba(16, 25, 35, 0.46);
  --surface-strong: rgba(14, 22, 31, 0.82);
  --star-rgb: 243, 236, 223;
  --ridge-far: #0b141d;
  --ridge-mid: #081019;
  --ridge-near: #050a10;
  --aurora-a: rgba(64, 146, 133, 0.24);
  --aurora-b: rgba(179, 106, 67, 0.17);
  --sky-top: #070b14;
  --sky-mid: #0a111b;
  --sky-bottom: #101821;
  --moon-a: #fff8e5;
  --moon-b: #d9ccb2;
  --moon-glow: rgba(255, 226, 174, 0.28);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --font-body: "Avenir Next", Avenir, "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pad: clamp(1.25rem, 4.4vw, 5.5rem);
}

html[data-theme="day"] {
  --bg: #e9eee7;
  --bg-soft: #dde6df;
  --ink: #17282c;
  --ink-soft: rgba(23, 40, 44, 0.78);
  --ink-dim: rgba(23, 40, 44, 0.62);
  --ink-faint: rgba(23, 40, 44, 0.42);
  --line: rgba(23, 40, 44, 0.14);
  --line-strong: rgba(23, 40, 44, 0.3);
  --accent: #b84f28;
  --accent-rgb: 184, 79, 40;
  --accent-2: #177a72;
  --surface: rgba(255, 255, 255, 0.38);
  --surface-strong: rgba(250, 247, 240, 0.9);
  --star-rgb: 23, 63, 69;
  --ridge-far: #c4d4cb;
  --ridge-mid: #aac1b9;
  --ridge-near: #8facaa;
  --aurora-a: rgba(82, 174, 164, 0.3);
  --aurora-b: rgba(232, 161, 113, 0.32);
  --sky-top: #dfeae6;
  --sky-mid: #e8ede4;
  --sky-bottom: #f3e8d7;
  --moon-a: #fffdf2;
  --moon-b: #f6d49a;
  --moon-glow: rgba(239, 173, 89, 0.4);
  --shadow: 0 30px 80px rgba(40, 69, 66, 0.14);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.8s var(--ease), color 0.8s var(--ease);
}

body::selection,
body *::selection {
  background: var(--accent);
  color: var(--bg);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3,
blockquote,
figure {
  margin: 0;
}

svg {
  display: block;
}

kbd,
code {
  font-family: var(--font-mono);
  font-size: 0.76em;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  padding: 0.1em 0.4em;
  border: 1px solid var(--line-strong);
  border-radius: 0.28em;
  color: var(--ink-soft);
  font-size: 0.68em;
  line-height: 1.4;
}

code {
  color: var(--accent);
}

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

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10001;
  padding: 0.65rem 1rem;
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-180%);
  transition: transform 0.2s;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ---------- Sky canvas & atmosphere ---------- */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 68% 18%, rgba(65, 101, 129, 0.14), transparent 46%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 54%, var(--sky-bottom) 100%);
  transition: background 0.8s var(--ease);
}

#sky-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 2s var(--ease);
}

.is-ready #sky-canvas {
  opacity: 1;
}

.aurora {
  position: absolute;
  width: 70vw;
  height: 60vh;
  border-radius: 50%;
  filter: blur(80px);
  mix-blend-mode: screen;
  opacity: 0.85;
  will-change: transform;
}

.aurora-a {
  top: -20vh;
  left: -15vw;
  background: radial-gradient(ellipse at center, var(--aurora-a), transparent 66%);
  animation: aurora-a 26s ease-in-out infinite alternate;
}

.aurora-b {
  right: -20vw;
  bottom: 5vh;
  background: radial-gradient(ellipse at center, var(--aurora-b), transparent 66%);
  animation: aurora-b 32s ease-in-out infinite alternate;
}

@keyframes aurora-a {
  from { transform: translate3d(-4%, -2%, 0) scale(1) rotate(-8deg); }
  to { transform: translate3d(12%, 6%, 0) scale(1.18) rotate(6deg); }
}

@keyframes aurora-b {
  from { transform: translate3d(3%, 4%, 0) scale(1.08) rotate(5deg); }
  to { transform: translate3d(-10%, -5%, 0) scale(0.94) rotate(-7deg); }
}

.moon-wrap {
  position: absolute;
  top: clamp(5.5rem, 12vh, 9rem);
  right: clamp(1rem, 9vw, 10rem);
  width: clamp(9rem, 13vw, 12.5rem);
  aspect-ratio: 1;
  opacity: 0;
  transform: translateY(3rem) scale(0.94);
  transition: opacity 1.8s var(--ease) 0.3s, transform 2.2s var(--ease) 0.3s;
}

.is-ready .moon-wrap {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.moon {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 32%, rgba(120, 108, 89, 0.14) 0 7%, transparent 8%),
    radial-gradient(circle at 62% 24%, rgba(120, 108, 89, 0.11) 0 4.5%, transparent 5%),
    radial-gradient(circle at 57% 68%, rgba(120, 108, 89, 0.1) 0 9%, transparent 10%),
    radial-gradient(circle at 30% 64%, rgba(120, 108, 89, 0.08) 0 3.5%, transparent 4%),
    radial-gradient(circle at 38% 38%, var(--moon-a), var(--moon-b) 72%);
  box-shadow:
    inset -1.3rem -0.8rem 2.8rem rgba(86, 72, 54, 0.23),
    0 0 5rem var(--moon-glow);
  transition: background 0.8s var(--ease), box-shadow 0.8s var(--ease);
}

.moon-glow {
  position: absolute;
  inset: -45%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--moon-glow), transparent 64%);
  filter: blur(18px);
  z-index: -1;
  opacity: 0.8;
}

.moon-orbit {
  position: absolute;
  inset: -28%;
  border: 1px solid var(--line);
  border-radius: 50%;
  animation: orbit 70s linear infinite;
}

.satellite {
  position: absolute;
  top: 12%;
  left: 12%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

@keyframes orbit {
  to { transform: rotate(360deg); }
}

.horizon {
  position: absolute;
  inset: auto 0 0;
  height: min(38vh, 25rem);
  opacity: 0.98;
}

.ridge {
  position: absolute;
  inset: auto 0 0;
  width: 100%;
  height: 100%;
}

.ridge path {
  transition: fill 0.8s var(--ease);
}

.ridge-far { height: 100%; }
.ridge-far path { fill: var(--ridge-far); opacity: 0.62; }
.ridge-mid { height: 82%; }
.ridge-mid path { fill: var(--ridge-mid); opacity: 0.72; }
.ridge-near { height: 58%; }
.ridge-near path { fill: var(--ridge-near); }

.mist {
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, var(--bg) 92%);
  opacity: 0.78;
}

.grain {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.7s steps(3) infinite;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-2%, 1%); }
  66% { transform: translate(1%, -2%); }
  100% { transform: translate(0, 0); }
}

/* ---------- Top bar ---------- */

.topbar {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.35rem var(--pad);
  border-bottom: 1px solid transparent;
  transition: background 0.5s var(--ease), border-color 0.5s var(--ease), padding 0.5s var(--ease);
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, var(--bg) 0%, transparent 100%);
  opacity: 0.7;
  pointer-events: none;
  transition: opacity 0.4s;
}

.topbar.scrolled {
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.topbar.scrolled::before {
  opacity: 0;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  line-height: 1;
}

.brand-mark {
  width: 1.15rem;
  height: 1.15rem;
  align-self: center;
  color: var(--accent);
  transition: transform 0.8s var(--ease);
}

.brand:hover .brand-mark {
  transform: rotate(90deg);
}

.brand-name {
  font-family: var(--font-mono);
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.brand-jp {
  color: var(--ink-dim);
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.4vw, 2.1rem);
  margin-left: auto;
}

.nav a,
.nav-terminal {
  position: relative;
  color: var(--ink-soft);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  transition: color 0.25s;
}

.nav a span,
.nav-terminal span {
  margin-right: 0.35rem;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

.nav a::after,
.nav-terminal::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.5rem;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease);
}

.nav a:hover,
.nav-terminal:hover {
  color: var(--ink);
}

.nav a:hover::after,
.nav-terminal:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

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

.icon-button {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  transition: color 0.25s, border-color 0.25s, background 0.25s, transform 0.4s var(--ease);
}

.icon-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  transform: rotate(12deg);
}

.icon-button svg {
  width: 1.05rem;
  height: 1.05rem;
}

.icon-sun { display: none; }
html[data-theme="day"] .icon-moon { display: none; }
html[data-theme="day"] .icon-sun { display: block; }

.menu-toggle {
  display: none;
  width: 2.3rem;
  height: 2.3rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  padding: 0.7rem;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--ink);
  transition: transform 0.35s var(--ease);
}

.menu-toggle span + span {
  margin-top: 5px;
}

.menu-toggle[aria-expanded="true"] span:first-child {
  transform: translateY(3px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:last-child {
  transform: translateY(-3px) rotate(-45deg);
}

.mobile-menu {
  position: fixed;
  z-index: 55;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  padding: 6rem var(--pad) 3rem;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(24px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s var(--ease), visibility 0.45s;
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu a,
.mobile-menu button {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: clamp(2rem, 9vw, 3rem);
  line-height: 1.25;
  text-align: left;
}

.mobile-menu p {
  margin-top: 2rem;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 2;
  letter-spacing: 0.12em;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  justify-content: center;
  padding: clamp(7.5rem, 14vh, 11rem) var(--pad) clamp(3rem, 7vh, 5.5rem);
}

.hero-inner {
  width: 100%;
  max-width: 78rem;
  margin: 0 auto;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: clamp(1.3rem, 2.6vh, 2rem);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: clamp(0.58rem, 0.75vw, 0.7rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow-jp {
  margin-left: 0.35rem;
  color: var(--ink-faint);
  font-family: var(--font-display);
  letter-spacing: 0.22em;
}

.pulse-dot {
  position: relative;
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 0 rgba(143, 227, 213, 0.5);
  animation: pulse 2.8s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(143, 227, 213, 0.45); }
  60%, 100% { box-shadow: 0 0 0 9px rgba(143, 227, 213, 0); }
}

.hero-title {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(2.85rem, 9.3vw, 9.4rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.055em;
  text-wrap: balance;
}

.hero-title .line {
  display: block;
  overflow: hidden;
  padding: 0 0.08em 0.08em 0;
}

.hero-title .line > span {
  display: block;
}

.hero-title em {
  position: relative;
  color: var(--accent);
  font-weight: 400;
}

.hero-title em::after {
  content: "";
  position: absolute;
  left: 0.05em;
  right: 0.08em;
  bottom: 0.05em;
  height: 1px;
  background: currentColor;
  opacity: 0.45;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s var(--ease) 1.4s;
}

.is-ready .hero-title em::after {
  transform: scaleX(1);
}

.js .hero-title .line > span {
  transform: translateY(112%);
  transition: transform 1.25s var(--ease);
}

.js .hero-title .line:nth-child(2) > span {
  transition-delay: 0.1s;
}

.is-ready .hero-title .line > span {
  transform: translateY(0);
}

.hero-sub {
  max-width: 35rem;
  margin-top: clamp(1.5rem, 3.5vh, 2.6rem);
  margin-left: clamp(0rem, 8vw, 11rem);
  color: var(--ink-soft);
  font-size: clamp(0.9rem, 1.15vw, 1.03rem);
  line-height: 1.95;
  letter-spacing: 0.03em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-top: clamp(1.8rem, 3.8vh, 2.8rem);
  margin-left: clamp(0rem, 8vw, 11rem);
}

.button {
  position: relative;
  display: inline-flex;
  height: 3rem;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0 1.35rem;
  border: 1px solid transparent;
  border-radius: 999px;
  overflow: hidden;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  transition: color 0.3s, background 0.3s, border-color 0.3s, transform 0.3s var(--ease);
}

.button svg {
  width: 1.05rem;
  height: 1.05rem;
  transition: transform 0.35s var(--ease);
}

.button:hover {
  transform: translateY(-2px);
}

.button:hover svg {
  transform: translateX(3px);
}

.button-primary {
  background: var(--ink);
  color: var(--bg);
}

.button-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateY(102%);
  transition: transform 0.45s var(--ease);
  z-index: 0;
}

.button-primary > * {
  position: relative;
  z-index: 1;
}

.button-primary:hover {
  color: #160e08;
}

.button-primary:hover::after {
  transform: translateY(0);
}

.button-ghost {
  border-color: var(--line);
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}

.button-ghost:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.button-ghost kbd {
  margin-left: 0.15rem;
}

.hero-meta {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: clamp(1rem, 3vw, 3rem);
  max-width: 60rem;
  margin-top: clamp(3rem, 8vh, 5.5rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.meta-block {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.28rem;
}

.meta-label {
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.16em;
}

.clock {
  font-family: var(--font-mono);
  font-size: clamp(1.55rem, 2.2vw, 2.1rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.clock small {
  color: var(--ink-dim);
  font-size: 0.58em;
}

.meta-value {
  font-size: 0.76rem;
  line-height: 1.6;
  letter-spacing: 0.04em;
}

.meta-sub {
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
}

.status-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
  vertical-align: 0.15em;
}

.hero-side {
  position: absolute;
  top: 50%;
  right: clamp(0.9rem, 2.8vw, 2.7rem);
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.18em;
  writing-mode: vertical-rl;
  transform: translateY(-50%);
}

.hero-side i {
  display: block;
  width: 1px;
  height: 4rem;
  background: var(--line);
}

.scroll-cue {
  position: absolute;
  bottom: 1.8rem;
  left: var(--pad);
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  transition: color 0.25s;
}

.scroll-cue:hover {
  color: var(--ink);
}

.scroll-cue i {
  position: relative;
  display: block;
  width: 3.5rem;
  height: 1px;
  overflow: hidden;
  background: var(--line);
}

.scroll-cue i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-100%);
  animation: scroll-line 2.4s var(--ease) infinite;
}

@keyframes scroll-line {
  0% { transform: translateX(-100%); }
  55%, 100% { transform: translateX(100%); }
}

/* ---------- Sections ---------- */

.section {
  position: relative;
  z-index: 2;
  padding: clamp(6rem, 12vw, 11rem) var(--pad);
}

.section-head {
  display: grid;
  max-width: 78rem;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.7fr);
  gap: 1.5rem 4rem;
  align-items: end;
}

.section-kicker {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  grid-column: 1 / -1;
  margin-bottom: 1.4rem;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
}

.section-kicker span {
  color: var(--accent);
}

.section-kicker::after {
  content: "";
  width: 3rem;
  height: 1px;
  margin-left: 0.2rem;
  background: var(--line);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5.4vw, 5.3rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.section-title em {
  color: var(--accent);
  font-weight: 400;
}

.section-intro {
  max-width: 24rem;
  padding-bottom: 0.5rem;
  color: var(--ink-soft);
  font-size: 0.93rem;
  line-height: 2;
}

.cards {
  display: grid;
  max-width: 78rem;
  margin: clamp(3rem, 7vw, 5.5rem) auto 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  --mx: 50%;
  --my: 0%;
  --rx: 0deg;
  --ry: 0deg;
  position: relative;
  display: flex;
  min-height: 21rem;
  flex-direction: column;
  padding: 1.7rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background:
    radial-gradient(28rem circle at var(--mx) var(--my), rgba(var(--accent-rgb), 0.1), transparent 55%),
    var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transform-style: preserve-3d;
  transition: border-color 0.4s, background 0.4s, transform 0.35s var(--ease), box-shadow 0.5s;
  will-change: transform;
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.card.tilting {
  transition: border-color 0.4s, background 0.4s, box-shadow 0.5s;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.card-icon {
  color: var(--accent);
  font-size: 1.2rem;
  line-height: 1;
  transform: translateZ(18px);
}

.card h3 {
  margin-top: auto;
  padding-top: 4rem;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 2.4vw, 2.2rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.card p {
  margin-top: 0.9rem;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.85;
}

.card-foot {
  margin-top: 1.8rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.53rem;
  letter-spacing: 0.15em;
}

/* ---------- Night note ---------- */

.note {
  padding-top: clamp(5rem, 10vw, 9rem);
  padding-bottom: 0;
}

.note-inner {
  max-width: 78rem;
  margin: 0 auto;
  padding-bottom: clamp(5rem, 10vw, 9rem);
}

.note blockquote {
  max-width: 66rem;
  margin-top: clamp(2rem, 5vw, 4rem);
}

.note blockquote p {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.1vw, 4.9rem);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.note blockquote em {
  color: var(--accent);
  font-weight: 400;
}

.note blockquote cite {
  display: block;
  max-width: 32rem;
  margin-top: 2rem;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-style: normal;
  line-height: 1.8;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.note-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.15em;
}

.marquee {
  width: 100%;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  opacity: 0.8;
}

.marquee-track {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 2.2rem;
  padding: 1rem 0;
  animation: marquee 34s linear infinite;
}

.marquee span {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
}

.marquee i {
  color: var(--accent);
  font-size: 0.62rem;
  font-style: normal;
}

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ---------- Footer ---------- */

.footer {
  position: relative;
  z-index: 2;
  display: grid;
  padding: clamp(3rem, 6vw, 4.5rem) var(--pad) 2rem;
  border-top: 1px solid var(--line);
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
}

.footer-brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.footer p {
  max-width: 20rem;
  color: var(--ink-dim);
  font-size: 0.72rem;
  line-height: 1.9;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
}

.footer-meta button {
  color: var(--ink-soft);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  transition: color 0.25s;
}

.footer-meta button:hover {
  color: var(--accent);
}

/* ---------- Cursor ---------- */

.cursor {
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  display: none;
  pointer-events: none;
  mix-blend-mode: difference;
}

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  border-radius: 50%;
  pointer-events: none;
}

.cursor-dot {
  width: 5px;
  height: 5px;
  background: #fff;
  transform: translate(-50%, -50%);
}

.cursor-ring {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease), height 0.3s var(--ease), border-color 0.3s, opacity 0.3s;
}

.cursor.is-active .cursor-ring {
  width: 56px;
  height: 56px;
  border-color: rgba(255, 255, 255, 0.9);
}

.cursor.is-hidden {
  opacity: 0;
}

@media (pointer: fine) {
  .cursor { display: block; }
  body, a, button { cursor: none; }
  input, textarea { cursor: text; }
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  z-index: 9000;
  left: 50%;
  bottom: 2rem;
  max-width: calc(100vw - 2rem);
  padding: 0.75rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 1rem);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  backdrop-filter: blur(18px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Terminal ---------- */

.terminal-modal {
  position: fixed;
  z-index: 9500;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}

.terminal-modal.open {
  opacity: 1;
  visibility: visible;
}

.terminal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 5, 9, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.terminal-window {
  position: relative;
  display: flex;
  width: min(46rem, 100%);
  height: min(34rem, 78vh);
  flex-direction: column;
  border: 1px solid rgba(143, 227, 213, 0.22);
  border-radius: 0.8rem;
  overflow: hidden;
  background: #060b0f;
  box-shadow: 0 2rem 8rem rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  transform: translateY(1.2rem) scale(0.985);
  transition: transform 0.4s var(--ease);
}

.terminal-modal.open .terminal-window {
  transform: translateY(0) scale(1);
}

.terminal-bar {
  display: flex;
  height: 2.6rem;
  flex: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #0a1217;
}

.terminal-dots {
  display: flex;
  gap: 0.35rem;
}

.terminal-dots i {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #26343a;
}

.terminal-dots i:first-child { background: #c96a54; }
.terminal-dots i:nth-child(2) { background: #c7a15a; }
.terminal-dots i:nth-child(3) { background: #6d9d83; }

.terminal-title {
  color: rgba(231, 238, 233, 0.52);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
}

.terminal-close {
  color: rgba(231, 238, 233, 0.42);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.08em;
  transition: color 0.2s;
}

.terminal-close:hover {
  color: #f3ecdf;
}

.terminal-body {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  padding: 1.1rem 1.2rem 1.2rem;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(64, 146, 133, 0.08), transparent 55%),
    #060b0f;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.4rem;
  color: rgba(226, 237, 230, 0.8);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  line-height: 1.75;
  scrollbar-width: thin;
  scrollbar-color: #24343a transparent;
}

.terminal-output::-webkit-scrollbar {
  width: 5px;
}

.terminal-output::-webkit-scrollbar-thumb {
  border-radius: 4px;
  background: #24343a;
}

.t-line {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.t-line + .t-line {
  margin-top: 0.1rem;
}

.t-dim { color: rgba(226, 237, 230, 0.4); }
.t-accent { color: #ffbe7a; }
.t-teal { color: #8fe3d5; }
.t-error { color: #e58b74; }
.t-gap { height: 0.6rem; }

.terminal-form {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.6rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-prompt {
  flex: none;
  color: #8fe3d5;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.terminal-form input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f3ecdf;
  font-family: var(--font-mono);
  font-size: 0.73rem;
  caret-color: #ffbe7a;
}

/* ---------- Reveal & intro ---------- */

.js .reveal {
  opacity: 0;
  translate: 0 1.5rem;
  transition: opacity 0.9s var(--ease) var(--delay, 0s), translate 1s var(--ease) var(--delay, 0s);
}

.js .reveal.is-visible {
  opacity: 1;
  translate: 0 0;
}

.intro {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: #05070c;
  color: #f3ecdf;
  transition: transform 1s var(--ease), opacity 0.6s ease;
}

.js .intro {
  display: flex;
}

.intro.is-done {
  transform: translateY(-101%);
  opacity: 0;
  pointer-events: none;
}

.intro-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.intro-mark {
  font-family: var(--font-display);
  font-size: 2.3rem;
  color: #ffbe7a;
  animation: intro-breathe 1.8s var(--ease) infinite alternate;
}

.intro-line {
  display: block;
  width: 6rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(243, 236, 223, 0.55), transparent);
  animation: intro-line 1.6s var(--ease) both;
}

.intro-coord {
  color: rgba(243, 236, 223, 0.4);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  animation: intro-fade 1.4s ease 0.2s both;
}

@keyframes intro-breathe {
  from { opacity: 0.55; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1.04); }
}

@keyframes intro-line {
  from { transform: scaleX(0); opacity: 0; }
  to { transform: scaleX(1); opacity: 1; }
}

@keyframes intro-fade {
  from { opacity: 0; transform: translateY(0.4rem); }
  to { opacity: 0.4; transform: translateY(0); }
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .nav { display: none; }
  .menu-toggle { display: block; }
  .hero { justify-content: flex-end; padding-top: 8rem; }
  .hero-title { font-size: clamp(3.4rem, 10.6vw, 7rem); }
  .hero-sub,
  .hero-actions { margin-left: 0; }
  .hero-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.3rem 2rem; }
  .hero-side { display: none; }
  .section-head { grid-template-columns: 1fr; gap: 1.6rem; }
  .section-intro { max-width: 32rem; }
  .cards { grid-template-columns: 1fr; }
  .card { min-height: 17rem; }
  .card h3 { padding-top: 3rem; }
  .footer { grid-template-columns: 1fr 1fr; }
  .footer-meta { grid-column: 1 / -1; align-items: flex-start; margin-top: 1rem; }
}

@media (max-width: 620px) {
  .topbar { padding-top: 1rem; padding-bottom: 1rem; }
  .brand-jp { display: none; }
  .moon-wrap {
    top: 6.4rem;
    right: -2rem;
    width: 9rem;
    opacity: 0.6;
  }
  .is-ready .moon-wrap { opacity: 0.7; }
  .moon-orbit { display: none; }
  .horizon { height: 30vh; }
  .hero {
    min-height: 100svh;
    padding-top: 7.5rem;
    padding-bottom: 3rem;
  }
  .eyebrow { gap: 0.55rem; font-size: 0.52rem; letter-spacing: 0.12em; }
  .eyebrow-jp { display: none; }
  .hero-title { font-size: clamp(2.45rem, 10.8vw, 3.4rem); line-height: 0.98; }
  .hero-sub { max-width: 21rem; margin-top: 1.4rem; font-size: 0.84rem; line-height: 1.9; }
  .hero-actions { margin-top: 1.5rem; }
  .button { height: 2.75rem; padding: 0 1.05rem; font-size: 0.72rem; }
  .hero-meta {
    margin-top: 2.4rem;
    padding-top: 1rem;
    gap: 1rem 1.2rem;
  }
  .meta-block:nth-child(3) { display: none; }
  .meta-status { display: none; }
  .clock { font-size: 1.45rem; }
  .scroll-cue { display: none; }
  .section { padding-top: 5rem; padding-bottom: 5rem; }
  .section-title { font-size: clamp(2.3rem, 11vw, 3.4rem); }
  .section-intro { font-size: 0.84rem; }
  .card { min-height: 15.5rem; padding: 1.35rem; border-radius: 0.9rem; }
  .card h3 { padding-top: 2.4rem; font-size: 1.55rem; }
  .note blockquote p { font-size: clamp(1.9rem, 9vw, 3.1rem); }
  .note blockquote cite { font-size: 0.55rem; }
  .note-meta { font-size: 0.5rem; }
  .marquee-track { gap: 1.3rem; }
  .footer { padding-bottom: 1.4rem; grid-template-columns: 1fr; gap: 1.4rem; }
  .footer-meta { grid-column: auto; margin-top: 0.5rem; }
  .footer p { font-size: 0.66rem; }
  .toast { bottom: 1.2rem; font-size: 0.58rem; white-space: normal; }
  .terminal-modal { padding: 0.6rem; }
  .terminal-window { height: 82vh; border-radius: 0.6rem; }
  .terminal-body { padding: 0.85rem 0.85rem 1rem; }
  .terminal-output { font-size: 0.67rem; }
  .terminal-form input { font-size: 0.67rem; }
  .terminal-prompt { font-size: 0.6rem; }
}

@media (max-height: 760px) and (min-width: 961px) {
  .hero { padding-top: 6.5rem; padding-bottom: 3rem; }
  .hero-title { font-size: clamp(4.4rem, 8vw, 7.4rem); }
  .hero-meta { margin-top: 2.4rem; }
  .moon-wrap { width: 9rem; top: 5rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal,
  .js .hero-title .line > span {
    opacity: 1;
    translate: 0 0;
    transform: none;
  }
  .intro { display: none !important; }
  .cursor { display: none !important; }
  body, a, button { cursor: auto; }
}
