:root {
  --idp-paper: #fff;
  --idp-warm-paper: #f5f2ea;
  --idp-ink: #000;
  --idp-ink-soft: #1c1c1c;
  --idp-muted: #686868;
  --idp-line: rgba(0, 0, 0, 0.18);
  --idp-progress: 0;
  --idp-scrolly-height: 620svh;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--idp-paper);
  color: var(--idp-ink);
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
}

body { overflow-x: clip; }
img, video { display: block; max-width: 100%; }

.idp-skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 10000;
  padding: 10px 12px;
  background: #fff;
  color: #000;
  transform: translateY(-180%);
}
.idp-skip-link:focus { transform: translateY(0); }

.idp-site-header {
  position: fixed;
  z-index: 200;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: env(safe-area-inset-top) clamp(16px, 3vw, 40px) 0;
  color: #fff;
  pointer-events: none;
}
.idp-site-header a { pointer-events: auto; }
.idp-brand {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-size: 20px;
  text-shadow: 0 1px 10px rgba(0,0,0,.42);
}

/*
 * First-paint invariant: the story height and sticky stage are pure CSS.
 * JavaScript never inserts a pin spacer, so no late viewport jump is possible.
 */
.idp-scrolly {
  position: relative;
  height: var(--idp-scrolly-height);
  background: #000;
}

.idp-scrolly__stage {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100svh;
  overflow: hidden;
  background: #000;
}

.idp-scrolly__media,
.idp-scrolly__poster,
.idp-scrolly__video,
.idp-scrolly__shade,
.idp-scrolly__overlays {
  position: absolute;
  inset: 0;
}

.idp-scrolly__media {
  overflow: hidden;
  background: #111;
}

.idp-scrolly__poster,
.idp-scrolly__video {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: 50% 50%;
}

.idp-scrolly__poster {
  z-index: 1;
  opacity: 1;
  transition: opacity 120ms linear;
}

.idp-scrolly__video {
  z-index: 2;
  opacity: 0;
  transition: opacity 120ms linear;
  background: #111;
}

.idp-scrolly.is-video-ready .idp-scrolly__video { opacity: 1; }
.idp-scrolly.is-video-ready .idp-scrolly__poster { opacity: 0; }

.idp-scrolly__shade {
  z-index: 3;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.27), rgba(0,0,0,.03) 35%, rgba(0,0,0,.30)),
    linear-gradient(to right, rgba(0,0,0,.18), transparent 48%);
  pointer-events: none;
}

.idp-scrolly__overlays {
  z-index: 10;
  color: #fff;
  pointer-events: none;
}

.idp-story {
  position: absolute;
  margin: 0;
  backface-visibility: hidden;
}

/* Correct first-paint state: hero visible, every later card hidden. */
.idp-story--hero {
  left: clamp(16px, 5vw, 72px);
  right: clamp(16px, 5vw, 72px);
  bottom: clamp(44px, 9vh, 100px);
  max-width: 1000px;
  opacity: 1;
  transform: translate3d(0,0,0);
}

.idp-story--card {
  width: min(520px, calc(100vw - 32px));
  padding: clamp(22px, 3vw, 38px);
  background: rgba(255,255,255,.95);
  color: #000;
  border: 1px solid rgba(0,0,0,.14);
  opacity: 0;
  transform: translate3d(0,48px,0) scale(.975);
}

.idp-story__kicker,
.idp-after__kicker {
  margin: 0 0 12px;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.idp-story__display {
  margin: 0;
  font-size: clamp(62px, 13vw, 190px);
  line-height: 0.82;
  letter-spacing: -0.065em;
  font-weight: 700;
}
.idp-story__lede {
  max-width: 520px;
  margin: 24px 0 0;
  font-size: clamp(18px, 2.1vw, 30px);
  line-height: 1.25;
}
.idp-story__scroll {
  margin-top: 28px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
}
.idp-story--card h2 {
  margin: 0;
  font-size: clamp(34px, 4.2vw, 66px);
  line-height: .94;
  letter-spacing: -.045em;
}
.idp-story--card p:last-child {
  margin: 20px 0 0;
  max-width: 42ch;
  font-size: 16px;
  line-height: 1.45;
}
.idp-story--about {
  left: clamp(16px, 6vw, 84px);
  bottom: clamp(56px, 10vh, 120px);
}
.idp-story--vision {
  right: clamp(16px, 6vw, 84px);
  top: clamp(88px, 13vh, 150px);
}
.idp-story--works {
  left: clamp(16px, 12vw, 180px);
  top: clamp(90px, 18vh, 190px);
}

.idp-scrolly__rail {
  position: absolute;
  z-index: 30;
  right: 12px;
  top: 18%;
  bottom: 18%;
  width: 2px;
  background: rgba(255,255,255,.24);
}
.idp-scrolly__rail span {
  position: absolute;
  inset: 0;
  background: #fff;
  transform-origin: 50% 0;
  transform: scaleY(var(--idp-progress));
}

.idp-after {
  min-height: 100svh;
  padding: clamp(96px, 14vw, 220px) clamp(20px, 6vw, 90px);
  background: var(--idp-paper);
}
.idp-after > h2 {
  max-width: 980px;
  margin: 0;
  font-size: clamp(48px, 8vw, 120px);
  line-height: .88;
  letter-spacing: -.055em;
}
.idp-after > p:not(.idp-after__kicker) {
  max-width: 680px;
  margin: 28px 0 0;
  font-size: clamp(18px, 2vw, 28px);
  line-height: 1.35;
}
.idp-after__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  margin-top: 72px;
  border-top: 1px solid var(--idp-line);
}
.idp-after__grid > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px 0;
  border-bottom: 1px solid var(--idp-line);
}
.idp-after__grid > div:nth-child(odd) { padding-right: 24px; }
.idp-after__grid > div:nth-child(even) { padding-left: 24px; border-left: 1px solid var(--idp-line); }
.idp-after__grid span { color: var(--idp-muted); }

.idp-site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 32px clamp(20px, 6vw, 90px);
  background: #000;
  color: #fff;
  font-size: 12px;
}

.idp-basic-page {
  min-height: 100svh;
  padding: 120px clamp(20px, 6vw, 90px);
}
.idp-basic-page a { color: inherit; }
.idp-basic-page article { max-width: 760px; margin: 0 auto 64px; }
.idp-basic-page h1 { font-size: clamp(50px, 8vw, 110px); line-height: .9; }
.idp-basic-page h2 { font-size: clamp(34px, 5vw, 64px); line-height: .95; }
.idp-basic-page img { max-width: 100%; height: auto; }
.idp-entry-content { font-size: 18px; line-height: 1.6; }

.idp-debug {
  position: fixed;
  z-index: 1000;
  left: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: min(380px, calc(100vw - 24px));
  padding: 12px;
  background: rgba(0,0,0,.90);
  color: #fff;
  border: 1px solid rgba(255,255,255,.22);
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  pointer-events: none;
}

/* No-JS: same semantic story becomes a normal readable document. */
.no-js .idp-site-header {
  position: absolute;
}
.no-js .idp-scrolly {
  height: auto;
  background: #fff;
}
.no-js .idp-scrolly__stage {
  position: relative;
  height: auto;
  overflow: visible;
  background: #fff;
}
.no-js .idp-scrolly__media {
  position: relative;
  height: min(78svh, 760px);
  min-height: 420px;
}
.no-js .idp-scrolly__video,
.no-js .idp-scrolly__shade,
.no-js .idp-scrolly__rail {
  display: none;
}
.no-js .idp-scrolly__overlays {
  position: relative;
  inset: auto;
  background: #fff;
  color: #000;
}
.no-js .idp-story {
  position: relative;
  inset: auto;
  width: auto;
  max-width: none;
  opacity: 1;
  transform: none;
  padding: 54px 20px;
  background: #fff;
  color: #000;
  border: 0;
  border-bottom: 1px solid var(--idp-line);
}
.no-js .idp-story__display,
.no-js .idp-story--card h2 {
  font-size: clamp(40px, 10vw, 92px);
  line-height: .9;
}
.no-js .idp-story__scroll { display: none; }

@media (max-width: 760px) {
  :root { --idp-scrolly-height: 480svh; }

  .idp-scrolly__stage { height: 100svh; }
  .idp-story--hero { bottom: max(36px, calc(24px + env(safe-area-inset-bottom))); }
  .idp-story__display { font-size: clamp(58px, 19vw, 88px); }

  .idp-story--card {
    left: 16px;
    right: 16px;
    width: auto;
    top: auto;
    bottom: max(8svh, calc(42px + env(safe-area-inset-bottom)));
    padding: 22px;
  }
  .idp-story--card h2 { font-size: clamp(32px, 9.8vw, 48px); }
  .idp-story--card p:last-child { font-size: 15px; }

  .idp-scrolly__rail { right: 6px; }

  .idp-after__grid { grid-template-columns: 1fr; }
  .idp-after__grid > div:nth-child(odd),
  .idp-after__grid > div:nth-child(even) {
    padding-left: 0;
    padding-right: 0;
    border-left: 0;
  }
  .idp-site-footer { flex-direction: column; }
}

/* Reduced motion is handled at first paint, before JavaScript executes. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }

  .idp-site-header {
    position: absolute;
  }
  .idp-scrolly {
    height: auto;
    background: #fff;
  }
  .idp-scrolly__stage {
    position: relative;
    height: auto;
    overflow: visible;
    background: #fff;
  }
  .idp-scrolly__media {
    position: relative;
    height: min(78svh, 760px);
    min-height: 420px;
  }
  .idp-scrolly__video,
  .idp-scrolly__shade,
  .idp-scrolly__rail {
    display: none;
  }
  .idp-scrolly__overlays {
    position: relative;
    inset: auto;
    background: #fff;
    color: #000;
  }
  .idp-story {
    position: relative;
    inset: auto;
    width: auto;
    max-width: none;
    opacity: 1 !important;
    transform: none !important;
    padding: 54px 20px;
    background: #fff;
    color: #000;
    border: 0;
    border-bottom: 1px solid var(--idp-line);
  }
  .idp-story__display,
  .idp-story--card h2 {
    font-size: clamp(40px, 10vw, 92px);
    line-height: .9;
  }
  .idp-story__scroll { display: none; }
}

/* Basic non-cinematic templates remain readable while the full blog design is deferred. */
.idp-inner-page .idp-site-header {
  position: absolute;
  color: #000;
}
.idp-inner-page .idp-brand { text-shadow: none; }
.idp-basic-page__header { margin: 0 auto 72px; max-width: 1100px; }
.idp-basic-page__header h1,
.idp-basic-page > article > h1 {
  margin: 0;
  font-size: clamp(50px, 8vw, 110px);
  line-height: .9;
  letter-spacing: -.05em;
}
.idp-post-list { max-width: 1100px; margin: 0 auto; border-top: 1px solid var(--idp-line); }
.idp-post-card { padding: 32px 0; border-bottom: 1px solid var(--idp-line); }
.idp-post-card h2 { margin: 0; font-size: clamp(30px, 4vw, 58px); line-height: .98; }
.idp-post-card h2 a { text-decoration: none; }
.idp-post-card > p:not(.idp-story__kicker) { max-width: 60ch; color: var(--idp-muted); line-height: 1.55; }
.navigation.pagination { max-width: 1100px; margin: 48px auto 0; }
.nav-links { display: flex; flex-wrap: wrap; gap: 12px; }
.page-numbers { color: inherit; }
