/* SAVEHEX — dark crimson samurai theme */
:root {
  --bg: #070707;
  --bg-2: #0d0c0c;
  --card: #0b0a0a;
  --line: #262222;
  --line-red: #3a1416;
  --red: #c1121f;
  --red-hi: #e5383b;
  --red-deep: #6a0b0b;
  --red-ink: #a01518;
  --red-text: #f04f55; /* small red text: >= 4.5:1 on the dark background */
  --text: #f2f2f2;
  --muted: #8c8c8c;
  --dim: #8a8a8a;

  --f-ui: "Chakra Petch", system-ui, sans-serif;
  --f-jp: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --frame-pad: clamp(24px, 5vw, 72px);
  --radius: clamp(20px, 3vw, 36px);
  --header-h: 76px;

  /* motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 180ms;
  --t-base: 320ms;
  --t-slow: 700ms;
  --t-reveal: 950ms;
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* film grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: .07;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }

.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; left: 16px; top: -60px; z-index: 100;
  background: var(--red); color: #fff; padding: 10px 16px; border-radius: 999px;
  font-weight: 600; transition: top .2s;
}
.skip-link:focus { top: 16px; }

:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 3px; border-radius: 4px; }

.red { color: var(--red); }
[lang="ja"] { font-family: var(--f-jp); }

/* rain overlay */
.rain {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 50;
}

/* ---------- header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 70;
  height: var(--header-h);
  transition:
    transform 520ms var(--ease-out), opacity 520ms var(--ease-out),
    background var(--t-base) ease, backdrop-filter var(--t-base) ease, border-color var(--t-base) ease;
  border-bottom: 1px solid transparent;
}
.site-header.is-hidden:not(.menu-open):not(:focus-within) { transform: translateY(-105%); }
.site-header.is-scrolled {
  background: rgba(7, 7, 7, .78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: var(--line);
}
.header-inner {
  max-width: 1440px; height: 100%; margin: 0 auto;
  padding: 0 calc(var(--gutter) + clamp(8px, 2vw, 32px));
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.wordmark {
  font-weight: 700; font-size: clamp(22px, 2.2vw, 30px); letter-spacing: .02em;
}
.site-nav { display: flex; align-items: center; gap: clamp(16px, 3vw, 44px); }
.site-nav ul { display: flex; align-items: center; gap: 0; }
.site-nav li { display: flex; align-items: center; }
.site-nav li + li::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%;
  background: var(--red); margin: 0 clamp(12px, 1.6vw, 22px);
}
.site-nav ul a {
  font-size: 14px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text); opacity: .88; transition: color var(--t-fast) ease, opacity var(--t-fast) ease;
  position: relative;
}
.site-nav ul a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 1.5px;
  background: var(--red-text); transform: scaleX(0); transition: transform var(--t-base) var(--ease-out);
}
.site-nav ul a:hover::after, .site-nav ul a[aria-current="true"]::after { transform: scaleX(1); }
.site-nav ul a:hover { opacity: 1; color: var(--red-text); }
.site-nav ul a[aria-current="true"] { color: var(--red-text); opacity: 1; }

.nav-toggle {
  display: none; position: relative; width: 44px; height: 44px; border-radius: 8px;
  border: 0; background: none; /* bare icon; the 44px box stays as the tap target */
  margin-right: -8px; /* line the bars up with the frame edge */
  cursor: pointer; color: var(--text); transition: color var(--t-fast) ease;
}
.nav-toggle:hover, .nav-toggle[aria-expanded="true"] { color: var(--red-text); }
.nav-toggle:focus-visible { outline: 2px solid var(--red-hi); outline-offset: 2px; }
.nav-toggle-bar {
  position: absolute; left: 50%; top: 50%; width: 24px; height: 2px; margin: -1px 0 0 -12px; border-radius: 2px;
  background: currentColor; transition: transform var(--t-base) var(--ease-out);
}
.sr-only + .nav-toggle-bar { transform: translateY(-4px); }
.nav-toggle-bar + .nav-toggle-bar { transform: translateY(4px); }
.nav-toggle[aria-expanded="true"] .sr-only + .nav-toggle-bar { transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar + .nav-toggle-bar { transform: rotate(-45deg); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 34px; border-radius: 999px;
  font-family: var(--f-ui); font-weight: 700; font-size: 15px;
  letter-spacing: .18em; text-transform: uppercase;
  position: relative; overflow: hidden; isolation: isolate;
  transition:
    transform var(--t-base) var(--ease-spring), box-shadow var(--t-base) var(--ease-out),
    background var(--t-base) ease, border-color var(--t-base) ease, color var(--t-base) ease;
}
.btn::after { /* light sheen that sweeps across on hover */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .22) 50%, transparent 70%);
  transform: translateX(-120%);
}
.btn:hover::after { transform: translateX(120%); transition: transform 800ms var(--ease-out); }
.btn:active { transform: translateY(0) scale(.97); transition-duration: 90ms; }
.btn-sm { min-height: 42px; padding: 0 24px; font-size: 13px; }
.btn-solid { background: var(--red); color: #fff; box-shadow: 0 0 0 0 rgba(193, 18, 31, 0); }
.btn-solid:hover { background: var(--red-hi); box-shadow: 0 8px 32px rgba(193, 18, 31, .45); transform: translateY(-2px); }
.btn-outline { border: 1.5px solid rgba(242, 242, 242, .75); color: var(--text); }
.btn-outline:hover { border-color: var(--red-hi); color: var(--red-hi); transform: translateY(-2px); }
.btn-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: clamp(28px, 3.4vw, 48px); }

/* ---------- panels & frames ---------- */
.panel { padding: 12px var(--gutter); }
.panel-hero { padding-top: 12px; }

.frame {
  position: relative; isolation: isolate; overflow: hidden;
  max-width: 1440px; margin: 0 auto;
  padding: calc(var(--header-h) + 24px) var(--frame-pad) clamp(72px, 9vw, 120px);
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--bg);
  box-shadow: inset 0 0 120px rgba(0, 0, 0, .6);
}
/* fog texture, mirrored on alternating sections so panels don't look identical */
.frame::before {
  content: ""; position: absolute; inset: -4%; z-index: -2; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 7, 7, .55), rgba(7, 7, 7, 0) 45%),
    url("../assets/img/bg-fog.webp?v=3c23f0e14e") center / cover no-repeat;
  animation: fog-drift 38s var(--ease-in-out) infinite alternate;
}
@keyframes fog-drift { to { translate: -2.5% 1.5%; } }
.panel:nth-child(even) .frame::before { scale: -1 1; animation-duration: 46s; }
.panel:not(.panel-hero) .frame { padding-top: clamp(56px, 7vw, 96px); }

.grass {
  position: absolute; left: -2%; right: -2%; bottom: -2px; z-index: -1;
  height: clamp(150px, 26vw, 380px);
  background: url("../assets/img/grass.svg?v=2ca35e7f26") center bottom / 100% auto no-repeat;
  pointer-events: none;
  transform-origin: 50% 100%;
  animation: grass-sway 7s var(--ease-in-out) infinite alternate;
}
@keyframes grass-sway { from { transform: skewX(.8deg); } to { transform: skewX(-1.6deg); } }
.grass-low { height: clamp(90px, 15vw, 220px); opacity: .9; background-size: 120% auto; }
.panel:nth-child(even) .grass { scale: -1 1; animation-duration: 8.5s; }

.kanji {
  position: absolute; z-index: -1; pointer-events: none; user-select: none;
  font-family: var(--f-jp); font-weight: 900; line-height: 1;
  color: transparent; -webkit-text-stroke: 2px var(--red-ink);
  clip-path: inset(-20% -20% -20% -20%); /* explicit end shape so the reveal can interpolate */
  transition: clip-path 1.6s var(--ease-out) .25s;
  animation: kanji-float 11s var(--ease-in-out) infinite alternate;
}
@keyframes kanji-float { from { transform: translateY(-6px); } to { transform: translateY(10px); } }
.js .panel:not(.seen) .kanji { clip-path: inset(0 0 100% 0); }
.kanji-hero { right: -.12em; top: 12%; font-size: clamp(160px, 22vw, 340px); opacity: .55; }
.kanji-about { left: 46%; top: 8%; font-size: clamp(140px, 17vw, 260px); -webkit-text-stroke-color: var(--red-deep); opacity: .75; }
.kanji-side { right: -.06em; top: 4%; font-size: clamp(160px, 21vw, 320px); opacity: .45; }

/* ---------- typography ---------- */
.jp-display {
  font-family: var(--f-jp); font-weight: 900; letter-spacing: -.01em;
  font-size: clamp(30px, 5.2vw, 88px); line-height: 1.16;
}
.jp-display > span:not(.sr-only) { display: block; white-space: nowrap; }
.jp-display-md { font-size: clamp(28px, 4.6vw, 76px); line-height: 1.22; }
.jp-display-xl { font-size: clamp(44px, 7vw, 118px); line-height: 1.05; letter-spacing: -.04em; white-space: nowrap; }

.eyebrow {
  margin-top: clamp(20px, 2.4vw, 36px);
  font-weight: 700; font-size: clamp(12px, 1.05vw, 15px); letter-spacing: .12em; text-transform: uppercase;
  color: rgba(242, 242, 242, .65);
}
.eyebrow .red { white-space: nowrap; color: var(--red-text); }
.jp-lead {
  margin-top: 18px; font-family: var(--f-jp); font-weight: 700;
  font-size: clamp(14px, 1.35vw, 19px); color: rgba(242, 242, 242, .62);
}

.sec-label {
  font-family: var(--f-mono); font-size: clamp(13px, 1.3vw, 18px); letter-spacing: .12em;
  text-transform: uppercase; color: #d9474a;
}
.sec-label .path { color: var(--red-text); }
.accent-bar { display: block; width: 84px; height: 3px; margin: 12px 0 22px; background: var(--red); box-shadow: 0 0 12px rgba(193, 18, 31, .6); transform-origin: left; transition: transform 900ms var(--ease-out) 350ms; }
.js [data-reveal]:not(.is-in) .accent-bar { transform: scaleX(0); }

.num {
  font-family: var(--f-ui); font-weight: 700; line-height: 1;
  color: transparent; -webkit-text-stroke: 1.4px var(--red);
  font-size: clamp(44px, 4.4vw, 62px); letter-spacing: .02em;
  transition: -webkit-text-stroke-color var(--t-base) ease, text-shadow var(--t-base) ease;
}

.sec-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px clamp(14px, 2vw, 28px);
  margin-bottom: clamp(28px, 4vw, 52px);
}
.sec-head h2 { font-weight: 700; font-size: clamp(40px, 5.4vw, 80px); text-transform: uppercase; line-height: 1; }
.sec-head h2 .path { color: var(--red); letter-spacing: -.02em; margin-right: .06em; }
.sec-jp {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--f-jp); font-weight: 700; color: var(--red-hi); font-size: clamp(26px, 3vw, 46px);
}

/* ---------- hero ---------- */
.panel-hero .frame { min-height: calc(100svh - 24px); display: flex; flex-direction: column; justify-content: center; padding-top: calc(var(--header-h) + 6px); padding-bottom: clamp(40px, 5vw, 72px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  align-items: center; gap: clamp(32px, 4vw, 64px);
}
.hero-visual { display: flex; justify-content: center; }
.sun-portrait, .about-portrait {
  position: relative; aspect-ratio: 1;
  display: grid; place-items: center;
}
.sun-portrait { width: min(540px, 40vw); }
.sun-moon {
  position: absolute; inset: -18%; width: 136%; max-width: none; height: 136%;
  pointer-events: none;
  animation: moon-breathe 8s ease-in-out infinite;
}
@keyframes moon-breathe { 50% { filter: brightness(.82); transform: scale(.985); } }
.sun-ring {
  position: absolute; inset: 15%; border-radius: 50%;
  border: 2px solid rgba(229, 56, 59, .9);
  box-shadow: 0 0 22px 2px rgba(229, 56, 59, .6), inset 0 0 24px rgba(193, 18, 31, .5);
}
.sun-photo {
  position: relative; width: 68%; aspect-ratio: 1; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 40px 6px rgba(0, 0, 0, .85);
}

.hero-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 16px;
  margin-top: clamp(28px, 4vw, 64px); position: relative; z-index: 1;
}
.tagline { font-family: var(--f-jp); font-weight: 700; font-size: clamp(14px, 1.5vw, 21px); color: rgba(242, 242, 242, .65); letter-spacing: .12em; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: center; gap: clamp(28px, 5vw, 72px); }
.mono-body {
  margin-top: clamp(24px, 3vw, 40px); max-width: 640px;
  font-family: var(--f-mono); font-size: clamp(14px, 1.2vw, 17px); line-height: 1.75; color: rgba(242, 242, 242, .62);
}
.about-portrait { justify-self: center; width: min(440px, 100%); }
.about-portrait .sun-photo { width: 80%; box-shadow: 0 0 0 2px rgba(229, 56, 59, .85), 0 0 30px rgba(229, 56, 59, .5), 0 0 60px 10px rgba(0, 0, 0, .8); }

.stats {
  display: grid; grid-template-columns: repeat(3, auto); justify-content: space-around;
  margin-top: clamp(40px, 6vw, 80px); position: relative; z-index: 1;
}
.stats li { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 clamp(16px, 3vw, 48px); }
.stats li + li { border-left: 2px solid var(--red); }
.stats strong { font-family: var(--f-mono); font-weight: 500; font-size: clamp(32px, 4.6vw, 66px); line-height: 1.1; text-transform: uppercase; color: rgba(242, 242, 242, .9); }
.stats strong .count { font: inherit; color: inherit; font-variant-numeric: tabular-nums; }
.stats span { font-family: var(--f-mono); font-size: clamp(13px, 1.4vw, 20px); color: var(--dim); }

/* ---------- arsenal ---------- */
.arsenal-wrap { display: grid; grid-template-columns: clamp(120px, 14vw, 200px) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); align-items: start; }
.arsenal-rack { position: relative; align-self: stretch; display: flex; justify-content: center; }
.arsenal-rack img { position: relative; width: 78%; height: auto; max-height: 520px; object-fit: contain; filter: drop-shadow(0 0 12px rgba(0, 0, 0, .8)); }
.arsenal-rack .rack-moon {
  position: absolute; top: 2%; left: 50%; width: 330%; max-width: 520px; max-height: none; height: auto; translate: -62% 0;
  opacity: .9; pointer-events: none; filter: none;
}
.card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(12px, 1.4vw, 20px); counter-reset: card; }

.skill-card, .writeup-card, .cert-card {
  position: relative;
  background: linear-gradient(160deg, #110e0e, var(--card) 60%);
  border: 1px solid var(--line-red); border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(193, 18, 31, .04), 0 18px 40px rgba(0, 0, 0, .55);
  transition:
    opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-out),
    border-color var(--t-base) ease, box-shadow var(--t-base) ease;
}
:is(.skill-card, .writeup-card, .cert-card):hover,
.js :is(.skill-card, .writeup-card, .cert-card)[data-reveal].is-in:hover {
  transform: translateY(-6px); border-color: rgba(193, 18, 31, .7);
  transition-duration: var(--t-base); transition-delay: 0s;
  box-shadow: 0 0 0 1px rgba(193, 18, 31, .25), 0 20px 50px rgba(120, 10, 14, .35);
}
.skill-card { display: flex; flex-direction: column; min-height: 230px; padding: 24px 22px 26px; }
.skill-card h3 { margin-top: 18px; font-weight: 600; font-size: clamp(17px, 1.35vw, 20px); line-height: 1.2; }
.skill-card p { margin-top: 12px; font-size: 14px; line-height: 1.45; color: #9a9a9a; font-weight: 500; }
.skill-card::after {
  content: ""; margin-top: auto; width: 72px; height: 3px; background: var(--red); translate: 0 10px;
  transform-origin: left; transform: scaleX(.47); transition: transform var(--t-base) var(--ease-out);
}
.skill-card:hover::after { transform: scaleX(1); }
.skill-card:hover .num { -webkit-text-stroke-color: var(--red-hi); text-shadow: 0 0 18px rgba(229, 56, 59, .45); }

/* ---------- writeups ---------- */
.writeup-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 28px); }
.writeup-card { overflow: hidden; display: flex; flex-direction: column; }
.wu-visual {
  position: relative; overflow: hidden; aspect-ratio: 3 / 2;
  container-type: inline-size;
  border-bottom: 1px solid var(--line-red);
  background:
    radial-gradient(ellipse 70% 80% at 70% 60%, rgba(150, 12, 18, .38), transparent 70%),
    linear-gradient(180deg, #0b0707, #060505);
  transition: transform 700ms var(--ease-out);
}
.writeup-card:hover .wu-visual { transform: scale(1.04); }
.term {
  position: absolute; overflow: hidden; border: 1px solid rgba(229, 56, 59, .75); border-radius: 6px;
  background: rgba(6, 3, 3, .86);
  box-shadow: 0 0 18px rgba(193, 18, 31, .35), inset 0 0 22px rgba(193, 18, 31, .12);
}
.term-bar { display: flex; gap: 5px; padding: 7px 9px; border-bottom: 1px solid rgba(229, 56, 59, .4); }
.term-bar i { width: 7px; height: 7px; background: var(--red); border-radius: 1px; }
.term pre {
  margin: 0; padding: 10px 12px; overflow: hidden;
  font-family: var(--f-mono); font-size: clamp(7.5px, 3.1cqi, 12px); line-height: 1.5; color: #e5383b;
  text-shadow: 0 0 6px rgba(229, 56, 59, .55);
}
.term pre b { color: #ff6b6b; font-weight: 500; }
.term pre em { font-style: normal; color: rgba(229, 56, 59, .6); }
.term pre strong { font-weight: 500; color: #ff8a80; }
.term .ln { display: block; min-height: 1.5em; }
.js .term .ln { opacity: 0; transform: translateX(-6px); transition: opacity 260ms ease, transform 420ms var(--ease-out); }
.js .is-in .term .ln { opacity: 1; transform: none; transition-delay: calc(var(--i) * 110ms + 300ms); }
.caret { display: inline-block; width: .6em; height: 1.05em; vertical-align: -.15em; background: #e5383b; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.wu-htb .term { left: 7%; top: 16%; width: 58%; }
.wu-torii { position: absolute; right: 4%; bottom: 0; width: 46%; height: auto; filter: drop-shadow(0 0 14px rgba(193, 18, 31, .55)); }
.wu-htb::after {
  content: ""; position: absolute; inset: auto 0 0; height: 30%;
  background: linear-gradient(0deg, rgba(120, 10, 14, .35), transparent);
}
.wu-ctf svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.wu-ctf .spin, .wu-ctf .pulse-ring, .wu-ctf .reticle, .wu-ctf .lock { transform-box: fill-box; transform-origin: center; }
.wu-ctf .spin { animation: spin 26s linear infinite; }
.wu-ctf .pulse-ring { animation: pulse-ring 4.5s var(--ease-in-out) infinite; }
.wu-ctf .lock { animation: lock-glow 4.5s var(--ease-in-out) infinite; }
.wu-ctf .hex-rain text { animation: hex-drift 18s var(--ease-in-out) infinite alternate; }
.wu-ctf .hex-rain text:nth-child(even) { animation-direction: alternate-reverse; }
.wu-ctf .reticle { transition: transform 1.1s var(--ease-out) .25s, opacity .8s ease .25s; }
.js .writeup-card:not(.is-in) .wu-ctf .reticle { transform: scale(.7) rotate(-35deg); opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-ring { 50% { transform: scale(1.06); opacity: .45; } }
@keyframes lock-glow { 50% { filter: drop-shadow(0 0 6px rgba(229, 56, 59, .9)); } }
@keyframes hex-drift { to { transform: translateX(-14px); } }
.wu-tool .term { inset: 9% 7%; }
.bar { position: relative; display: inline-block; width: 4.5em; height: .7em; vertical-align: -.02em; background: rgba(229, 56, 59, .18); }
.bar::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: #e5383b;
  transform-origin: left; transition: transform 1s var(--ease-out);
}
.js .writeup-card:not(.is-in) .bar::before { transform: scaleX(0); }
.js .is-in .bar::before { transition-delay: calc(var(--i, 0) * 110ms + 520ms); }
.writeup-body { padding: 22px 24px 26px; background: #0a0909; position: relative; }
.writeup-body h3 { font-weight: 700; font-size: clamp(22px, 2vw, 28px); }
.tags { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 8px; }
.tags li { font-size: 15px; font-weight: 600; color: rgba(242, 242, 242, .55); }
.tags li:not(:last-child)::after { content: "·"; color: var(--red); margin: 0 10px; }
.read-more {
  display: inline-flex; gap: 8px; margin-top: 20px; padding-top: 14px;
  border-top: 2px solid var(--red); font-weight: 700; font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--red-text);
  transition: color var(--t-fast) ease;
}
.read-more span { display: inline-block; transition: transform var(--t-base) var(--ease-spring); }
.read-more:hover { color: var(--red-hi); }
.read-more:hover span { transform: translateX(6px); }

/* ---------- certs ---------- */
.eclipse {
  position: absolute; z-index: -1; left: 0; right: 0; top: -4%; margin: 0 auto;
  width: min(820px, 88vw); height: auto; pointer-events: none;
  animation: eclipse-pulse 7s var(--ease-in-out) infinite;
}
@keyframes eclipse-pulse { 50% { opacity: .78; } }
.cert-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(14px, 2vw, 28px); }
.cert-card { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 30px 20px 30px; }
.cert-card:focus-within { outline: 2px solid var(--red-hi); outline-offset: 3px; }
.cert-card::before { content: ""; width: 72px; height: 2px; background: var(--line); margin-bottom: 26px; }
.cert-ring {
  display: grid; place-items: center;
  width: min(170px, 70%); aspect-ratio: 1; border-radius: 50%;
  border: 2px solid var(--red-deep);
  box-shadow: inset 0 0 26px rgba(193, 18, 31, .45), 0 0 18px rgba(193, 18, 31, .2);
  background: radial-gradient(circle, #0d0909, #070707);
  transition: transform var(--t-slow) var(--ease-out), box-shadow var(--t-slow) var(--ease-out), border-color var(--t-slow) ease;
}
.cert-card:hover .cert-ring {
  transform: scale(1.05); border-color: var(--red);
  box-shadow: inset 0 0 34px rgba(229, 56, 59, .6), 0 0 30px rgba(193, 18, 31, .45);
}
.cert-ring img {
  width: 64%; height: auto; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .6));
  transition: filter var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out);
}
/* badges sit in the crimson palette until the card is hovered or focused, then show true colour */
@media (hover: hover) {
  .cert-card:not(:hover, :focus-within) .cert-ring img { filter: grayscale(1) brightness(.72) contrast(1.1) drop-shadow(0 6px 14px rgba(0, 0, 0, .6)); }
}
.cert-card:is(:hover, :focus-within) .cert-ring img { transform: scale(1.06); }
.cert-card strong {
  margin-top: 26px; font-size: clamp(16px, 1.3vw, 19px); font-weight: 700; line-height: 1.25;
  text-transform: uppercase; letter-spacing: .04em; text-wrap: balance;
}
.cert-link { color: inherit; outline: none; transition: color var(--t-fast) ease; }
.cert-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* whole card is the link */
.cert-card:is(:hover, :focus-within) .cert-link { color: var(--red-text); }
.cert-meta { margin-top: auto; padding-top: 10px; font-family: var(--f-mono); font-size: 13px; color: var(--dim); }

/* ---------- contact ---------- */
.frame-contact { min-height: min(880px, 100svh); display: flex; align-items: center; }
.contact-grid { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: clamp(28px, 4vw, 64px); }
.contact-grid .sec-label { color: rgba(242, 242, 242, .7); font-family: var(--f-ui); font-weight: 700; margin-bottom: 18px; }
.contact-list { margin: clamp(32px, 4vw, 52px) 0 clamp(32px, 4vw, 48px); display: grid; gap: 18px; }
.contact-list div { display: grid; grid-template-columns: 110px 1fr; align-items: center; }
.contact-list dt { font-weight: 700; font-size: 18px; color: var(--red-text); }
.contact-list dd { border-left: 2px solid var(--red-deep); padding-left: 24px; font-size: clamp(16px, 1.6vw, 21px); color: rgba(242, 242, 242, .7); overflow-wrap: anywhere; }
.contact-list a {
  background: linear-gradient(var(--red), var(--red)) left bottom / 0 1.5px no-repeat; padding-bottom: 2px;
  transition: background-size var(--t-base) var(--ease-out), color var(--t-fast) ease;
}
.contact-list a:hover { color: var(--text); background-size: 100% 1.5px; }

.frame-contact::before {
  background:
    radial-gradient(ellipse 45% 60% at 74% 55%, rgba(150, 12, 18, .45), transparent 70%),
    linear-gradient(180deg, rgba(7, 7, 7, .55), rgba(7, 7, 7, 0) 45%),
    url("../assets/img/bg-fog.webp?v=3c23f0e14e") center / cover no-repeat;
}
#contact .frame-contact::before { scale: none; }
.contact-visual {
  position: absolute; right: 2%; bottom: 8%;
  width: min(800px, 56vw); aspect-ratio: 1; pointer-events: none;
}
.contact-moon {
  position: absolute; z-index: -1; inset: 0; width: 100%; height: 100%;
  animation: moon-breathe 9s ease-in-out infinite;
}
.contact-picks {
  position: absolute; z-index: -1; left: 20%; top: 16%; width: 60%; height: auto;
  filter: drop-shadow(0 0 1.5px rgba(255, 70, 70, .55)) drop-shadow(0 18px 30px rgba(0, 0, 0, .6));
}
.vertical-tag {
  position: absolute; top: clamp(56px, 7vw, 96px); right: clamp(20px, 3vw, 44px);
  writing-mode: vertical-rl; padding: 14px 8px; border: 1px solid var(--red-deep);
  font-family: var(--f-jp); font-weight: 700; font-size: clamp(16px, 1.6vw, 22px); letter-spacing: .2em; color: var(--red);
}
.site-footer { text-align: center; padding: 22px 0 10px; font-weight: 700; font-size: 14px; color: rgba(242, 242, 242, .62); }

/* ---------- reveal on scroll ---------- */
.js [data-reveal] {
  opacity: 0; transform: translateY(28px);
  transition: opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-out);
  transition-delay: calc(var(--d, 0) * 90ms);
}
.js [data-reveal="left"] { transform: translateX(-36px); }
.js [data-reveal="scale"] { transform: scale(.9); }
.js [data-reveal="rise"] { transform: translateY(80px); transition-duration: 1.4s; }
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js :is(.skill-card, .writeup-card, .cert-card)[data-reveal] {
  transition:
    opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-out),
    border-color var(--t-base) ease, box-shadow var(--t-base) ease;
  transition-delay: calc(var(--d, 0) * 90ms), calc(var(--d, 0) * 90ms), 0s, 0s;
}

/* section heads: "./" types in, title rises, JP label follows */
.js .sec-head[data-reveal] { opacity: 1; transform: none; }
.js .sec-head h2, .js .sec-head .sec-jp { transition: opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-out); }
.js .sec-head .path { display: inline-block; clip-path: inset(-20% -20% -20% 0); transition: clip-path 600ms steps(2, end); }
.js .sec-head:not(.is-in) h2 { opacity: 0; transform: translateY(.45em); }
.js .sec-head:not(.is-in) .path { clip-path: inset(0 100% 0 0); }
.js .sec-head:not(.is-in) .sec-jp { opacity: 0; transform: translateX(-18px); }
.js .sec-head.is-in .sec-jp { transition-delay: 220ms; }
.js .sec-head.is-in .path { transition-delay: 120ms; }

/* stats stagger */
.js .stats[data-reveal] { opacity: 1; transform: none; }
.js .stats[data-reveal] li { opacity: 0; transform: translateY(20px); transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out); }
.js .stats.is-in li { opacity: 1; transform: none; }
.js .stats.is-in li:nth-child(2) { transition-delay: 120ms; }
.js .stats.is-in li:nth-child(3) { transition-delay: 240ms; }

/* ---------- hero intro (runs once on load) ----------
   moon glides in from the right → portrait fades up out of the moon →
   copy appears word by word (--wi, set in JS) → buttons fade → tagline rises. */
.hero-visual .sun-moon-wrap, .hero-visual .sun-ring, .hero-visual .sun-photo,
.panel-hero .w, .panel-hero .btn-row, .panel-hero .tagline {
  transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out), filter 1s var(--ease-out);
}
.js:not(.is-loaded) .site-header { transform: translateY(-100%); opacity: 0; }

.hero-visual .sun-moon-wrap { position: absolute; inset: 0; transition-duration: 1.4s, 1.8s; transition-delay: .1s; }
.js:not(.is-loaded) .hero-visual .sun-moon-wrap { opacity: 0; transform: translateX(min(55vw, 720px)); }

.hero-visual .sun-photo { transition-duration: 1.4s; transition-delay: 1.35s; }
.js:not(.is-loaded) .hero-visual .sun-photo { opacity: 0; transform: scale(.88); filter: blur(14px) brightness(.35) sepia(1) hue-rotate(-40deg) saturate(4); }
.hero-visual .sun-ring { transition-delay: 1.2s; }
.js:not(.is-loaded) .hero-visual .sun-ring { opacity: 0; transform: scale(.94); }

.panel-hero .w { display: inline-block; transition-delay: calc(var(--wi) * 70ms + .25s); }
.js:not(.is-loaded) .panel-hero .w { opacity: 0; transform: translateY(.55em); filter: blur(6px); }

.panel-hero .btn-row { transition: opacity 1.1s ease; transition-delay: var(--words-end, 1.4s); }
.js:not(.is-loaded) .panel-hero .btn-row { opacity: 0; }

.panel-hero .tagline { transition-duration: 1.1s; transition-delay: calc(var(--words-end, 1.4s) + .45s); }
.js:not(.is-loaded) .panel-hero .tagline { opacity: 0; transform: translateY(32px); }

.js:not(.is-loaded) .panel-hero .grass { opacity: 0; translate: 0 40px; }
.panel-hero .grass { transition: opacity 1.4s var(--ease-out) .35s, translate 1.4s var(--ease-out) .35s; }

/* ambient loops pause while their section is off-screen */
.js .panel:not(.in-view) :is(.grass, .kanji, .sun-moon, .contact-moon, .eclipse, .caret, .spin, .pulse-ring, .lock, .hex-rain text),
.js .panel:not(.in-view) .frame::before { animation-play-state: paused; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --header-h: 68px; }
  .nav-toggle { display: block; }
  .site-nav {
    position: fixed; top: var(--header-h); left: var(--gutter); right: var(--gutter);
    flex-direction: column; align-items: stretch; gap: 18px; padding: 22px;
    background: #0b0a0a; border: 1px solid var(--line); border-radius: 20px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, .6);
    opacity: 0; visibility: hidden; transform: translateY(-12px) scale(.98); transform-origin: top right;
    transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out), visibility 0s linear var(--t-base);
  }
  .site-nav.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .site-nav li, .site-nav > .btn { opacity: 0; transform: translateY(-6px); transition: opacity 260ms ease, transform 360ms var(--ease-out); }
  .site-nav.is-open li, .site-nav.is-open > .btn { opacity: 1; transform: none; }
  .site-nav.is-open li:nth-child(1) { transition-delay: 40ms; }
  .site-nav.is-open li:nth-child(2) { transition-delay: 80ms; }
  .site-nav.is-open li:nth-child(3) { transition-delay: 120ms; }
  .site-nav.is-open li:nth-child(4) { transition-delay: 160ms; }
  .site-nav.is-open li:nth-child(5) { transition-delay: 200ms; }
  .site-nav.is-open > .btn { transition-delay: 240ms; }
  .site-nav ul a::after { display: none; }
  .site-nav ul { flex-direction: column; align-items: stretch; }
  .site-nav li { display: block; }
  .site-nav li + li::before { display: none; }
  .site-nav ul a { display: block; padding: 14px 6px; border-bottom: 1px solid var(--line); font-size: 15px; }
  .site-header.menu-open { background: rgba(7, 7, 7, .92); }

  .hero-grid { grid-template-columns: 1fr; }
  .jp-display { font-size: clamp(30px, 8.4vw, 68px); }
  .jp-display-md { font-size: clamp(27px, 7.2vw, 58px); }
  .hero-visual { order: -1; }
  .sun-portrait { width: min(360px, 76vw); }
  .panel-hero .frame { min-height: auto; }

  .about-grid { grid-template-columns: 1fr; }
  .about-portrait { width: min(300px, 70vw); order: -1; }
  .kanji-about { left: auto; right: -.05em; }

  .arsenal-wrap { grid-template-columns: 1fr; }
  .arsenal-rack { display: none; }

  .writeup-grid { grid-template-columns: 1fr; max-width: 520px; margin: 0 auto; }

  .contact-grid { grid-template-columns: 1fr; }
  .contact-visual {
    position: relative; right: auto; bottom: auto; order: -1;
    width: min(440px, 100%); margin: 0 auto calc(-1 * clamp(24px, 8vw, 60px));
  }
  .vertical-tag { display: none; }
}

@media (max-width: 600px) {
  .mono-body { text-align: center; margin-left: auto; margin-right: auto; }
  .card-grid, .cert-grid { grid-template-columns: 1fr; }
  .wu-visual { aspect-ratio: 4 / 3; }
  .wu-htb .term { width: 66%; top: 12%; }
  .tags li { font-size: 14px; }
  .skill-card { min-height: 0; }
  .stats { grid-template-columns: 1fr; gap: 22px; }
  .stats li + li { border-left: 0; border-top: 2px solid var(--red); padding-top: 22px; }
  .btn-row .btn { flex: 1 1 auto; }
  .contact-list div { grid-template-columns: 1fr; gap: 4px; }
  .contact-list dd { padding-left: 14px; }
  .hero-foot { justify-content: flex-start; }
}

/* Reduced motion: keep gentle fades, drop movement, zoom, parallax and ambient loops.
   Append ?motion=full to the URL to preview the full motion design anyway. */
@media (prefers-reduced-motion: reduce) {
  html:not(.force-motion) { scroll-behavior: auto; }
  html:not(.force-motion) :is(.grass, .kanji, .sun-moon, .contact-moon, .eclipse, .caret, .spin, .pulse-ring, .lock, .hex-rain text),
  html:not(.force-motion) .frame::before { animation: none; }
  html:not(.force-motion) :is(
    [data-reveal], .sec-head h2, .sec-head .sec-jp, .stats li, .term .ln, .accent-bar, .bar::before,
    .panel-hero .w, .panel-hero .tagline, .sun-moon-wrap, .sun-ring, .sun-photo, .site-header, .site-nav, .site-nav li, .site-nav > .btn,
    .btn, .skill-card, .writeup-card, .cert-card, .wu-visual, .cert-ring, .read-more span, .reticle
  ) { transform: none !important; translate: none !important; clip-path: none !important; }
  html:not(.force-motion) .sec-head .path, html:not(.force-motion) .kanji { clip-path: none !important; }
  html:not(.force-motion) .panel-hero .grass { translate: none !important; }
  html:not(.force-motion) .btn::after { display: none; }
}
