/* ==========================================================================
   ETLaban · design system shared by every page
   Warm paper / ink palette, one clay accent, serif display + Geist text.
   ========================================================================== */

@view-transition {
  navigation: auto;
}

:root {
  color-scheme: light;
  --bg: #f7f5f0;
  --panel: #fffefb;
  --panel-soft: #f0ede6;
  --text: #161512;
  --muted: #6b675f;
  --faint: #a19c92;
  --line: rgba(22, 21, 18, 0.09);
  --line-strong: rgba(22, 21, 18, 0.16);
  --brand: #d4572a;
  --brand-soft: rgba(212, 87, 42, 0.1);
  --ink: #161512;
  --on-ink: #f7f5f0;
  --danger: #c2372b;
  --danger-soft: rgba(194, 55, 43, 0.08);
  --success: #2e7d4f;
  --dot: rgba(22, 21, 18, 0.12);
  --shadow-card:
    0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 1px 2px rgba(22, 21, 18, 0.04),
    0 18px 40px -18px rgba(22, 21, 18, 0.18);
  --grain-opacity: 0.045;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --nav-h: 64px;
  --gutter: clamp(20px, 5vw, 40px);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0e;
  --panel: #171715;
  --panel-soft: #1f1f1c;
  --text: #edebe6;
  --muted: #9a968d;
  --faint: #67635c;
  --line: rgba(237, 235, 230, 0.08);
  --line-strong: rgba(237, 235, 230, 0.15);
  --brand: #ef7f4e;
  --brand-soft: rgba(239, 127, 78, 0.13);
  --ink: #edebe6;
  --on-ink: #0f0f0e;
  --danger: #f07a6e;
  --danger-soft: rgba(240, 122, 110, 0.1);
  --success: #7ccf98;
  --dot: rgba(237, 235, 230, 0.09);
  --shadow-card:
    0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 1px 2px rgba(0, 0, 0, 0.3),
    0 24px 48px -20px rgba(0, 0, 0, 0.6);
  --grain-opacity: 0.03;
}

/* --- Base ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

html.is-checking body {
  visibility: hidden;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Film grain: gives the flat paper colour some tooth. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: var(--grain-opacity);
  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='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

svg {
  flex-shrink: 0;
}

::selection {
  background: var(--brand-soft);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Type ---------------------------------------------------------------- */

.display {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.display em {
  font-style: italic;
  color: var(--brand);
  padding-right: 0.04em;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kicker-dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.kicker-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--brand);
  opacity: 0;
  animation: ping 2.8s var(--ease-out) infinite 1.2s;
}

@keyframes ping {
  0% {
    transform: scale(0.4);
    opacity: 0.7;
  }
  70%,
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.lede {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.6;
  text-wrap: pretty;
}

/* --- Buttons ------------------------------------------------------------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.94rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease,
    box-shadow 0.35s var(--ease-out),
    transform 0.35s var(--ease-out);
}

.btn:active {
  transform: scale(0.97);
  transition-duration: 0.1s;
}

.btn-primary {
  background: var(--ink);
  color: var(--on-ink);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 1px 2px rgba(22, 21, 18, 0.14),
    0 8px 20px -10px rgba(22, 21, 18, 0.45);
}

:root[data-theme="dark"] .btn-primary {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 8px 24px -12px rgba(237, 235, 230, 0.35);
}

.btn-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}

.btn-lg {
  min-height: 54px;
  padding: 0 26px;
  font-size: 1rem;
}

.btn-sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.88rem;
}

.btn-block {
  width: 100%;
}

.btn-arrow {
  transition: transform 0.4s var(--ease-spring);
}

@media (hover: hover) {
  .btn-primary:hover {
    background: color-mix(in srgb, var(--ink) 86%, var(--brand));
    transform: translateY(-1px);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.12) inset,
      0 2px 4px rgba(22, 21, 18, 0.12),
      0 14px 28px -12px rgba(22, 21, 18, 0.5);
  }

  :root[data-theme="dark"] .btn-primary:hover {
    background: #ffffff;
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.6) inset,
      0 14px 32px -12px rgba(237, 235, 230, 0.4);
  }

  .btn-ghost:hover {
    border-color: var(--text);
    background: var(--panel);
  }

  .btn:hover .btn-arrow {
    transform: translateX(4px);
  }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.3s var(--ease-out);
}

.icon-btn:active {
  transform: scale(0.9);
}

@media (hover: hover) {
  .icon-btn:hover {
    background: var(--panel-soft);
    color: var(--text);
  }
}

/* Theme toggle: sun and moon trade places with a spin. */
.theme-toggle {
  position: relative;
  view-transition-name: theme-toggle;
}

.theme-toggle svg {
  position: absolute;
  inset: 0;
  margin: auto;
  transition:
    transform 0.6s var(--ease-spring),
    opacity 0.3s ease;
}

.theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.4);
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.4);
}

/* Theme switch reveal (see ui.js). Plain crossfade is turned off so the
   circle clip does the work. */
html.theme-switching::view-transition-old(root),
html.theme-switching::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

html.theme-switching .brand,
html.theme-switching .theme-toggle {
  view-transition-name: none;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
}

/* --- Form fields ----------------------------------------------------------- */

.field {
  display: grid;
  gap: 8px;
}

.field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.field label {
  font-size: 0.86rem;
  font-weight: 500;
}

.input-wrap {
  position: relative;
}

.input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 1rem; /* 16px keeps iOS from zooming in on focus */
  letter-spacing: -0.005em;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.3s var(--ease-out),
    background-color 0.2s ease;
}

.input::placeholder {
  color: var(--faint);
}

.input-wrap .input {
  padding-right: 54px;
}

@media (hover: hover) {
  .input:hover:not(:focus) {
    border-color: color-mix(in srgb, var(--text) 30%, transparent);
  }
}

.input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--text) 8%, transparent);
}

.input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.input:disabled {
  opacity: 0.6;
}

.input:-webkit-autofill,
.input:-webkit-autofill:hover,
.input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow:
    0 0 0 1000px var(--panel) inset,
    0 0 0 4px transparent;
  transition: background-color 9999s 0s;
}

/* --- Brand ---------------------------------------------------------------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  view-transition-name: brand;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line-strong);
  transition: transform 0.5s var(--ease-spring);
}

/* "ET" in the sans, "Laban" in the serif italic, like the logo lockup. */
.wordmark {
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.wordmark em {
  margin-left: 0.03em;
  font-family: var(--font-serif);
  font-size: 1.22em;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

@media (hover: hover) {
  .brand:hover img {
    transform: rotate(-8deg) scale(1.06);
  }
}

/* --- Entrance motion ------------------------------------------------------ */

.rise {
  opacity: 0;
}

html:not(.is-checking) .rise {
  animation: rise 0.9s var(--ease-out) both;
  animation-delay: calc(var(--d, 0) * 80ms + 60ms);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

/* Headline words arrive one by one. */
.display .w {
  display: inline-block;
  opacity: 0;
}

html:not(.is-checking) .display .w {
  animation: word 1s var(--ease-out) both;
  animation-delay: calc(var(--i) * 90ms + 120ms);
}

@keyframes word {
  from {
    opacity: 0;
    transform: translateY(0.35em) rotate(2deg);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

/* Scroll reveal, only when JS is around to trigger it. */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.9s var(--ease-out),
    transform 0.9s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 90ms);
}

html.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* --- Motion preferences -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .kicker-dot::after {
    display: none;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
