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

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

:root {
  --black: #000000;
  --white: #ffffff;
  --gray-100: #f5f5f5;
  --gray-200: #e0e0e0;
  --gray-500: #888888;
  --nav-w: 220px;
  --font-display: 'Playfair Display SC', Georgia, serif;
  --font-body: 'Karla', system-ui, -apple-system, sans-serif;
  --scroll-offset: 80px;
}

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

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--black);
  background: var(--white);
  overflow-x: hidden;
}

/* ── LAYOUT SHELL ── */
.page-shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDE NAV ── */
.side-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-w);
  height: 100vh;
  background: var(--black);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 2.5rem 0 2rem;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 2.5rem;
  border: 2px solid var(--white);
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.site-logo-text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}

.side-nav ol {
  list-style: none;
  flex: 1;
  padding: 0;
}

.side-nav ol li {
  border-top: 1px solid rgba(255,255,255,0.1);
}

.side-nav ol li:last-child {
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.side-nav ol li a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  color: var(--white);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
}

.side-nav ol li a:hover,
.side-nav ol li a:focus-visible {
  background: var(--white);
  color: var(--black);
}

.nav-num {
  font-family: var(--font-display);
  font-size: 0.65rem;
  opacity: 0.45;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
  line-height: 1.3;
}

.nav-contact {
  padding: 1.5rem 1.25rem 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 1.5rem;
}

.contact-link {
  display: block;
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  padding: 0.6rem 0;
  opacity: 0.7;
  transition: opacity 0.15s;
  min-height: 44px;
  line-height: 44px;
}

.contact-link:hover {
  opacity: 1;
}

/* ── MAIN WRAP ── */
.main-wrap {
  margin-left: var(--nav-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── HERO ── */
.hero-block {
  position: relative;
  min-height: 70vh;
  background: var(--black);
  color: var(--white);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding: 4rem 3rem 3.5rem;
}

.hero-bg-text {
  position: absolute;
  top: 50%;
  left: -0.05em;
  transform: translateY(-50%);
  font-family: var(--font-display);
  font-size: clamp(6rem, 22vw, 18rem);
  font-weight: 700;
  color: rgba(255,255,255,0.04);
  letter-spacing: -0.05em;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.hero-inner {
  display: flex;
  align-items: flex-end;
  gap: 2rem;
  width: 100%;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.hero-icon {
  flex-shrink: 0;
  opacity: 0.6;
  align-self: center;
}

.hero-text {
  text-align: right;
  max-width: 680px;
}

.hero-text h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--white);
  margin-bottom: 1rem;
}

.hero-sub {
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  font-weight: 300;
  line-height: 1.6;
  color: rgba(255,255,255,0.7);
  max-width: 480px;
  margin-left: auto;
}

/* ── MAIN ── */
main {
  flex: 1;
  background: var(--white);
}

.wrap {
  padding: 0;
}

.content-section {
  padding: 0;
}

.content-article {
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-height: 60vh;
}

/* ── ASIDE ── */
.article-aside {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: var(--scroll-offset);
  padding: 3rem 1.5rem 2rem 2rem;
  border-right: 2px solid var(--black);
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.aside-label {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 0.5rem;
}

.aside-toc {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
}

.aside-toc li {
  counter-increment: toc-counter;
}

.aside-toc a {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--black);
  text-decoration: none;
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.aside-toc a:hover {
  border-bottom-color: var(--black);
}

.aside-deco {
  margin-top: auto;
  opacity: 0.15;
}

/* ── ARTICLE BODY ── */
.article-body {
  flex: 1;
  min-width: 0;
  padding: 4rem 3.5rem 5rem 3rem;
  max-width: 820px;
}

/* ── CONTENT SECTIONS (injected via page.content) ── */
.article-body div {
  padding-top: 1rem;
  padding-bottom: 3rem;
  scroll-margin-top: var(--scroll-offset);
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--black);
  margin-top: 3.5rem;
  margin-bottom: 0.5rem;
}

.article-body h2 + hr,
.article-body h3 + hr {
  border: none;
  border-top: 2px solid var(--black);
  margin: 0.6rem 0 1.5rem;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 2rem 0;
}

.article-body h3 {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  margin-bottom: 0.4rem;
  color: var(--black);
}

.article-body h4 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.article-body p {
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 1.2rem;
  color: var(--black);
}

.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.2rem;
}

.article-body li {
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 0.35rem;
}

.article-body strong {
  font-weight: 700;
}

.article-body em {
  font-style: italic;
}

.article-body a {
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-body a:hover {
  text-decoration: none;
}

.article-body blockquote {
  border-left: 4px solid var(--black);
  padding: 0.8rem 1.2rem;
  margin: 1.5rem 0;
  background: var(--gray-100);
  font-size: 1rem;
  line-height: 1.7;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.article-body th,
.article-body td {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border: 1px solid var(--gray-200);
}

.article-body th {
  background: var(--black);
  color: var(--white);
  font-weight: 600;
}

.article-body code {
  font-family: monospace;
  font-size: 0.88rem;
  background: var(--gray-100);
  padding: 0.1em 0.35em;
}

.article-body pre {
  background: var(--black);
  color: var(--white);
  padding: 1.2rem 1.5rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 1.5rem 0;
}

.article-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem 0;
}

/* ── FOOTER ── */
footer {
  background: var(--black);
  color: var(--white);
  padding: 1.5rem 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

footer p.footer-brand {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--white);
  margin: 0;
  line-height: 1.5;
}

footer small {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
}

/* ── MOBILE MENU TOGGLE ── */
.menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  background: var(--black);
  border: none;
  width: 44px;
  height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 0;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--white);
  transition: transform 0.2s, opacity 0.2s;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── SCROLL REVEAL ── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0.05s; opacity: 1; transform: none; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.12s; opacity: 1; transform: none; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.19s; opacity: 1; transform: none; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.26s; opacity: 1; transform: none; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.33s; opacity: 1; transform: none; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.4s; opacity: 1; transform: none; }
.reveal-stagger.visible > *:nth-child(7) { transition-delay: 0.47s; opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-stagger > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  :root {
    --nav-w: 0px;
  }

  .side-nav {
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .side-nav.open {
    transform: translateX(0);
  }

  .main-wrap {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
  }

  .hero-block {
    padding: 5rem 1.5rem 2.5rem;
    min-height: 60vh;
  }

  .hero-inner {
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
  }

  .hero-icon {
    display: none;
  }

  .content-article {
    flex-direction: column;
  }

  .article-aside {
    width: 100%;
    position: static;
    border-right: none;
    border-bottom: 2px solid var(--black);
    padding: 1.5rem 1.5rem;
    min-height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .aside-deco {
    display: none;
  }

  .aside-toc {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .aside-toc li {
    counter-increment: none;
  }

  .aside-toc a {
    border: 1px solid var(--black);
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    border-bottom: 1px solid var(--black);
  }

  .article-body {
    padding: 2.5rem 1.5rem 3rem;
    max-width: 100%;
  }

  footer {
    padding: 1.25rem 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

@media (max-width: 480px) {
  .hero-text h1 {
    font-size: clamp(1.8rem, 9vw, 2.8rem);
  }

  .hero-block {
    padding: 4.5rem 1rem 2rem;
  }

  .article-body {
    padding: 2rem 1rem 2.5rem;
  }

  .article-body h2 {
    font-size: 1.4rem;
  }
}

/* ── FOCUS ── */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 3px;
}

/* ── SECTION SCROLL MARGIN ── */
div[id] {
  scroll-margin-top: var(--scroll-offset);
}
