/* ==========================================================================
   Indy Karveli · ikhard 2.0
   1. Tokens  2. Base  3. Layout  4. Type  5. Components  6. Sections
   7. Article & pages  8. Ghost content  9. Motion  10. Responsive
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
  --bg: #0b0b0b;
  --bg-2: #111110;
  --bg-3: #171615;
  --ink: #e8e4dc;
  --ink-2: #c9c4ba;
  --mute: #a39e95;
  --line: #2a2824;
  --line-2: #3a3732;
  --stone: #e8e4dc;
  --font-display: "Oswald", Impact, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --wrap: 1240px;
  --gutter: clamp(20px, 4vw, 40px);
  --space: clamp(72px, 9vw, 120px);
  --radius: 6px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --header-h: 72px;
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
::selection { background: var(--stone); color: var(--bg); }
:focus-visible { outline: 2px solid var(--stone); outline-offset: 3px; border-radius: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--stone); color: var(--bg); font-weight: 600; border-radius: var(--radius); }
.skip:focus { top: 16px; }

/* 3. Layout ---------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.sec { padding-block: var(--space); border-top: 1px solid var(--line); }
.sec--alt { background: var(--bg-2); }
.sec--top { border-top: 0; padding-top: clamp(56px, 7vw, 96px); }

/* 4. Type ------------------------------------------------------------------ */
.h {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.005em;
  text-transform: uppercase;
  text-wrap: balance;
}
.eye {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--mute);
}
.eye a:hover { color: var(--ink); }
.lead { margin: 0; max-width: 38rem; font-size: clamp(18px, 1.6vw, 21px); line-height: 1.55; color: var(--ink-2); }
.fine { margin: 12px 0 0; font-size: 13px; color: var(--mute); }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
.more {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px;
}
.more:hover { text-decoration-thickness: 2px; }

/* 5. Components ------------------------------------------------------------ */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  font: 600 15px/1 var(--font-body);
  color: var(--bg); background: var(--stone);
  border: 1px solid var(--stone); border-radius: var(--radius);
  cursor: pointer;
  transition: background .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.btn:hover { background: #fff; transform: translateY(-1px); }
.btn--ghost { min-height: 42px; padding: 0 16px; color: var(--ink); background: transparent; border-color: var(--line-2); }
.btn--ghost:hover { color: var(--bg); background: var(--stone); border-color: var(--stone); }

.arrow { display: inline-block; transition: transform .3s var(--ease); }
a:hover .arrow { transform: translateX(5px); }

/* Header */
.hd {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background .3s var(--ease), border-color .3s var(--ease);
}
.hd.is-scrolled {
  background: rgb(11 11 11 / .78);
  border-color: var(--line);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.hd__in { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: var(--header-h); }
.logo { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: .08em; text-transform: uppercase; }
.logo--sm { font-size: 19px; color: var(--ink); }
.nav { display: flex; align-items: center; gap: 30px; font-size: 15px; font-weight: 500; }
.nav a:not(.btn) { position: relative; color: var(--ink-2); transition: color .2s var(--ease); }
.nav a:not(.btn)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform .35s var(--ease);
}
.nav a:not(.btn):hover, .nav a[aria-current="page"] { color: #fff; }
.nav a:not(.btn):hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.hd__toggle { display: none; }

/* Subscribe form */
.sub { display: flex; flex-wrap: wrap; gap: 10px; max-width: 34rem; margin-top: 30px; }
.sub input {
  flex: 1 1 240px; min-height: 54px; padding: 0 18px;
  font: 16px var(--font-body); color: var(--bg);
  background: var(--stone); border: 1px solid transparent; border-radius: var(--radius);
}
.sub input::placeholder { color: #6f6a62; }
.sub button {
  min-height: 54px; padding: 0 26px;
  font: 600 16px/1 var(--font-display); letter-spacing: .08em; text-transform: uppercase;
  color: var(--bg); background: #fff; border: 0; border-radius: var(--radius); cursor: pointer;
  transition: transform .25s var(--ease), opacity .25s var(--ease);
}
.sub button:hover { transform: translateY(-1px); }
.sub .msg { display: none; width: 100%; margin: 0; font-size: 14px; color: var(--mute); }
.sub.success .msg.ok, .sub.error .msg.err { display: block; }
.sub.loading button { opacity: .6; }

/* Section head */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: clamp(28px, 4vw, 44px); }
.head .h { font-size: clamp(36px, 4.6vw, 56px); }

/* Page head */
.page-hd { display: grid; gap: 20px; margin-bottom: clamp(32px, 4vw, 48px); }
.page-hd__title { font-size: clamp(52px, 8vw, 96px); line-height: .92; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 36px; }
.chips a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px;
  font-size: 14px; color: var(--ink-2);
  border: 1px solid var(--line-2); border-radius: 999px;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.chips a:hover { color: var(--ink); border-color: var(--ink); }
.chips a.is-on { color: var(--bg); background: var(--stone); border-color: var(--stone); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.card {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 30px 28px 64px; background: var(--bg);
  transition: background .35s var(--ease);
}
.sec--alt .card { background: var(--bg-2); }
.card:hover, .sec--alt .card:hover { background: var(--bg-3); }
.card__t { font-family: var(--font-display); font-weight: 600; font-size: clamp(24px, 2.2vw, 28px); line-height: 1.06; text-transform: uppercase; text-wrap: balance; }
.card__d { font-size: 15px; line-height: 1.55; color: var(--mute); }
.card .arrow { position: absolute; left: 28px; bottom: 24px; font-size: 20px; color: var(--ink-2); }

/* Topic grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.grid > * { display: flex; flex-direction: column; gap: 10px; padding: 32px 28px; background: var(--bg); transition: background .3s var(--ease); }
.grid > a:hover { background: var(--bg-3); }
.grid .n { font-family: var(--font-display); font-weight: 700; font-size: 30px; text-transform: uppercase; }
.grid .d { font-size: 15px; line-height: 1.5; color: var(--mute); }

/* Rows (newsletter issues) */
.rows { border-bottom: 1px solid var(--line); }
.row { display: grid; grid-template-columns: 170px 1fr; align-items: baseline; gap: 12px; padding: 26px 0; border-top: 1px solid var(--line); }
.row .m { font-size: 14px; color: var(--mute); }
.row .t { font-family: var(--font-display); font-weight: 500; font-size: clamp(24px, 3vw, 32px); line-height: 1.15; text-transform: uppercase; }
.row:hover .t { text-decoration: underline; text-underline-offset: 6px; }

.empty { margin: 0; padding: 40px 0; border-top: 1px solid var(--line); color: var(--mute); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 32px 0 0; font-size: 15px; color: var(--mute); }

/* Book covers */
.covers { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.cover { display: flex; flex-direction: column; justify-content: space-between; align-items: center; aspect-ratio: 2 / 3; padding: 28px 22px; text-align: center; background: #050505; border: 1px solid var(--line); border-radius: 3px; }
.cover:nth-child(even) { background: var(--bg-2); }
.cover .a { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--mute); }
.cover .ct { font-family: var(--font-display); font-weight: 700; font-size: 38px; line-height: .98; text-transform: uppercase; }
.cover .cs { font-size: 13px; line-height: 1.4; color: var(--ink-2); }

/* 6. Sections -------------------------------------------------------------- */

/* Hero */
.hero { padding-block: clamp(48px, 6vw, 88px) clamp(64px, 8vw, 112px); }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .65fr); gap: clamp(40px, 6vw, 88px); align-items: center; }
.hero__copy { display: grid; gap: 0; }
.hero__title { margin: 22px 0 26px; font-size: clamp(42px, 5vw, 80px); line-height: .92; }
@media (min-width: 761px) { .hero__title .ln { white-space: nowrap; } }
.hero__title .ln { display: block; overflow: hidden; padding-bottom: .04em; }
.hero__title .ln > span { display: block; }
.hero__photo { position: relative; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; aspect-ratio: 4 / 5; background: var(--bg-2); box-shadow: 0 0 0 8px var(--bg), 0 0 0 9px var(--line); }
.hero__photo img { width: 100%; height: 100%; object-fit: cover; }
.hero--plain .hero__grid { grid-template-columns: 1fr; }
.hero--full { display: grid; align-items: center; min-height: calc(100svh - var(--header-h)); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.actions .btn { min-height: 54px; padding: 0 24px; }

/* Signup band */
.band { background: var(--stone); color: var(--bg); }
.band .in { display: flex; flex-direction: column; align-items: center; gap: 18px; max-width: 760px; margin-inline: auto; padding: var(--space) var(--gutter); text-align: center; }
.band .h { font-size: clamp(36px, 5vw, 56px); }
.band p { margin: 0; font-size: 18px; line-height: 1.55; color: #3a3732; }
.band .sub { justify-content: center; width: 100%; max-width: 520px; margin: 6px 0 0; }
.band .sub input { background: #fff; border-color: var(--bg); }
.band .sub button { color: var(--stone); background: var(--bg); }
.band .sub .msg, .band .fine { color: #4a463f; }

/* Footer */
.ft { border-top: 1px solid var(--line); font-size: 14px; color: var(--mute); }
.ft .cols { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 32px; padding-block: 56px 40px; }
.ft .col { display: flex; flex-direction: column; gap: 10px; }
.ft .col a { width: fit-content; color: var(--ink-2); transition: color .2s var(--ease); }
.ft .col a:hover { color: #fff; }
.ft .copy { padding-bottom: 40px; font-size: 13px; color: #8f8a80; }

/* 7. Article & pages ------------------------------------------------------- */
.progress { position: fixed; inset: 0 0 auto; z-index: 60; height: 3px; background: var(--stone); transform-origin: 0 50%; transform: scaleX(0); }
.art { max-width: 760px; margin-inline: auto; padding: clamp(48px, 7vw, 96px) var(--gutter) var(--space); }
.art__hd { display: grid; gap: 20px; padding-bottom: 36px; margin-bottom: 40px; border-bottom: 1px solid var(--line); }
.art__title { font-size: clamp(44px, 6.4vw, 76px); line-height: .95; }
.art__dek { margin: 0; font-size: clamp(19px, 1.8vw, 22px); line-height: 1.5; color: var(--ink-2); }
.art__by { margin: 0; font-size: 14px; color: var(--mute); }
.art__by a { text-decoration: underline; text-underline-offset: 3px; }

.page { max-width: 760px; margin-inline: auto; padding: clamp(48px, 7vw, 96px) var(--gutter) var(--space); }
.page__title { margin-bottom: 32px; font-size: clamp(48px, 7vw, 88px); line-height: .94; }

/* 8. Ghost content --------------------------------------------------------- */
.gh-content { font-size: 20px; line-height: 1.72; color: #dad5cb; }
.gh-content > * { margin: 0 0 1.15em; }
.gh-content > :last-child { margin-bottom: 0; }
.gh-content h2, .gh-content h3 { margin: 1.7em 0 .6em; font-family: var(--font-display); font-weight: 700; line-height: 1.08; text-transform: uppercase; color: var(--ink); text-wrap: balance; }
.gh-content h2 { font-size: clamp(28px, 3vw, 36px); }
.gh-content h3 { font-size: 26px; }
.gh-content strong { color: #fff; font-weight: 600; }
.gh-content a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--mute); transition: text-decoration-color .2s var(--ease); }
.gh-content a:hover { text-decoration-color: var(--ink); }
.gh-content blockquote { margin: 1.6em 0; padding-left: 24px; border-left: 3px solid var(--stone); font-family: var(--font-display); font-weight: 500; font-size: clamp(24px, 2.6vw, 30px); line-height: 1.2; text-transform: uppercase; color: #fff; }
.gh-content blockquote.kg-blockquote-alt { padding: 0; border: 0; text-align: center; }
.gh-content ul, .gh-content ol { padding-left: 1.2em; }
.gh-content li { margin: .45em 0; }
.gh-content li::marker { color: var(--mute); }
.gh-content hr { margin: 2.4em 0; border: 0; border-top: 1px solid var(--line); }
.gh-content figure { margin: 1.6em 0; }
.gh-content figcaption { margin-top: 10px; font-size: 14px; text-align: center; color: var(--mute); }
.gh-content table { width: 100%; border-collapse: collapse; font-size: 16px; }
.gh-content td, .gh-content th { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.gh-content .kg-width-wide { width: min(1040px, 100vw - 2 * var(--gutter)); margin-left: 50%; transform: translateX(-50%); }
.gh-content .kg-width-full { width: 100vw; margin-left: 50%; transform: translateX(-50%); }
.gh-content .kg-width-full img { width: 100%; }

/* 9. Motion ---------------------------------------------------------------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

@media (prefers-reduced-motion: no-preference) {
  /* Hero entrance */
  .hero__title .ln > span { animation: rise 1s var(--ease) both; animation-delay: calc(var(--d, 0) * 110ms + 120ms); }
  .rise { animation: fade-up .9s var(--ease) both; animation-delay: calc(var(--d, 0) * 110ms + 120ms); }
  .hero__photo img { animation: settle 1.6s var(--ease) both; }
  .hero__photo { animation: unveil 1.2s var(--ease) both .15s; }

  /* Scroll reveal (enabled by JS) */
  .js-reveal [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
  .js-reveal [data-reveal].is-in { opacity: 1; transform: none; }

  /* Reading progress (scroll-driven, progressive) */
  @supports (animation-timeline: scroll()) {
    .progress { animation: grow linear both; animation-timeline: scroll(root); }
  }
}

@keyframes rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes settle { from { transform: scale(1.12); } to { transform: scale(1); } }
@keyframes unveil { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes grow { to { transform: scaleX(1); } }

/* 10. Responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero--full { min-height: 0; }
  .hero__photo { width: 100%; max-width: 420px; }
  .cards, .grid { grid-template-columns: 1fr 1fr; }
  .ft .cols { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .hd__toggle {
    display: grid; place-content: center; gap: 6px;
    width: 44px; height: 44px; padding: 0;
    background: transparent; border: 1px solid var(--line-2); border-radius: var(--radius); cursor: pointer;
  }
  .hd__toggle span:not(.sr) { display: block; width: 18px; height: 1.5px; background: var(--ink); transition: transform .3s var(--ease); }
  .nav-open .hd__toggle span:nth-of-type(2) { transform: translateY(3.75px) rotate(45deg); }
  .nav-open .hd__toggle span:nth-of-type(3) { transform: translateY(-3.75px) rotate(-45deg); }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto; z-index: 49;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px var(--gutter) 24px;
    background: rgb(11 11 11 / .96); border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s;
  }
  .nav-open .nav { opacity: 1; visibility: visible; transform: none; }
  .nav a:not(.btn) { padding: 16px 0; font-size: 20px; border-bottom: 1px solid var(--line); }
  .nav a:not(.btn)::after { display: none; }
  .nav .btn { margin-top: 20px; min-height: 50px; }
  .nav-open .hd { background: var(--bg); border-color: var(--line); }

  .cards, .grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; gap: 4px; }
  .gh-content { font-size: 18px; }
  .ft .cols { grid-template-columns: 1fr 1fr; padding-block: 44px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Contact */
.ways { display: grid; gap: 10px; margin-top: 32px; max-width: 560px; }
.ways__q { margin: 0 0 6px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
.way {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 16px 20px; border: 1px solid var(--line-2); border-radius: 12px;
  color: var(--ink); text-decoration: none;
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.way b { display: block; font-weight: 600; }
.way small { display: block; margin-top: 3px; font-size: 14px; color: var(--mute); }
.way:hover { border-color: var(--ink-2); background: var(--bg-2); }
.way:hover .arrow { transform: translateX(5px); }

.contact-form { align-self: center; padding: 24px 24px 4px; border: 1px solid var(--line-2); border-radius: 12px; }
.contact-form iframe { display: block; width: 100%; border: 0; }

.ft__h { margin: 0 0 4px; font-family: var(--font-body); font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--ink); }

.nav__item { color: var(--ink-2); cursor: default; }
@media (max-width: 760px) { .nav__item { padding: 16px 0; font-size: 20px; border-bottom: 1px solid var(--line); } }

.ft__soon { color: var(--mute); }

.empty { padding-top: 28px; border-top: 1px solid var(--line); color: var(--mute); }

.hero__title--book { font-size: clamp(56px, 7.2vw, 116px); }

.strap { max-width: 34em; margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 600; line-height: 1.45; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }

/* Essays page */
.block + .block { margin-top: clamp(56px, 7vw, 96px); }
.count { color: var(--mute); }
.cards--feat { grid-template-columns: 1.5fr 1fr 1fr; }
.cards--feat .card:first-child .card__t { font-size: clamp(30px, 3vw, 44px); }
.cards--feat .card:first-child { padding-block: 40px 72px; }
@media (max-width: 1000px) { .cards--feat { grid-template-columns: 1fr; } }

/* Signup band */
.band .in { display: grid; grid-template-columns: 1.1fr .9fr; align-items: end; gap: clamp(32px, 5vw, 72px); max-width: var(--wrap, 1200px); text-align: left; }
.band .h { font-size: clamp(44px, 6vw, 84px); line-height: .95; text-align: left; }
.band__copy p { margin-top: 22px; max-width: 30em; font-size: 19px; color: #2e2b27; }
.band__copy em { font-style: italic; font-weight: 600; }
.band .sub { justify-content: flex-start; max-width: none; margin: 0; }
.band .fine { margin-top: 14px; text-align: left; }
.band .fine a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 860px) { .band .in { grid-template-columns: 1fr; align-items: start; } }

.page-hd + .block { margin-top: clamp(40px, 5vw, 64px); }

@media (max-width: 760px) { .hero__title--book { font-size: 13.2vw; line-height: .96; } .hero__title--book .ln { white-space: nowrap; } }
