:root {
  --bg: #F3EFE6;
  --ink: #17181A;
  --muted: #5B574F;
  --line: rgba(23, 24, 26, .16);
  --ridge: #E9E3D6;
  --accent: #C4432A;
  --on-accent: #FBF8F2;
  --gutter: clamp(20px, 4.5vw, 64px);
  --ease: cubic-bezier(.16, 1, .3, 1);
}
:root[data-theme="dark"] {
  --bg: #131416;
  --ink: #F1ECE2;
  --muted: #A8A298;
  --line: rgba(241, 236, 226, .18);
  --ridge: #1C1D20;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .6s var(--ease), color .6s var(--ease);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.serif { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; }
.label { font-size: 13px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.wrap { padding-inline: var(--gutter); }

/* Grain */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Cursor */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 100; pointer-events: none;
  width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: var(--accent); mix-blend-mode: normal;
  transition: width .4s var(--ease), height .4s var(--ease), margin .4s var(--ease), opacity .3s;
  opacity: 0;
}
.cursor.is-on { opacity: 1; }
.cursor.is-hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; opacity: .25; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* Nav */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px var(--gutter); font-size: 15px; font-weight: 500;
  transition: transform .6s var(--ease), background .4s, backdrop-filter .4s;
}
.nav.is-scrolled { background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.nav.is-hidden { transform: translateY(-100%); }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; white-space: nowrap; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: pulse 2.8s var(--ease) infinite; }
.nav-links { display: flex; align-items: center; gap: clamp(16px, 3vw, 40px); }
.nav-links a, .nav-links button { min-height: 44px; display: flex; align-items: center; position: relative; }
.nav-links a:not(.pill)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 10px; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right; transition: transform .5s var(--ease);
}
.nav-links a:not(.pill):hover::after { transform: scaleX(1); transform-origin: left; }
.pill { padding: 0 20px; border: 1px solid var(--ink); border-radius: 999px; transition: background .3s, color .3s; }
.pill:hover { background: var(--ink); color: var(--bg); }
.theme-btn { width: 44px; justify-content: center; }
.lang-btn { font-weight: 500; letter-spacing: .06em; }
.theme-btn svg { transition: transform .8s var(--ease); }
:root[data-theme="dark"] .theme-btn svg { transform: rotate(180deg); }
@media (max-width: 720px) {
  .nav { gap: 16px; }
  .nav-links { gap: 12px; }
  .nav-links .hide-sm { display: none; }
  .pill { padding: 0 16px; }
}
@media (max-width: 374px) { .nav-links .pill { display: none; } }

/* Hero */
.hero { position: relative; min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; padding-top: 120px; padding-bottom: clamp(200px, 22vw, 290px); overflow: hidden; }
.hero-meta { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero-title {
  margin: 8px 0 0 -0.03em; font-size: clamp(96px, 24vw, 360px); line-height: .86; letter-spacing: -.045em;
  display: flex; will-change: transform;
}
.hero-title .ch { display: inline-block; overflow: hidden; padding-bottom: .06em; }
.hero-title .ch span { display: inline-block; transform: translateY(110%); animation: rise 1.2s var(--ease) forwards; }
.hero-title em { color: var(--accent); }
.hero-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; margin-top: 32px; flex-wrap: wrap; }
.hero-line { margin: 0; max-width: 620px; font-size: clamp(26px, 3vw, 40px); line-height: 1.12; }

.ridge { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; overflow: visible; }
.ridge-fill { fill: var(--ridge); opacity: 0; animation: fade 1.6s .9s var(--ease) forwards; transition: fill .6s; }
.ridge-line { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; stroke-dasharray: 2200; stroke-dashoffset: 2200; animation: draw 2.6s .3s var(--ease) forwards; }
.peak { opacity: 0; animation: fade .8s 2.2s var(--ease) forwards; }
.peak circle { fill: var(--accent); }
.peak .ring { fill: none; stroke: var(--accent); transform-origin: 640px 34px; animation: ring 2.4s 2.4s ease-out infinite; }
.peak line { stroke: var(--accent); stroke-width: 1.5; }
.peak text { fill: var(--ink); font: 700 12px 'Manrope', sans-serif; letter-spacing: 1.6px; }
@media (max-width: 720px) {
  .ridge { width: 250%; left: -60%; }
  .peak text { font-size: 17px; }
}

/* Marquee */
.marquee { height: clamp(72px, 7vw, 104px); overflow: hidden; display: flex; align-items: center; background: var(--accent); color: var(--on-accent); }
.marquee-track { display: flex; gap: 48px; white-space: nowrap; font-size: clamp(30px, 3.4vw, 48px); font-style: italic; padding-left: 48px; will-change: transform; }
.marquee-track span:nth-child(even) { font-style: normal; opacity: .6; }

/* Sections */
section { padding-top: clamp(96px, 11vw, 160px); }
.sec-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 32px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sec-title { margin: 0; font-size: clamp(56px, 8vw, 120px); line-height: .9; letter-spacing: -.03em; }

/* Work */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 64px 48px; margin-top: 56px; }
.card { display: flex; flex-direction: column; gap: 20px; }
.card:nth-child(even) { margin-top: 96px; }
.card-media {
  position: relative; aspect-ratio: 4 / 3; border-radius: 4px; overflow: hidden; border: 1px solid var(--line);
  clip-path: inset(100% 0 0 0); transition: clip-path 1.4s var(--ease);
}
.card.is-in .card-media { clip-path: inset(0 0 0 0); }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 1.2s var(--ease); }
.card:hover .card-media img { transform: scale(1.04); }
.card-media.book { background: #fff; }
.card-media.book img { top: 9%; left: 50%; width: auto; height: 82%; transform: translateX(-50%); border-radius: 2px 4px 4px 2px; box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 12px 24px -6px rgba(0, 0, 0, .22), 0 36px 64px -18px rgba(0, 0, 0, .35); }
.card:hover .card-media.book img { transform: translateX(-50%) scale(1.04); }
.card-view {
  position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; transform: scale(0); transition: transform .6s var(--ease);
}
.card:hover .card-view { transform: scale(1); }
.card-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; }
.card-n { font-size: 13px; font-weight: 700; color: var(--accent); }
.card-name { flex-grow: 1; font-size: clamp(26px, 2.6vw, 36px); line-height: 1; }
.card-meta { font-size: 14px; color: var(--muted); white-space: nowrap; }
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .card:nth-child(even) { margin-top: 0; }
}

/* About */
.about { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; align-items: start; }
.about-media { grid-column: span 4; display: flex; flex-direction: column; gap: 20px; }
.portrait { aspect-ratio: 3 / 4; border-radius: 999px 999px 4px 4px; border: 1px solid var(--line); overflow: hidden; position: relative; }
.portrait img { position: absolute; top: -8%; left: 0; width: 100%; height: 116%; object-fit: cover; object-position: 50% center; will-change: transform; }
.about-text { grid-column: 6 / span 7; display: flex; flex-direction: column; gap: 48px; padding-top: 40px; }
.statement { margin: 0; font-size: clamp(34px, 4vw, 58px); line-height: 1.08; letter-spacing: -.01em; }
.statement .w { opacity: .14; transition: opacity .4s; }
.statement .w.lit { opacity: 1; }
.statement em { color: var(--accent); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-top: 32px; border-top: 1px solid var(--line); }
.facts b { display: block; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 8px; }
.facts span { font-size: 16px; line-height: 1.5; color: var(--muted); }
@media (max-width: 860px) {
  .about-media { grid-column: 1 / -1; max-width: 360px; }
  .about-text { grid-column: 1 / -1; }
  .facts { grid-template-columns: 1fr; }
}

/* Contact */
.contact { margin-top: clamp(96px, 11vw, 160px); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 40px; padding-bottom: 96px; }
.contact-title { margin: 0; font-size: clamp(96px, 17vw, 260px); line-height: .88; letter-spacing: -.045em; }
.contact-title em { color: var(--accent); display: inline-block; }
.contact-row { display: flex; justify-content: space-between; align-items: center; gap: 32px; flex-wrap: wrap; }
.mail {
  display: inline-flex; align-items: center; gap: 16px; min-height: 64px; padding: 0 32px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: 20px; font-weight: 500; position: relative; overflow: hidden;
  transition: transform .5s var(--ease);
}
.mail::before { content: ""; position: absolute; inset: 0; background: var(--accent); transform: translateY(101%); transition: transform .6s var(--ease); }
.mail:hover::before { transform: translateY(0); }
.mail > * { position: relative; }
.mail:hover { color: var(--on-accent); }
.mail svg { transition: transform .5s var(--ease); }
.mail:hover svg { transform: rotate(45deg); }

footer { height: 84px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 13px; color: var(--muted); margin-inline: var(--gutter); }
footer a { min-height: 44px; display: flex; align-items: center; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

@keyframes rise { to { transform: translateY(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(.7); } }
@keyframes ring { from { transform: scale(1); opacity: .8; } to { transform: scale(4); opacity: 0; } }

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