@import url('https://fonts.googleapis.com/css2?family=Amatic+SC:wght@400;700&family=Cabin:wght@400;500;600;700&display=swap');

:root {
  --ink: #000000;
  --paper: #ffffff;
  --rad: 28px;
  --head-h: 148px;
  --sans: 'Cabin', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --display: 'Amatic SC', 'Cabin', -apple-system, 'PingFang SC', sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: 0.012em;
  overflow-x: hidden;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

h1,
h2,
h3,
h4 {
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.012em;
}

/* ---------- masthead : two stacked rows ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
}

.brand-row {
  padding: 12px 18px 4px;
}

.brand {
  display: inline-block;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.34em;
  text-decoration: none;
  padding: 6px 0;
  min-height: 44px;
}

.brand:hover {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 3px;
}

.menu-row {
  display: flex;
  gap: 22px;
  padding: 0 18px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.menu-row::-webkit-scrollbar {
  display: none;
}

.menu-row a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 1px;
  font-size: 1rem;
  white-space: nowrap;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

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

/* ---------- frame ---------- */
.frame {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 1380px;
  margin: 0 auto;
}

main {
  min-width: 0;
}

/* ---------- side rail ---------- */
.rail {
  padding: 20px 18px 6px;
  border-bottom: 3px solid var(--ink);
}

.rail-title {
  margin: 0 0 6px;
  font-size: 1.45rem;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0 0 16px;
  font-size: 1rem;
  line-height: 1.55;
  opacity: 0.68;
}

.rail-nav ul {
  display: flex;
  gap: 10px;
  margin: 0;
  padding: 0 0 10px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.rail-nav ul::-webkit-scrollbar {
  display: none;
}

.rail-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 16px;
  white-space: nowrap;
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: var(--rad);
  font-size: 1rem;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.rail-item .num {
  font-family: var(--display);
  font-size: 1.4rem;
  line-height: 1;
  letter-spacing: 0.05em;
}

.rail-item a:hover,
.rail-item a:focus-visible {
  background: var(--ink);
  color: var(--paper);
  transform: translateX(3px);
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  display: grid;
  align-content: end;
  justify-items: end;
  min-height: 100svh;
  padding: 90px 20px 92px;
  overflow: hidden;
  text-align: right;
  border-bottom: 3px solid var(--ink);
}

.hero-bg {
  position: absolute;
  top: 4vh;
  right: 4px;
  font-family: var(--display);
  font-size: clamp(11rem, 44vw, 30rem);
  line-height: 0.78;
  opacity: 0.08;
  pointer-events: none;
  user-select: none;
  will-change: transform;
}

.hero h1 {
  position: relative;
  margin: 0;
  max-width: 15ch;
  font-size: clamp(2.4rem, 8.6vw, 5.4rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  animation: rise 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.hero h1::after {
  content: "";
  display: block;
  width: 92px;
  height: 6px;
  margin: 26px 0 0 auto;
  background: var(--ink);
}

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

/* ---------- reading column ---------- */
.wrap {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 0;
}

.reading {
  padding: 56px 20px 92px;
}

.prose {
  font-size: 1.06rem;
  line-height: 1.8;
}

.prose > article {
  padding: 42px 0;
  border-top: 2px solid var(--ink);
  scroll-margin-top: calc(var(--head-h) + 20px);
}

.prose > article:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.prose h2 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 5vw, 2.05rem);
  line-height: 1.22;
}

.prose h2 + p {
  margin: 0 0 22px;
  padding-left: 14px;
  border-left: 5px solid var(--ink);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.55;
}

.prose h3 {
  margin: 28px 0 10px;
  font-size: 1.2rem;
}

.prose p {
  margin: 0 0 1.15em;
}

.prose > article:first-of-type > p:first-of-type::first-letter {
  float: left;
  padding: 8px 12px 0 0;
  font-size: 4.2rem;
  line-height: 0.84;
  font-weight: 700;
}

.prose ul,
.prose ol {
  margin: 0 0 1.15em;
  padding-left: 1.25em;
}

.prose li {
  margin: 0.45em 0;
}

.prose li::marker {
  font-weight: 700;
}

.prose blockquote {
  margin: 30px 0;
  padding: 22px 24px;
  border: 2px solid var(--ink);
  border-radius: var(--rad);
  font-size: 1.16rem;
  font-weight: 600;
  line-height: 1.5;
}

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

.prose figure {
  margin: 30px 0;
}

.prose img {
  display: block;
  border-radius: var(--rad);
}

.prose figcaption {
  padding-top: 8px;
  font-size: 1rem;
  opacity: 0.65;
}

.prose strong {
  font-weight: 700;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

/* ---------- footer ---------- */
.foot {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  padding: 54px 20px 24px;
  background: var(--ink);
  color: var(--paper);
}

.foot article {
  min-width: 0;
}

.foot-logo {
  display: inline-block;
  padding: 6px 0;
  min-height: 44px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-decoration: none;
}

.foot-nav ul {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 2px 0;
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.foot-nav a:hover {
  border-bottom-color: var(--paper);
}

.foot-key p {
  margin: 0;
  font-family: var(--display);
  font-size: 1.9rem;
  line-height: 1.2;
  letter-spacing: 0.06em;
}

.legal {
  grid-column: 1 / -1;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.32);
  font-size: 1rem;
  letter-spacing: 0.08em;
}

/* ---------- back to top ---------- */
.top {
  position: fixed;
  right: 14px;
  bottom: 16px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 2px solid var(--ink);
  border-radius: var(--rad);
  background: var(--paper);
  color: var(--ink);
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.top:hover,
.top:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- reveal ---------- */
html.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}

html.js .reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- tablet / desktop ---------- */
@media (min-width: 620px) {
  :root {
    --head-h: 136px;
  }

  .brand-row {
    padding: 16px 32px 6px;
  }

  .menu-row {
    gap: 30px;
    padding: 0 32px 10px;
  }

  .rail {
    padding: 26px 32px 6px;
  }

  .hero {
    padding: 100px 34px 96px;
  }

  .reading {
    padding: 64px 32px 104px;
  }

  .foot {
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 34px 28px;
    padding: 60px 32px 26px;
  }
}

@media (min-width: 1000px) {
  :root {
    --head-h: 128px;
  }

  .frame {
    grid-template-columns: 264px minmax(0, 1fr);
  }

  .brand-row {
    padding: 18px 40px 4px;
  }

  .menu-row {
    gap: 34px;
    padding: 0 40px 10px;
  }

  .rail {
    position: sticky;
    top: calc(var(--head-h) + 18px);
    align-self: start;
    max-height: calc(100svh - var(--head-h) - 40px);
    margin-top: 28px;
    padding: 0 22px 0 40px;
    overflow-y: auto;
    border-bottom: 0;
    border-right: 2px solid var(--ink);
    scrollbar-width: thin;
  }

  .rail-nav ul {
    display: grid;
    gap: 10px;
    overflow: visible;
    padding-bottom: 24px;
  }

  .hero {
    padding: 120px 48px 104px;
  }

  .wrap {
    max-width: 40rem;
  }

  .reading {
    padding: 80px 48px 130px;
  }

  .prose > article {
    column-count: 2;
    column-gap: 3rem;
    padding: 46px 0;
  }

  .prose > article > h2 {
    column-span: all;
  }

  .prose > article > p:first-of-type::first-letter {
    float: left;
  }

  .foot {
    padding: 72px 48px 30px;
  }
}

@media (min-width: 1240px) {
  .wrap {
    max-width: 46rem;
  }

  .hero h1 {
    max-width: 13ch;
  }
}

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

  html.js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hero h1 {
    animation: none;
  }

  .rail-item a:hover,
  .top:hover {
    transform: none;
  }

  .hero-bg {
    transform: none !important;
  }
}

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