/* =========================================================
   Kaisedox — landing page styles
   Design tokens, layout, scroll-timeline choreography.
   ========================================================= */

:root {
  --kx-blue: #1d4aff;
  --kx-cream: #f5ead1;
  --kx-yellow: #efe681;
  --kx-orange: #ff8a3d;
  --kx-page-bg: #ffffff;
  --kx-scrollbar-track: rgba(255, 255, 255, 0.2);
  --kx-scrollbar-thumb: rgba(255, 255, 255, 0.82);

  --kx-font-display: "Inter", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --kx-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo,
    Consolas, monospace;

  --kx-max: 1440px;
  --kx-pad-x: clamp(24px, 4vw, 120px);
  --kx-pad-y: clamp(28px, 4vw, 80px);
}

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

html {
  background: var(--kx-page-bg);
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-color: var(--kx-scrollbar-thumb) var(--kx-scrollbar-track);
  scrollbar-width: thin;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--kx-cream);
  font-family: var(--kx-font-display);
  background: var(--kx-page-bg);
}

body::-webkit-scrollbar {
  width: 12px;
}

body::-webkit-scrollbar-track {
  background: var(--kx-scrollbar-track);
}

body::-webkit-scrollbar-thumb {
  background: var(--kx-scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--kx-scrollbar-track);
}

/* White OS cursor — a crisp arrow drawn as an SVG data URI so it's cream on every OS */
body {
  cursor:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><path d='M2 2 L2 15 L6 11 L9 17 L12 16 L9 10 L15 10 Z' fill='%23F5EAD1' stroke='%23002FA7' stroke-width='1'/></svg>")
      2 2,
    default;
}

a,
button,
[role="button"] {
  cursor:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='26' viewBox='0 0 20 26'><path d='M6 2 L6 14 L3 14 L10 24 L17 14 L14 14 L14 2 Z' fill='%23F5EAD1' stroke='%23002FA7' stroke-width='1'/></svg>")
      10 2,
    pointer;
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

main {
  display: block;
  overflow-x: clip;
}

.kx-intro-stack {
  position: relative;
}

.kx-intro-stack.is-animated {
  perspective: 2200px;
  perspective-origin: 50% 24vh;
}

.kx-intro-stack.is-animated > .kx-section {
  position: sticky;
  top: 0;
  transform-origin: center 16%;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

.kx-intro-stack.is-animated > .kx-hero {
  z-index: 1;
}

.kx-intro-stack.is-animated > #s01 {
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 124px, 280px) scale(1.06);
}

/* Visually-hidden helper (for wordmark screen-reader text) */
.kx-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* SVG defs block (hidden) */
.kx-svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* =========================================================
   Custom cursor
   ========================================================= */

.kx-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--kx-cream);
  box-shadow: 0 0 24px rgba(245, 234, 209, 0.35);
  pointer-events: none;
  z-index: 9999;
  transform: translate3d(-50px, -50px, 0) scale(1);
  transition: transform 0.08s linear, width 0.18s ease, height 0.18s ease,
    opacity 0.2s ease;
  will-change: transform;
  mix-blend-mode: normal;
}

.kx-cursor.is-hovering {
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1.5px solid var(--kx-cream);
  box-shadow: 0 0 18px rgba(245, 234, 209, 0.25);
}

/* =========================================================
   Section shell
   ========================================================= */

.kx-section {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  padding: var(--kx-pad-y) var(--kx-pad-x);
  overflow: hidden;
  color: var(--kx-cream);
  background-color: var(--kx-blue);
  background-image: radial-gradient(
    circle,
    rgba(245, 234, 209, 0.06) 1px,
    transparent 1px
  );
  background-size: 28px 28px;
  background-position: 0 0;
  isolation: isolate;
}

/* Grain overlay (all sections) */
.kx-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.32;
  mix-blend-mode: overlay;
}

.kx-grain svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Ensure content sits above decorative layers */
.kx-section > *:not(.kx-grain) {
  position: relative;
  z-index: 2;
}

/* =========================================================
   Hero
   ========================================================= */

.kx-hero {
  position: relative;
  padding-top: clamp(24px, 3vw, 36px);
  padding-bottom: clamp(24px, 3vw, 36px);
}

/* Top bar */
.kx-top-bar {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 24px;
  font-family: var(--kx-font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--kx-cream);
  text-transform: uppercase;
}

.kx-brand {
  flex: 0 0 auto;
}

.kx-top-bar-spacer {
  flex: 1 1 auto;
}

.kx-top-bar-link {
  flex: 0 0 auto;
  color: var(--kx-cream);
  transition: color 0.2s ease;
}

.kx-top-bar-link:hover {
  color: var(--kx-yellow);
}

/* Hero content */
.kx-hero-content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(18px, 2vw, 32px);
  width: 100%;
  text-align: center;
}

.kx-wordmark {
  display: inline-flex;
  justify-content: center;
  font-weight: 900;
  font-size: clamp(70px, 12.3vw, 184px);
  line-height: 0.88;
  letter-spacing: -0.045em;
  color: var(--kx-cream);
  white-space: nowrap;
  text-transform: uppercase;
}

.kx-wordmark-shell {
  --kx-type-step: 92ms;
  --kx-type-gap: 0.11em;
  position: relative;
  display: inline-flex;
  align-items: baseline;
}

.kx-wordmark-ghost {
  display: inline-flex;
  align-items: baseline;
  flex: 0 0 auto;
  visibility: hidden;
}

.kx-wordmark-reveal {
  position: absolute;
  inset: 0 auto 0 0;
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-start;
  white-space: nowrap;
  overflow: visible;
}

.kx-wordmark-live {
  display: inline-flex;
  align-items: baseline;
  flex: 0 0 auto;
  min-width: 0;
}

.kx-wordmark-track {
  display: inline-flex;
  align-items: baseline;
  flex: 0 0 auto;
  min-width: 0;
}

.kx-wordmark-char {
  display: none;
  white-space: pre;
}

.kx-wordmark-char.is-visible {
  display: inline-block;
}

.kx-wordmark-caret {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 0.08em;
  height: 0.9em;
  margin-left: var(--kx-type-gap);
  align-self: center;
  pointer-events: none;
  vertical-align: baseline;
}

.kx-wordmark-caret::before {
  content: "";
  position: absolute;
  top: 0.06em;
  right: 0;
  bottom: 0.07em;
  width: 0.08em;
  border-radius: 999px;
  background: var(--kx-yellow);
  box-shadow: 0 0 18px rgba(239, 230, 129, 0.42);
  opacity: 0;
}

.kx-kaise {
  color: var(--kx-cream);
}

.kx-slash {
  padding: 0 0.04em;
  font-weight: 200;
  color: var(--kx-cream);
  transform: translateY(-0.02em);
}

.kx-dox {
  color: var(--kx-blue);
  -webkit-text-stroke: 3px var(--kx-cream);
  text-stroke: 3px var(--kx-cream);
  paint-order: stroke fill;
}

.kx-wordmark.is-typing .kx-wordmark-caret::before {
  opacity: 1;
}

.kx-wordmark.is-complete .kx-wordmark-caret::before {
  opacity: 1;
  animation: kx-caret-blink 0.82s steps(1, end) infinite;
}

@keyframes kx-caret-blink {
  0%,
  48% {
    opacity: 1;
  }
  49%,
  100% {
    opacity: 0;
  }
}

.kx-tagline {
  font-size: clamp(15px, 1.3vw, 18px);
  font-weight: 400;
  color: var(--kx-cream);
  opacity: 0.72;
  letter-spacing: -0.01em;
}

/* Hero footer chrome */
.kx-hero-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-family: var(--kx-font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--kx-cream);
  opacity: 0.7;
  text-transform: uppercase;
}

.kx-scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.kx-scroll-hint:hover {
  opacity: 1;
  transform: translateY(2px);
}

.kx-hero-copyright {
  letter-spacing: 0.16em;
}

/* =========================================================
   Editorial sections (01 / 02 / 03)
   ========================================================= */

.kx-editorial {
  justify-content: flex-start;
  background-color: #a6a6a6;
  background-image: none;
}

.kx-section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--kx-font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--kx-cream);
  text-transform: uppercase;
}

.kx-editorial .kx-section-header,
.kx-about .kx-section-header {
  width: min(100%, 1120px);
  margin: clamp(42px, 6vh, 72px) auto 0;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-bottom: 0;
  border-bottom: 0;
  text-align: center;
}

.kx-editorial .kx-section-header {
  color: #01010b;
}

.kx-editorial .kx-section-number,
.kx-about .kx-section-number {
  font-size: clamp(54px, 6.8vw, 82px);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 0.9;
}

.kx-section-number {
  color: var(--kx-orange);
}

.kx-section-rule {
  display: inline-block;
  width: clamp(56px, 8vw, 96px);
  height: 1px;
  background: rgba(245, 234, 209, 0.4);
}

.kx-editorial .kx-section-rule,
.kx-about .kx-section-rule {
  width: clamp(108px, 13vw, 168px);
}

.kx-editorial .kx-section-rule {
  background: rgba(1, 1, 11, 0.28);
}

.kx-section-label {
  color: var(--kx-cream);
}

.kx-editorial .kx-section-label {
  color: #01010b;
}

.kx-editorial-statement {
  margin: auto 0;
  max-width: 1200px;
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--kx-cream);
}

.kx-editorial .kx-editorial-statement {
  color: #01010b;
  text-wrap: balance;
}

.kx-size-96 {
  font-size: clamp(44px, 7.2vw, 96px);
}

.kx-size-88 {
  font-size: clamp(40px, 6.6vw, 88px);
  max-width: 1080px;
}

.kx-size-82 {
  font-size: clamp(38px, 6.2vw, 82px);
  max-width: 1240px;
  line-height: 1.06;
}

.kx-accent {
  display: inline;
  font-style: italic;
  font-weight: 500;
  color: var(--kx-yellow);
}

/* =========================================================
   About
   ========================================================= */

.kx-about {
  justify-content: flex-start;
}

.kx-editorial .kx-grain {
  opacity: 0.08;
  mix-blend-mode: multiply;
}

.kx-about-body {
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 1200px;
}

.kx-about-heading {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: clamp(40px, 6.5vw, 84px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.kx-about-line {
  display: block;
}

.kx-about-line.kx-accent {
  font-style: italic;
  font-weight: 500;
  color: var(--kx-yellow);
}

.kx-about-prose {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 820px;
  font-size: clamp(17px, 1.55vw, 22px);
  line-height: 1.55;
  color: rgba(245, 234, 209, 0.82);
}

.kx-about-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 12px;
  margin-top: 14px;
  padding-top: 22px;
  border-top: 1px solid rgba(245, 234, 209, 0.22);
  font-size: clamp(16px, 1.35vw, 20px);
  line-height: 1.5;
  color: rgba(245, 234, 209, 0.72);
}

.kx-email-link {
  color: var(--kx-yellow);
  font-style: italic;
  font-weight: 500;
  border-bottom: 1px solid rgba(239, 230, 129, 0.45);
  padding-bottom: 2px;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.kx-email-link:hover {
  color: var(--kx-cream);
  border-color: rgba(245, 234, 209, 0.8);
}

.kx-about-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 22px;
  border-top: 1px solid rgba(245, 234, 209, 0.22);
  font-family: var(--kx-font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--kx-cream);
  opacity: 0.7;
  text-transform: uppercase;
}

/* =========================================================
   Panel-over-panel scroll transition
   Panel transforms are driven by scroll.js (inline styles per frame).
   ========================================================= */

/* =========================================================
   Reduced motion — disable scroll transitions and cursor
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  body {
    cursor: auto;
  }
  .kx-cursor {
    display: none;
  }
  .kx-section {
    animation: none !important;
    transform: none !important;
    transition: none !important;
  }
  .kx-intro-stack.is-animated > .kx-section {
    position: relative;
    top: auto;
  }
  .kx-wordmark-caret::before {
    animation: none !important;
    opacity: 0 !important;
  }
}

/* =========================================================
   Responsive — mobile adjustments
   ========================================================= */

@media (max-width: 720px) {
  :root {
    --kx-pad-x: 20px;
    --kx-pad-y: 24px;
  }

  .kx-top-bar {
    font-size: 11px;
    gap: 12px;
  }

  .kx-wordmark {
    font-size: clamp(64px, 18vw, 110px);
    letter-spacing: -0.04em;
  }

  .kx-editorial .kx-section-header,
  .kx-about .kx-section-header {
    margin-top: clamp(28px, 4vh, 40px);
    gap: 10px;
  }

  .kx-editorial .kx-section-number,
  .kx-about .kx-section-number {
    font-size: clamp(44px, 11vw, 64px);
  }

  .kx-dox {
    -webkit-text-stroke: 2px var(--kx-cream);
    text-stroke: 2px var(--kx-cream);
  }

  .kx-tagline {
    font-size: 15px;
    max-width: 22ch;
  }

  .kx-hero-footer {
    font-size: 10px;
  }

  .kx-editorial-statement {
    letter-spacing: -0.03em;
  }

  .kx-size-96,
  .kx-size-88,
  .kx-size-82 {
    font-size: clamp(36px, 10vw, 64px);
  }

  .kx-about-heading {
    font-size: clamp(36px, 10vw, 64px);
  }

  .kx-about-footer,
  .kx-about-contact {
    font-size: 13px;
  }

  .kx-intro-stack.is-animated > .kx-section {
    position: relative;
    top: auto;
  }
}

/* =========================================================
   404 page specific
   ========================================================= */

.kx-404 {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: var(--kx-pad-y) var(--kx-pad-x);
  background: var(--kx-blue);
  background-image: radial-gradient(
    circle,
    rgba(245, 234, 209, 0.06) 1px,
    transparent 1px
  );
  background-size: 28px 28px;
}

.kx-404-num {
  font-family: var(--kx-font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--kx-orange);
  text-transform: uppercase;
  margin-bottom: 28px;
}

.kx-404-title {
  font-size: clamp(44px, 7vw, 96px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--kx-cream);
  max-width: 16ch;
  margin-bottom: 32px;
}

.kx-404-title em {
  font-style: italic;
  font-weight: 500;
  color: var(--kx-yellow);
}

.kx-404-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--kx-font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--kx-cream);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(245, 234, 209, 0.4);
  padding-bottom: 4px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.kx-404-link:hover {
  color: var(--kx-yellow);
  border-color: rgba(239, 230, 129, 0.7);
}
