:root {
  --paper: #f4efe5;
  --paper-2: #e8dfd0;
  --ink: #172033;
  --brown: #9d6f31;
  --blue: #1767db;
  --white: #fffdf8;
  --line: rgba(23, 32, 51, .2);
  --pad: clamp(22px, 4.5vw, 72px);
}

* { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
img { display: block; max-width: 100%; }
::selection { background: #d5b27c; color: var(--ink); }

.skip-link {
  position: fixed;
  z-index: 999;
  top: 8px;
  left: 8px;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--white);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.diary-header {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  display: flex;
  width: 100%;
  height: 80px;
  align-items: center;
  justify-content: space-between;
  padding-inline: max(clamp(20px,4vw,72px),calc((100vw - 1440px)/2));
  border-bottom: 1px solid transparent;
  transition: background .25s ease, border-color .25s ease;
}
.diary-header.is-scrolled {
  border-color: var(--line);
  background: rgba(244,239,229,.94);
  backdrop-filter: blur(12px);
}
.diary-brand { display: inline-flex; align-items: center; gap: 12px; font-size: 11px; font-weight: 900; letter-spacing: .24em; text-decoration: none; }
.brand-k {
  width: 35px;
  height: 41px;
  flex: 0 0 auto;
  color: var(--brown);
  background: currentColor;
  -webkit-mask: url("/assets/brand/kocsisdani-mark.svg") center / contain no-repeat;
  mask: url("/assets/brand/kocsisdani-mark.svg") center / contain no-repeat;
  font-size: 0;
}
.diary-header nav { display: grid; width: min(690px,58vw); grid-template-columns: repeat(6,minmax(0,1fr)); align-items: center; }
.diary-header nav a { position: relative; justify-self: center; font-size: 11px; font-weight: 900; letter-spacing: .12em; text-decoration: none; text-transform: uppercase; }
.diary-header nav a::after { position: absolute; right: 0; bottom: -8px; left: 0; height: 2px; background: var(--brown); content: ""; transform: scaleX(0); transition: transform .2s ease; }
.diary-header nav a:hover::after, .diary-header nav a:focus-visible::after, .diary-header nav a[aria-current="page"]::after { transform: scaleX(1); }
.diary-menu { display: none; }

.diary-hero {
  position: relative;
  min-height: 720px;
  height: min(840px, 100svh);
  overflow: hidden;
  padding: 110px var(--pad) 70px;
  background: var(--paper);
  isolation: isolate;
}
.hero-background, .hero-background img, .hero-paper { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-background { z-index: -4; }
.hero-background img { object-fit: cover; object-position: 45% center; filter: sepia(.16) saturate(.56) contrast(.95) brightness(1.08); transform: scale(1.04); }
.hero-paper {
  z-index: -3;
  background:
    linear-gradient(90deg, rgba(244,239,229,.98) 0%, rgba(244,239,229,.94) 40%, rgba(244,239,229,.25) 72%, rgba(244,239,229,.08)),
    linear-gradient(0deg, var(--paper) 0%, transparent 22%);
}
.hero-paper::after {
  position: absolute;
  inset: 0;
  opacity: .28;
  background-image: linear-gradient(rgba(23,32,51,.1) 1px, transparent 1px);
  background-size: 100% 32px;
  content: "";
  mask-image: linear-gradient(90deg,#000,transparent 65%);
}
.hero-copy { position: relative; z-index: 5; display: flex; width: min(58vw, 730px); height: 100%; flex-direction: column; align-items: flex-start; justify-content: center; }
.diary-kicker { margin: 0 0 18px; color: var(--brown); font-size: 10px; font-weight: 900; letter-spacing: .28em; text-transform: uppercase; }
.diary-kicker::before { display: inline-block; width: 42px; height: 1px; margin: 0 12px 4px 0; background: currentColor; content: ""; }
.hero-copy h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(68px, 8.3vw, 138px);
  font-weight: 400;
  letter-spacing: -.065em;
  line-height: .83;
}
.hero-copy h1 span { display: block; white-space: nowrap; }
.hero-copy h1 span:last-child { margin-left: clamp(16px, 3vw, 54px); font-style: italic; }
.hero-copy > p:not(.diary-kicker) { max-width: 570px; margin: 30px 0 0; color: #4d5562; font-family: Georgia, serif; font-size: clamp(16px, 1.45vw, 20px); line-height: 1.65; }
.diary-button { display: inline-flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 30px; margin-top: 30px; padding: 0 22px; border: 1px solid var(--ink); background: var(--white); box-shadow: 6px 7px 0 rgba(157,111,49,.4); font-size: 11px; font-weight: 900; letter-spacing: .09em; text-decoration: none; text-transform: uppercase; clip-path: polygon(4% 0, 100% 5%, 96% 84%, 86% 100%, 0 93%, 2% 13%); transition: transform .2s ease, box-shadow .2s ease; }
.diary-button:hover, .diary-button:focus-visible { box-shadow: 2px 3px 0 rgba(157,111,49,.4); transform: translate(4px,4px) rotate(-1deg); }
.diary-button span { font-size: 18px; }

.hero-portrait { position: absolute; z-index: 2; right: -4vw; bottom: -8vw; display: block; width: min(61vw, 850px); aspect-ratio: 1; filter: drop-shadow(-24px 22px 30px rgba(23,32,51,.18)); transform: translate3d(var(--portrait-x,0),var(--portrait-y,0),0); transition: transform .18s ease-out; }
.hero-portrait img { width: 100%; height: 100%; object-fit: contain; }
.birth-stamp { position: absolute; z-index: 6; right: 6vw; bottom: 7vw; display: flex; width: 280px; min-height: 126px; flex-direction: column; justify-content: center; padding: 20px 25px; border: 2px solid var(--blue); color: var(--blue); text-align: center; clip-path: polygon(2% 6%, 93% 0, 100% 16%, 95% 91%, 82% 100%, 0 92%); transform: rotate(-7deg); mix-blend-mode: multiply; }
.birth-stamp::after { position: absolute; inset: 7px; border: 1px solid currentColor; content: ""; clip-path: inherit; }
.birth-stamp span, .birth-stamp i { font-size: 8px; font-style: normal; font-weight: 900; letter-spacing: .25em; }
.birth-stamp strong { margin: 8px 0 5px; font-family: "Courier New", monospace; font-size: 25px; letter-spacing: .08em; }
.hero-page-number { position: absolute; right: 24px; bottom: 18px; color: rgba(23,32,51,.25); font-family: "Courier New", monospace; font-size: 11px; letter-spacing: .18em; }

.diary-section { padding: clamp(90px, 10vw, 160px) var(--pad); }
.story-section { position: relative; background: var(--paper); }
.story-section::before { position: absolute; top: -40px; right: 0; left: 0; height: 42px; background: var(--paper); content: ""; clip-path: polygon(0 100%,0 65%,15% 30%,29% 68%,44% 9%,58% 55%,72% 18%,87% 59%,100% 20%,100% 100%); }
.story-heading { max-width: 1040px; }
.story-heading h2, .next-page h2 { margin: 0; font-family: Georgia,serif; font-size: clamp(54px, 7.2vw, 116px); font-weight: 400; letter-spacing: -.055em; line-height: .92; }
.story-prose { max-width: 1160px; margin: clamp(80px, 9vw, 140px) auto 0; }
.story-chapter { display: grid; grid-template-columns: minmax(190px, .34fr) minmax(0, 1fr); gap: clamp(42px, 7vw, 110px); padding: clamp(64px, 8vw, 112px) 0; border-top: 1px solid var(--line); }
.story-chapter-heading { align-self: start; }
.story-number, .story-period { display: block; color: var(--brown); font-family: "Courier New", monospace; font-weight: 700; }
.story-number { margin-bottom: 30px; font-size: clamp(38px, 4vw, 64px); letter-spacing: -.08em; }
.story-period { margin-bottom: 14px; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; }
.story-chapter h3 { margin: 0; font-family: Georgia, serif; font-size: clamp(34px, 3.7vw, 58px); font-weight: 400; letter-spacing: -.04em; line-height: 1.02; }
.story-copy { max-width: 760px; }
.story-copy p { margin: 0 0 1.55em; color: #414b59; font-family: Georgia, serif; font-size: clamp(18px, 1.55vw, 22px); line-height: 1.82; }
.story-copy p:last-child { margin-bottom: 0; }
.story-copy p:first-child::first-letter { float: left; margin: .08em .12em 0 0; color: var(--brown); font-size: 3.25em; line-height: .78; }

.next-page { position: relative; min-height: 700px; overflow: hidden; padding: clamp(100px,12vw,190px) var(--pad); background: var(--white); }
.next-page-lines { position: absolute; inset: 0; opacity: .5; background-image: linear-gradient(transparent 31px,rgba(23,32,51,.12) 32px); background-size: 100% 32px; }
.next-page-copy { position: relative; z-index: 2; max-width: 900px; }
.next-number { display: block; margin-bottom: 50px; color: var(--brown); font-family: Georgia,serif; font-size: 90px; letter-spacing: .2em; line-height: .3; }
.next-page h2 { font-size: clamp(58px,8vw,130px); }
.next-page-copy > p:not(.diary-kicker) { max-width: 640px; margin: 28px 0 0; background: var(--white); color: #58606b; font-family: Georgia,serif; font-size: 18px; line-height: 1.7; }
.diary-button--dark { background: var(--ink); color: var(--white); }

.diary-footer { display: grid; grid-template-columns: 1fr 1fr auto; gap: 28px; align-items: center; padding: 45px var(--pad); border-top: 1px solid var(--ink); background: var(--paper-2); }
.diary-footer p { margin: 0; color: #5a616a; font-family: Georgia,serif; font-size: 13px; font-style: italic; }
.diary-footer > a:not(.diary-brand) { font-size: 10px; font-weight: 900; letter-spacing: .12em; text-decoration: none; text-transform: uppercase; }
.diary-footer small { grid-column: 1 / -1; padding-top: 18px; border-top: 1px solid var(--line); font-size: 9px; letter-spacing: .14em; }

.reveal { opacity: 0; transform: translateY(38px); transition: opacity .65s ease, transform .65s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) {
  .hero-copy { width: 66vw; }
  .hero-portrait { right: -14vw; width: 76vw; opacity: .78; }
  .birth-stamp { right: 3vw; }
  .story-chapter { grid-template-columns: minmax(170px, .3fr) minmax(0, 1fr); }
  .diary-footer { grid-template-columns: 1fr auto; }
  .diary-footer p { grid-column: 1 / -1; order: 3; }
}

@media (max-width: 720px) {
  .diary-header { height: 68px; padding: 0 18px; }
  .brand-k { width: 31px; height: 36px; }
  .diary-brand > span:last-child { display: none; }
  .diary-menu { position: relative; z-index: 2; display: grid; width: 46px; height: 42px; place-content: center; gap: 5px; padding: 0; border: 1px solid var(--ink); background: var(--white); clip-path: polygon(8% 0,100% 5%,94% 86%,76% 100%,0 92%); color: var(--ink); }
  .diary-menu span:not(.sr-only) { display: block; width: 19px; height: 2px; background: currentColor; transition: opacity .2s ease, transform .2s ease; }
  .diary-menu[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .diary-menu[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .diary-menu[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .diary-header nav { position: fixed; z-index: 1; inset: 0; display: flex; width: auto; flex-direction: column; align-items: flex-start; justify-content: center; gap: 24px; padding: 96px 28px 42px; background: rgba(244,239,229,.98); clip-path: polygon(0 0,100% 0,100% 95%,83% 100%,58% 96%,31% 100%,0 95%); opacity: 0; pointer-events: none; transform: translateY(-24px); transition: opacity .22s ease, transform .22s ease; }
  .diary-header nav.is-open { opacity: 1; pointer-events: auto; transform: translateY(0); }
  .diary-header nav a { width: 100%; padding: 10px 0; font-family: Georgia,serif; font-size: clamp(36px,12vw,58px); font-weight: 400; letter-spacing: -.04em; text-transform: none; }
  .diary-header nav a::after { bottom: 2px; }
  .diary-hero { min-height: 760px; height: 100svh; max-height: 860px; padding: 105px 20px 58px; }
  .hero-paper { background: linear-gradient(0deg,rgba(244,239,229,.98) 0 28%,rgba(244,239,229,.3) 80%),linear-gradient(90deg,rgba(244,239,229,.93),rgba(244,239,229,.08)); }
  .hero-copy { width: 100%; height: auto; justify-content: flex-start; }
  .hero-copy h1 { font-size: clamp(58px,17vw,84px); line-height: .88; }
  .hero-copy h1 span { white-space: normal; }
  .hero-copy h1 span:last-child { margin-left: 8px; }
  .hero-copy > p:not(.diary-kicker) { max-width: 92%; margin-top: 20px; font-size: 15px; line-height: 1.55; }
  .diary-button { min-height: 47px; margin-top: 20px; padding: 0 17px; }
  .hero-portrait { right: -32vw; bottom: -12vw; width: 133vw; opacity: .58; }
  .birth-stamp { right: 18px; bottom: 42px; width: 190px; min-height: 95px; padding: 13px; transform: rotate(-5deg); }
  .birth-stamp strong { font-size: 18px; }
  .diary-section { padding: 82px 20px; }
  .story-heading h2, .next-page h2 { font-size: clamp(48px,14vw,72px); }
  .story-prose { margin-top: 72px; }
  .story-chapter { grid-template-columns: 1fr; gap: 32px; padding: 66px 0; }
  .story-number { margin-bottom: 18px; font-size: 44px; }
  .story-chapter h3 { max-width: 330px; font-size: clamp(36px, 11vw, 48px); }
  .story-copy p { font-size: 17px; line-height: 1.78; }
  .next-page { min-height: 650px; padding: 100px 20px; }
  .diary-footer { grid-template-columns: 1fr; padding: 40px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
