:root {
  --color-page: #FBF4E8;
  --color-surface: #FFFBF2;
  --color-surface-soft: #F3E8D6;
  --color-line: #E4D5BC;
  --color-accent: #8E3B4A;
  --color-accent-deep: #6E2C38;
  --color-ink: #33251C;
  --color-ink-soft: #7C6A58;
  --color-success: #4C7A4F;
  --color-warning: #C08A2E;
  --color-error: #B4432E;
  --color-apricot: #F6CCA4;
  --color-rose: #EDAFAE;
  --color-cream: #FBEFD9;
  --color-capsule: #4A362A;
  --color-capsule-text: #F7EEDD;
  --color-glass: rgba(255, 251, 242, 0.92);
  --color-shadow-deep: rgba(58, 40, 26, 0.14);
  --color-shadow-soft: rgba(58, 40, 26, 0.07);
  --color-shadow-focus: rgba(142, 59, 74, 0.28);
  --color-dot-red: #D9917F;
  --color-dot-amber: #E0B25E;
  --color-dot-green: #93AE85;
  --color-flag-red: #C2453E;
  --color-flag-blue: #3A5490;
  --color-flag-white: #FDFBF4;
  --color-white: #FFFFFF;
  --font-display: Georgia, "Times New Roman", "Songti SC", "Noto Serif CJK SC", "Yu Mincho", serif;
  --font-body: "Inter", "Noto Sans SC", "Noto Sans JP", "Noto Sans KR", -apple-system, "PingFang SC", "Hiragino Sans", "Malgun Gothic", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius-small: 12px;
  --radius-medium: 18px;
  --radius-large: 28px;
  --radius-pill: 999px;
  --shadow-panel: 0 30px 70px var(--color-shadow-deep), 0 8px 22px var(--color-shadow-soft);
  --shadow-button: 0 10px 24px var(--color-shadow-deep), 0 3px 8px var(--color-shadow-soft);
  --shadow-float: 0 14px 32px var(--color-shadow-deep), 0 4px 10px var(--color-shadow-soft);
  --content-max: 1296px;
  --header-height: 76px;
  --gutter: clamp(16px, 3.5vw, 48px);
  --section-space: clamp(72px, 10vw, 144px);
  --toc-offset: 92px;
  --transition-fast: 180ms ease;
}

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

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
  background: var(--color-page);
}

html.nav-open {
  overflow: hidden;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: clip;
  color: var(--color-ink);
  background-color: var(--color-page);
  font-family: var(--font-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  content: "";
  opacity: 0.46;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 .045'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

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

button {
  border: 0;
  cursor: pointer;
}

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

p,
ul,
ol,
blockquote,
pre,
table {
  margin-top: 0;
}

ul,
ol {
  padding-left: 1.3em;
}

code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
}

:not(pre) > code {
  padding: 0.12em 0.42em;
  overflow-wrap: anywhere;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-small);
  background: var(--color-surface-soft);
  font-size: 0.9em;
}

pre {
  max-width: 100%;
  padding: 20px;
  overflow-x: auto;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-medium);
  background: var(--color-capsule);
  color: var(--color-capsule-text);
  line-height: 1.65;
  -webkit-overflow-scrolling: touch;
}

pre code {
  overflow-wrap: normal;
  white-space: pre;
}

h1,
h2,
h3,
h4 {
  color: var(--color-ink);
  font-family: var(--font-display);
  font-weight: 400;
  text-wrap: balance;
}

h1 {
  margin: 0 0 24px;
  font-size: clamp(52px, 5vw, 72px);
  line-height: 1.12;
  letter-spacing: 0.01em;
}

h2 {
  margin: 0 0 24px;
  font-size: clamp(36px, 4vw, 54px);
  line-height: 1.16;
}

h3 {
  margin: 0 0 14px;
  font-size: clamp(24px, 2.5vw, 34px);
  line-height: 1.25;
}

h4 {
  margin: 0 0 10px;
  font-size: 21px;
  line-height: 1.35;
}

::selection {
  color: var(--color-surface);
  background: var(--color-accent);
}

:where(a, button, summary, [role="tab"], input, select, textarea):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.wrap {
  width: 100%;
  max-width: calc(var(--content-max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.narrow {
  max-width: 850px;
}

.section {
  padding-top: var(--section-space);
  padding-bottom: var(--section-space);
  overflow-x: clip;
}

.section-soft {
  background: var(--color-surface-soft);
}

.section-head {
  max-width: 760px;
  margin-bottom: clamp(34px, 5vw, 64px);
}

.section-head p,
.lead {
  color: var(--color-ink-soft);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.8;
}

.eyebrow,
.badge,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  max-width: 100%;
  padding: 5px 13px;
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink-soft);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-overflow: ellipsis;
}

.eyebrow::before,
.badge-dot::before {
  width: 6px;
  height: 6px;
  margin-right: 8px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  content: "";
}

.tag {
  background: var(--color-surface-soft);
  letter-spacing: 0.02em;
}

.no-break {
  white-space: nowrap;
}

.text-accent {
  color: var(--color-accent);
}

.muted {
  color: var(--color-ink-soft);
}

.mono {
  font-family: var(--font-mono);
}

.panel,
.card {
  min-width: 0;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-large);
  background: var(--color-surface);
}

.card {
  padding: clamp(22px, 3vw, 34px);
  box-shadow: 0 12px 32px var(--color-shadow-soft);
}

.btn,
.btn-primary,
.btn-secondary,
.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 46px;
  padding: 11px 26px;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
  transition: transform var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-surface);
  box-shadow: var(--shadow-button);
}

.btn-primary:hover {
  transform: translateY(-1px);
  border-color: var(--color-accent-deep);
  background: var(--color-accent-deep);
}

.btn-secondary {
  border-color: var(--color-line);
  background: var(--color-surface);
  color: var(--color-ink);
  box-shadow: 0 3px 10px var(--color-shadow-soft);
}

.btn-secondary:hover,
.btn-quiet:hover {
  border-color: var(--color-accent);
}

.btn-quiet {
  border-color: var(--color-line);
  background: transparent;
  color: var(--color-ink-soft);
}

.btn[aria-disabled="true"],
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.site-header {
  position: relative;
  z-index: 80;
  width: 100%;
}

.header-shell,
.topbar {
  display: flex;
  width: 100%;
  max-width: calc(var(--content-max) + var(--gutter) * 2);
  min-height: var(--header-height);
  margin-inline: auto;
  padding-inline: var(--gutter);
  align-items: center;
  gap: 26px;
}

.brand {
  display: inline-flex;
  min-width: max-content;
  min-height: 44px;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
}

.brand-copy {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: 0.04em;
}

.brand-local {
  color: var(--color-ink-soft);
  font-size: 12px;
  font-weight: 400;
}

.desktop-nav,
.nav {
  display: flex;
  min-width: 0;
  margin-left: 6px;
  flex: 1;
  align-items: center;
  gap: 3px;
}

.nav-link {
  display: inline-flex;
  min-height: 40px;
  padding: 8px 9px;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  color: var(--color-ink-soft);
  font-size: 13px;
  white-space: nowrap;
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-link svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  color: var(--color-ink);
  background: var(--color-surface-soft);
}

.header-tools,
.top-actions {
  display: flex;
  margin-left: auto;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
}

.login-link,
.btn-login {
  display: inline-flex;
  min-height: 40px;
  padding: 8px 18px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: 0 2px 8px var(--color-shadow-soft);
  font-size: 13px;
  white-space: nowrap;
}

.login-link:hover,
.btn-login:hover {
  border-color: var(--color-accent);
}

.language-menu {
  position: relative;
}

.language-toggle {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 10px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-ink-soft);
  font-size: 13px;
}

.language-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  display: none;
  width: 176px;
  padding: 8px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-medium);
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}

.language-menu.is-open .language-popover {
  display: grid;
}

.language-popover a {
  display: flex;
  min-height: 42px;
  padding: 8px 12px;
  align-items: center;
  border-radius: var(--radius-small);
  color: var(--color-ink-soft);
  font-size: 13px;
}

.language-popover a:hover,
.language-popover a[aria-current="true"] {
  background: var(--color-surface-soft);
  color: var(--color-ink);
}

.menu-toggle {
  display: none;
  min-width: 44px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.mobile-nav {
  position: absolute;
  top: var(--header-height);
  right: var(--gutter);
  left: var(--gutter);
  z-index: 95;
  display: none;
  max-height: calc(100dvh - var(--header-height) - 12px);
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-large);
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}

.mobile-nav.is-open {
  display: block;
}

.mobile-nav a {
  display: flex;
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-small);
  color: var(--color-ink-soft);
}

.mobile-nav a:hover,
.mobile-nav a[aria-current="page"] {
  background: var(--color-surface-soft);
  color: var(--color-ink);
}

.mobile-nav svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.mobile-language {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-line);
}

.nav-veil {
  position: fixed;
  inset: var(--header-height) 0 0;
  z-index: 70;
  display: none;
  background: var(--color-shadow-soft);
}

.nav-veil.is-open {
  display: block;
}

.site-footer {
  position: relative;
  overflow-x: clip;
  border-top: 1px solid var(--color-line);
  background: var(--color-surface);
}

.footer-main {
  display: grid;
  padding-top: 70px;
  padding-bottom: 54px;
  grid-template-columns: minmax(220px, 1.35fr) repeat(3, minmax(150px, 1fr));
  gap: 50px;
}

.footer-brand p {
  max-width: 33em;
  margin-top: 18px;
  color: var(--color-ink-soft);
  font-size: 14px;
}

.footer-heading {
  margin-bottom: 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.footer-links {
  display: grid;
  gap: 6px;
}

.footer-links a {
  display: inline-flex;
  width: fit-content;
  min-height: 30px;
  padding-block: 3px;
  align-items: center;
  color: var(--color-ink-soft);
  font-size: 13px;
}

.footer-links a:hover {
  color: var(--color-accent);
}

.footer-bottom {
  display: flex;
  min-height: 66px;
  padding-top: 18px;
  padding-bottom: 18px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--color-line);
  color: var(--color-ink-soft);
  font-size: 12px;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.prose {
  max-width: 820px;
  color: var(--color-ink);
}

.prose p,
.prose li {
  color: var(--color-ink-soft);
}

.prose p {
  margin-bottom: 1.25em;
}

.prose h2 {
  margin-top: 2.1em;
  font-size: clamp(30px, 4vw, 44px);
}

.prose h3 {
  margin-top: 1.7em;
  font-family: var(--font-body);
  font-size: 23px;
  font-weight: 600;
}

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

.reveal {
  transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.pending {
  opacity: 0;
  transform: translateY(16px);
}

.reveal.shown {
  opacity: 1;
  transform: translateY(0);
}

[data-counter] {
  display: inline-block;
  min-width: 3.5ch;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@media (max-width: 1180px) {
  .desktop-nav,
  .nav {
    display: none;
  }

  .menu-toggle {
    display: inline-grid;
    place-items: center;
  }

  .header-tools {
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 68px;
  }

  h1 {
    font-size: clamp(32px, 10vw, 40px);
    line-height: 1.15;
  }

  h2 {
    font-size: clamp(30px, 9vw, 40px);
  }

  .section {
    padding-top: 72px;
    padding-bottom: 72px;
  }

  .header-shell,
  .topbar {
    min-height: var(--header-height);
    gap: 8px;
  }

  .brand-local,
  .language-menu {
    display: none;
  }

  .header-tools,
  .top-actions {
    margin-left: auto;
    gap: 7px;
  }

  .login-link,
  .btn-login {
    min-height: 40px;
    padding-inline: 14px;
  }

  .footer-main {
    grid-template-columns: 1fr 1fr;
    gap: 34px 24px;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .brand-name {
    font-size: 19px;
  }

  .brand-logo {
    width: 31px;
    height: 31px;
  }

  .btn,
  .btn-primary,
  .btn-secondary,
  .btn-quiet {
    padding-inline: 20px;
  }

  .footer-main {
    grid-template-columns: 1fr;
  }

  .footer-brand {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .no-break {
    white-space: normal;
  }

  .tilt,
  [class*="tilt-"] {
    transform: none;
  }

  .wrap {
    padding-inline: var(--gutter);
  }

  .card {
    padding: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal,
  .reveal.pending,
  .reveal.shown {
    opacity: 1;
    transform: none;
  }
}