/* ==========================================================================
   Shipeace redesign v2 — tokens, reset, typography, layout primitives.

   Temperature rule, enforced: for every neutral, R > G >= B and (G - B) <= 3.
   That keeps the greys warm (plaster, light clay) without sliding into cream.
   The brand blue axis is unchanged; only the neutrals flipped warm.
   ========================================================================== */

:root {
  /* ---- Surfaces ---------------------------------------------------- */
  --surface-white: #ffffff;
  --surface-warm: #f6f1ef;
  --surface-warm-deep: #ede5e2;
  --surface-warm-hover: #fdf9f7;
  --surface-ink: #0b2439;
  --surface-ink-raised: #12324a;

  /* ---- Ink ---------------------------------------------------------- */
  --ink-900: #0b2439;
  --ink-600: #4a4744;
  --ink-400: #665f5a;
  --ink-on-dark: #c9d6df;
  --ink-on-dark-muted: #a9bdcb;

  /* ---- Lines -------------------------------------------------------- */
  --hairline: #e4dbd6;
  --hairline-strong: #d6cac3;
  --border-input: #8e7f77;

  /* ---- Brand -------------------------------------------------------- */
  --brand-500: #0083be; /* graphic only — never text (4.21:1) */
  --brand-700: #026089;
  --brand-800: #01506f;
  --brand-900: #014259;

  /* ---- Warm accent: the human mark ---------------------------------- */
  --warm-500: #c0553c;
  --warm-700: #96432c;
  --warm-100: #f6e3da;

  /* ---- Solution accents: three areas, three pages -------------------- */
  --sol-mail: #c0553c;
  --sol-mail-text: #96432c;
  --sol-mail-tint: #f6e3da;
  /* Tracking lives on the Documents page, so it shares the Documents blue.
     A fourth hue with no page of its own would be an orphan. */
  --sol-docs: #1d5bff;
  --sol-docs-text: #1d5bff;
  --sol-docs-tint: #e7edff;
  --sol-wh: #b4740b;
  --sol-wh-text: #8a5908;
  --sol-wh-tint: #f8edda;

  --disabled-bg: #c9bfb9;
  --disabled-fg: #f6f1ef;

  /* ---- Type --------------------------------------------------------- */
  --font-sans: "IBM Plex Sans", "Noto Sans JP", "Noto Sans SC", system-ui, sans-serif;
  --font-serif: "IBM Plex Serif", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --t-display-1: clamp(2.5rem, 1.55rem + 3.6vw, 4rem);
  --t-display-2: clamp(2rem, 1.5rem + 1.9vw, 2.75rem);
  --t-h3: 1.375rem;
  --t-h4: 1.125rem;
  --t-lead: 1.25rem;
  --t-body: 1.0625rem;
  --t-ui: 0.9375rem;
  --t-eyebrow: 0.8125rem;
  --t-caption: 0.8125rem;

  /* ---- Space -------------------------------------------------------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 40px;
  --s-8: 56px;
  --s-9: 72px;
  --s-10: 96px;
  --s-11: 128px;
  --s-12: 160px;

  --shell-wide: 1240px;
  --shell: 1080px;
  --shell-text: 680px;
  --shell-narrow: 560px;
  --gutter: 24px;

  /* Every section uses this same value. Hierarchy comes from the content
     inside a section, never from one section breathing more than another. */
  --section-y: clamp(88px, 40px + 6.5vw, 160px);

  /* ---- Radius: ~25% of the shortest side, capped at 24 -------------- */
  --r-pill: 999px;
  --r-input: 10px;
  --r-button: 12px;
  --r-card: 16px;
  --r-panel: 20px;
  --r-media: 24px;

  /* ---- Elevation: only two, both warm-brown, never neutral grey ----- */
  --shadow-float: 0 12px 32px -12px rgba(50, 33, 26, 0.18),
    0 2px 6px -2px rgba(50, 33, 26, 0.1);
  --shadow-sticky: 0 1px 0 0 #e4dbd6, 0 8px 24px -16px rgba(50, 33, 26, 0.14);

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-land: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (min-width: 768px) {
  :root { --gutter: 40px; }
}

@media (min-width: 1024px) {
  :root { --gutter: 64px; }
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  background: var(--surface-white);
  color: var(--ink-600);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
p { margin: 0; }

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink-900);
  font-weight: 600;
  text-wrap: balance;
}

h1 {
  font-size: var(--t-display-1);
  line-height: 1.08;
  letter-spacing: -0.022em;
  max-width: 20ch;
}

h2 {
  font-size: var(--t-display-2);
  line-height: 1.14;
  letter-spacing: -0.018em;
}

h3 {
  font-size: var(--t-h3);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h4 {
  font-size: var(--t-h4);
  line-height: 1.4;
}

/* The focus ring is ink, not brand — it stays readable on every surface,
   including on top of the blue button itself. */
:focus-visible {
  outline: 2px solid var(--ink-900);
  outline-offset: 3px;
  border-radius: inherit;
}

/* ==========================================================================
   CJK: the type system has to survive Japanese and Chinese
   ========================================================================== */

html[lang="ja"] {
  --font-sans: "IBM Plex Sans", "Noto Sans JP", system-ui, sans-serif;
}

/* SC must lead for zh — Han unification otherwise renders some characters
   with Japanese shapes, which reads as wrong to a native reader. */
html[lang="zh"] {
  --font-sans: "IBM Plex Sans", "Noto Sans SC", system-ui, sans-serif;
}

:lang(ja),
:lang(zh) {
  letter-spacing: 0;
  font-feature-settings: "palt" 1;
}

:lang(ja) h1, :lang(zh) h1 { line-height: 1.3; letter-spacing: 0; }
:lang(ja) h2, :lang(zh) h2 { line-height: 1.35; letter-spacing: 0; }
:lang(ja) p, :lang(zh) p { line-height: 1.85; }
:lang(ja) { line-break: strict; }

/* No type below 16px in CJK — kanji at 13px is unreadable for a 45-year-old. */
:lang(ja) .t-ui, :lang(zh) .t-ui,
:lang(ja) .t-caption, :lang(zh) .t-caption,
:lang(ja) .eyebrow, :lang(zh) .eyebrow { font-size: 1rem; }
:lang(ja) .eyebrow, :lang(zh) .eyebrow { letter-spacing: 0; }

/* ==========================================================================
   Layout primitives
   ========================================================================== */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.shell--wide { max-width: var(--shell-wide); }
.shell--text { max-width: var(--shell-text); }
.shell--narrow { max-width: var(--shell-narrow); }

.section { padding-block: var(--section-y); }
.section--white { background: var(--surface-white); }
.section--warm { background: var(--surface-warm); }
.section--warm-deep { background: var(--surface-warm-deep); }
.section--ink { background: var(--surface-ink); color: var(--ink-on-dark); }

/* Grain: at 3.5% it is invisible head-on, but the surface stops reading as a
   screen and starts reading as paper. Warm surfaces only — it dirties white
   and muddies navy. */
.grain { position: relative; isolation: isolate; }

.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Type helpers
   ========================================================================== */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-eyebrow);
  font-weight: 500;
  letter-spacing: 0.06em;
  line-height: 1.4;
  color: var(--ink-400);
}

.eyebrow::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--warm-500);
}

/* The only emphasis device allowed above a headline: a clay rule that sits
   outside the words instead of colouring one of them. Tilted a fraction of a
   degree so it reads as drawn rather than generated. */
.rule-clay {
  width: 40px;
  height: 2px;
  background: var(--warm-500);
  border-radius: 1px;
  transform: rotate(-0.4deg);
  margin-bottom: var(--s-5);
}

.rule-clay--sm { width: 24px; }

.lead {
  font-size: var(--t-lead);
  line-height: 1.6;
  color: var(--ink-600);
  max-width: 46ch;
}

.body { max-width: 62ch; }

.t-ui { font-size: var(--t-ui); }
.t-caption { font-size: var(--t-caption); color: var(--ink-400); }

.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-width: 0;
  height: 52px;
  padding-inline: 24px;
  border-radius: var(--r-button);
  font-size: var(--t-body);
  font-weight: 500;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease),
    transform 160ms var(--ease);
}

@media (max-width: 767px) {
  .btn { height: 48px; width: 100%; }
}

.btn__arrow { transition: transform 160ms var(--ease); }

.btn--primary {
  background: var(--brand-700);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

/* Hover does not darken the button — it leans toward clay, so the button
   warms up instead of sinking. */
.btn--primary:hover {
  background: color-mix(in oklab, var(--brand-700) 92%, var(--warm-500));
  transform: translateY(-1px);
}

.btn--primary:hover .btn__arrow { transform: translateX(3px); }
.btn--primary:active { background: var(--brand-900); transform: translateY(0); }

.btn--secondary {
  background: transparent;
  border: 1px solid var(--hairline-strong);
  color: var(--ink-900);
}

.btn--secondary:hover {
  background: var(--surface-white);
  border-color: rgba(192, 85, 60, 0.45);
}

.btn--on-ink {
  background: #fff;
  color: var(--ink-900);
}

.btn--on-ink:hover { background: var(--surface-warm); }

.btn--sm { height: 44px; min-width: 0; padding-inline: 20px; font-size: var(--t-ui); }

.link-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand-700);
  font-size: var(--t-ui);
  font-weight: 500;
}

.link-inline:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ==========================================================================
   Motion floor
   ========================================================================== */

/* Content is never hidden by default — the reveal only exists when motion is
   welcome, so no-JS and reduced-motion visitors get the finished page. */
.anim .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 400ms var(--ease), transform 400ms var(--ease);
}

.anim .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .grain::after { opacity: 0.02; }
}

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