@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --ink: #1f1f1f;
  --paper: #ffffff;
  --mist: #f5f5f5;
  --line: rgba(31, 31, 31, 0.12);
  --soft: rgba(31, 31, 31, 0.06);
  --e1: 0 1px 2px rgba(31, 31, 31, 0.07), 0 1px 1px rgba(31, 31, 31, 0.04);
  --e2: 0 4px 12px rgba(31, 31, 31, 0.08), 0 1px 3px rgba(31, 31, 31, 0.05);
  --e3: 0 12px 30px rgba(31, 31, 31, 0.12), 0 3px 8px rgba(31, 31, 31, 0.06);
  --e4: 0 26px 64px rgba(31, 31, 31, 0.18), 0 8px 20px rgba(31, 31, 31, 0.08);
  --r: 10px;
  --bar: 64px;
  --rail: 214px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

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

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

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--mist);
  background-image: radial-gradient(rgba(31, 31, 31, 0.075) 1px, transparent 1px);
  background-size: 20px 20px;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0.004em;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px clamp(14px, 4vw, 32px);
  background: rgba(255, 255, 255, 0.74);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--e1);
}

.mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--e1);
  text-decoration: none;
  transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.mark span {
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
}

.mark:hover,
.mark:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--e3);
}

.cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--paper);
  font-size: 16px;
  line-height: 1.4;
  text-decoration: none;
  box-shadow: var(--e2);
  transition: transform 0.24s ease, box-shadow 0.24s ease, background 0.24s ease;
}

.cta:hover,
.cta:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--e4);
  background: #000000;
}

/* ---------- frame ---------- */
.frame {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: clamp(16px, 2.2vw, 30px);
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) clamp(14px, 4vw, 32px) clamp(28px, 4vw, 48px);
}

.rail {
  position: sticky;
  top: calc(var(--bar) + 18px);
  z-index: 2;
}

.rail nav ul {
  list-style: none;
  margin: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--e2);
}

.rail nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1.45;
  text-decoration: none;
  color: rgba(31, 31, 31, 0.82);
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.rail nav a:hover,
.rail nav a:focus-visible {
  background: var(--mist);
  color: var(--ink);
  box-shadow: var(--e1);
  transform: translateX(2px);
}

.main { min-width: 0; }
.wrap { min-width: 0; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  min-height: 70vh;
  margin-bottom: clamp(20px, 3vw, 34px);
  border-radius: var(--r);
  overflow: hidden;
  background: #e9e9e9;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 88%);
  isolation: isolate;
}

.hero--bare {
  background-color: var(--paper);
  background-image: radial-gradient(rgba(31, 31, 31, 0.16) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(210deg, rgba(255, 255, 255, 0.18) 0%, rgba(31, 31, 31, 0.28) 62%, rgba(31, 31, 31, 0.5) 100%);
  pointer-events: none;
}

.hero--bare::after {
  background: linear-gradient(210deg, rgba(255, 255, 255, 0.4) 0%, rgba(31, 31, 31, 0.05) 100%);
}

.hero-card {
  position: relative;
  z-index: 3;
  max-width: 640px;
  margin: clamp(16px, 3vw, 36px);
  padding: clamp(16px, 2.4vw, 28px);
  text-align: right;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border-radius: var(--r);
  box-shadow: var(--e4);
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.hero-brand {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.14em;
  color: rgba(31, 31, 31, 0.55);
  margin-bottom: 10px;
}

.hero-card h1 {
  font-size: clamp(26px, 4.4vw, 50px);
  font-weight: 500;
  line-height: 1.18;
  letter-spacing: -0.03em;
  word-break: break-word;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

/* ---------- section ---------- */
.stage { max-width: 900px; }

.prose {
  counter-reset: sec;
  font-size: 17px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.prose article {
  position: relative;
  counter-increment: sec;
  padding: clamp(18px, 2.6vw, 36px);
  margin-bottom: clamp(16px, 2.4vw, 28px);
  background: var(--paper);
  border-radius: var(--r);
  box-shadow: var(--e2);
  scroll-margin-top: calc(var(--bar) + 22px);
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.5s ease;
}

.prose article::before {
  content: counter(sec, decimal-leading-zero);
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.14em;
  color: rgba(31, 31, 31, 0.26);
}

.prose article:hover { box-shadow: var(--e3); }
.prose article:target { box-shadow: var(--e4); }

.prose h2 {
  font-size: clamp(20px, 2.3vw, 27px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.prose h3 {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.5;
  margin: 24px 0 10px;
}

.prose h2 + hr { margin-top: 0; }

.prose hr {
  border: 0;
  height: 2px;
  border-radius: 2px;
  margin: 0 0 22px;
  background: linear-gradient(90deg, var(--ink) 0%, rgba(31, 31, 31, 0.08) 72%, transparent 100%);
}

.prose p { margin-bottom: 15px; }
.prose p:last-child { margin-bottom: 0; }

.prose ul,
.prose ol {
  padding-left: 22px;
  margin-bottom: 16px;
}

.prose li { margin-bottom: 8px; }
.prose li::marker { color: rgba(31, 31, 31, 0.45); }

.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.prose a:hover { background: var(--soft); }

.prose strong { font-weight: 500; }

.prose blockquote {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-left: 3px solid var(--ink);
  background: var(--mist);
  border-radius: 0 var(--r) var(--r) 0;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.94em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--mist);
}

.prose figure { margin: 0 0 18px; }
.prose figcaption { font-size: 16px; color: rgba(31, 31, 31, 0.6); margin-top: 8px; }

/* reveal */
.prose article.reveal {
  opacity: 0;
  transform: translateY(26px);
}

.prose article.reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- footer ---------- */
.foot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 22px;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(26px, 4vw, 46px) clamp(14px, 4vw, 32px) clamp(32px, 5vw, 56px);
  border-top: 1px solid var(--line);
}

.foot-word {
  grid-column: 1 / -1;
  font-size: clamp(38px, 10vw, 118px);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: -0.05em;
  color: var(--ink);
  margin-bottom: 4px;
}

.foot-meta {
  font-size: 16px;
  line-height: 1.6;
  color: rgba(31, 31, 31, 0.62);
}

.foot-meta a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 0;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.foot-meta a:hover,
.foot-meta a:focus-visible { border-bottom-color: var(--ink); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .frame { grid-template-columns: minmax(0, 1fr); }

  .rail {
    position: static;
    top: auto;
  }

  .rail nav ul {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
  }

  .rail nav a {
    white-space: nowrap;
    padding: 10px 14px;
  }

  .hero { min-height: 66vh; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 93%); }

  .hero-card { margin: 14px; text-align: left; }

  .foot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 460px) {
  .prose { font-size: 16px; }
  .hero-card { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-card { animation: none; }
  .prose article.reveal { opacity: 1; transform: none; }
  .prose article { transition: none; }
}

button[aria-expanded]{min-width:44px;min-height:44px}
