:root {
  --ink: #2d2a3e; --muted: #6f6a85; --line: rgba(45, 42, 62, .1);
  --sakura: #f6a9c6; --sakura-deep: #e2729c; --paper: #fbf9fc;
  --mint: #74cfac; --blue: #7aaee8; --lilac: #ad98ea; --rose: #ef8fb2;
  --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); background: var(--paper);
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* hero */
.hero {
  position: relative; min-height: 86vh; display: grid; place-items: center;
  overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg, #a7d4ff 0%, #cfe7ff 40%, #fbe3ee 78%, var(--paper) 100%);
  transition: background 1.2s ease;
}
.scene { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.cloud { animation: drift 60s linear infinite alternate; }
.c2 { animation-duration: 80s; animation-direction: alternate-reverse; }
.c3 { animation-duration: 95s; }
.branch { position: absolute; top: -10px; right: -20px; width: min(46vw, 420px); z-index: 0; filter: drop-shadow(0 6px 12px rgba(120, 80, 110, .12)); }
.sky-stars { position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity 1.2s; }
.sky-stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; animation: twinkle 3s ease-in-out infinite; }

.nav {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1160px; margin: 0 auto; padding: 1.4rem 1.5rem;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; letter-spacing: .02em; }
.brand-mark { width: 30px; height: 30px; color: var(--sakura-deep); cursor: pointer; display: inline-flex; transition: transform .8s cubic-bezier(.2, .8, .2, 1); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-mark.spin { transform: rotate(360deg); }
.nav-links { display: flex; gap: 1.2rem; font-size: .92rem; color: var(--muted); position: relative; z-index: 2; padding: .45rem 1rem; border-radius: 999px; background: rgba(255, 255, 255, .55); backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, .8); }
body.night .nav-links { background: rgba(20, 24, 60, .35); border-color: rgba(255, 255, 255, .15); }
.nav-links a:hover { color: var(--ink); }

.hero-inner { position: relative; z-index: 1; text-align: center; padding: 7rem 1.5rem 5rem; max-width: 760px; }
.kicker { margin: 0 0 .8rem; font-size: .85rem; letter-spacing: .35em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-weight: 700; font-size: clamp(2.8rem, 8vw, 5.6rem); line-height: 1.02; letter-spacing: -.02em; }
.accent { color: var(--sakura-deep); }
.tagline { margin: 1.3rem auto 2.2rem; max-width: 32rem; font-size: 1.12rem; line-height: 1.7; color: #4d4862; }
.jp-vertical {
  position: absolute; left: 4vw; top: 50%; transform: translateY(-50%); margin: 0;
  writing-mode: vertical-rl; font-family: "Shippori Mincho", serif; font-size: 1.15rem;
  letter-spacing: .5em; color: rgba(45, 42, 62, .45);
}

.buttons { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  padding: .85rem 1.6rem; border-radius: 999px; font-weight: 500; font-size: 1rem;
  border: 1px solid transparent; transition: transform .2s, box-shadow .2s, background .2s;
}
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 10px 24px rgba(45, 42, 62, .2); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(45, 42, 62, .26); }
.btn-ghost { background: rgba(255, 255, 255, .6); border-color: rgba(255, 255, 255, .9); backdrop-filter: blur(8px); color: var(--ink); }
.btn-ghost:hover { background: rgba(255, 255, 255, .9); transform: translateY(-2px); }

/* projects */
main { max-width: 1160px; margin: 0 auto; padding: 3rem 1.5rem 5rem; position: relative; z-index: 1; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 2rem; }
.eyebrow { margin: 0 0 .3rem; font-size: .8rem; letter-spacing: .3em; color: var(--sakura-deep); }
h2 { margin: 0; font-size: 2rem; font-weight: 700; }
h2 small { font-size: .95rem; font-weight: 400; color: var(--muted); margin-left: .4rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip {
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: .42rem 1rem; font-size: .9rem; cursor: pointer; transition: all .2s;
}
.chip:hover { color: var(--ink); border-color: rgba(45, 42, 62, .25); }
.chip-on, .chip-on:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.4rem; }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(45, 42, 62, .04), 0 10px 28px rgba(45, 42, 62, .06);
  transition: transform .25s ease, box-shadow .25s ease; animation: rise .6s ease both;
}
.card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--accent), transparent); }
a.card:hover { transform: translateY(-5px); box-shadow: 0 2px 4px rgba(45, 42, 62, .05), 0 20px 40px rgba(45, 42, 62, .1); }
.card-empty { background: rgba(255, 255, 255, .5); border-style: dashed; box-shadow: none; }
.card-icon {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem;
  background: color-mix(in srgb, var(--accent) 18%, white); margin-bottom: 1rem;
}
.card h3 { margin: 0 0 .4rem; font-size: 1.2rem; font-weight: 700; }
.card p { margin: 0 0 1.2rem; line-height: 1.65; color: var(--muted); flex: 1; }
.card-foot { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; font-size: .82rem; }
.status { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .65rem; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, white); color: var(--ink); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.tag { color: var(--muted); }
.arrow { margin-left: auto; color: var(--muted); transition: transform .2s; }
a.card:hover .arrow { transform: translateX(4px); color: var(--ink); }

footer { text-align: center; padding: 2rem 1rem 3.5rem; color: var(--muted); font-size: .92rem; position: relative; z-index: 1; }
.tiny { font-size: .75rem; opacity: .55; letter-spacing: .15em; }

/* petals */
#petals { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.petal {
  position: absolute; top: -20px; width: 12px; height: 9px; opacity: .9;
  background: linear-gradient(135deg, #ffe0ec, var(--sakura));
  border-radius: 12px 1px 12px 1px; animation: fall linear forwards;
}

/* simple pages (404, project stubs) */
body.simple { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(180deg, #cfe7ff, #fbe3ee 70%, var(--paper)); }
.simple-card { text-align: center; background: rgba(255, 255, 255, .7); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, .9); border-radius: 28px; padding: 3rem 2rem; margin: 1.5rem; max-width: 560px; box-shadow: 0 20px 50px rgba(45, 42, 62, .1); }
.simple-mark { font-size: 3rem; margin-bottom: .5rem; }
.simple h1 { font-size: clamp(2rem, 6vw, 3rem); }
.simple .tagline { margin-bottom: 1.8rem; }
code { background: rgba(45, 42, 62, .06); padding: .1rem .4rem; border-radius: 6px; }

/* night mode (konami) */
body.night .hero { background: linear-gradient(180deg, #141a42 0%, #2b2f6b 45%, #6a4f8f 82%, var(--paper) 100%); }
body.night .sky-stars { opacity: 1; }
body.night .hero h1, body.night .hero .tagline, body.night .brand, body.night .kicker, body.night .jp-vertical, body.night .nav-links { color: #f3eefc; }
body.night .accent { color: #ffb3cf; }
body.night .sun { fill: #fff; opacity: .12; }

@keyframes drift { to { transform: translateX(80px); } }
@keyframes twinkle { 50% { opacity: .2; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes fall {
  0% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(40px, 27vh) rotate(110deg); }
  50% { transform: translate(-10px, 55vh) rotate(200deg); }
  75% { transform: translate(35px, 82vh) rotate(300deg); }
  100% { transform: translate(5px, 110vh) rotate(400deg); }
}
@media (max-width: 720px) {
  .jp-vertical { display: none; }
  .branch { width: 58vw; top: 52px; opacity: .85; }
  .nav-links { gap: 1rem; }
  .hero { min-height: 78vh; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
