/* ===========================================================
 * Everweal · Editorial × Tech
 * Aesthetic direction: financial broadsheet meets AI-native manifesto
 * Palette: warm ivory paper, deep ink, single FT-red accent
 * Type: Fraunces (variable serif) + JetBrains Mono + system CJK serif
 * =========================================================== */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces/files/fraunces-latin-wght-normal.woff2")
    format("woff2-variations");
}

@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource-variable/fraunces/files/fraunces-latin-wght-italic.woff2")
    format("woff2-variations");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource/jetbrains-mono/files/jetbrains-mono-latin-400-normal.woff2")
    format("woff2");
}

:root {
  /* paper / ink */
  --paper: #f4efe6;
  --paper-soft: #ede5d6;
  --ink: #0f0e0c;
  --ink-mid: #46423b;
  --ink-soft: #6f6a60;
  --ink-faint: #95907f;
  /* sharp accent — single red, no gradients */
  --red: #c8102e;
  --red-deep: #a30e27;
  /* hairlines */
  --rule: rgba(15, 14, 12, 0.22);
  --rule-soft: rgba(15, 14, 12, 0.10);
  /* layout */
  --gutter: clamp(20px, 4.2vw, 60px);
  /* type stacks — Fraunces leads, deep CJK serif fallback for chinese */
  --serif:
    "Fraunces", "Times New Roman", "New York", "Iowan Old Style",
    "Songti SC", "STSong", "Source Han Serif CN", "Noto Serif CJK SC",
    "SimSun", serif;
  --mono:
    "JetBrains Mono", ui-monospace, "SFMono-Regular", "SF Mono",
    "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

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

body {
  position: relative;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "kern", "liga", "calt", "ss01" on;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

/* ---- atmospheric layers ---------------------------------- */

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.07;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='280' height='280'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.65 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 280px 280px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(
      1100px 700px at 92% -8%,
      rgba(200, 16, 46, 0.06),
      transparent 60%
    ),
    radial-gradient(
      900px 600px at -8% 110%,
      rgba(15, 14, 12, 0.05),
      transparent 60%
    );
}

/* ---- masthead -------------------------------------------- */

.masthead,
.colophon,
.hero,
.things,
.belief {
  position: relative;
  z-index: 1;
}

.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 22px var(--gutter);
}

.m-left {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
}

.mark {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: var(--red);
  flex: 0 0 auto;
}

.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.005em;
  font-feature-settings: "ss01" on, "ss03" on;
  font-variant: small-caps;
  text-transform: lowercase;
}

.m-mid {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mid);
  white-space: nowrap;
}

.m-sep {
  font-style: normal;
  color: var(--ink-faint);
}

.m-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

.lang-toggle {
  background: transparent;
  border: 0;
  padding: 4px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  transition:
    color 200ms ease,
    border-color 200ms ease,
    transform 200ms ease;
}

.lang-toggle:hover {
  color: var(--red);
  border-color: var(--red);
}

.lang-toggle:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

/* ---- rules ----------------------------------------------- */

.rule {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 0 var(--gutter);
}

.rule-bold {
  height: 2px;
  background: var(--ink);
}

/* ---- hero ------------------------------------------------ */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 72px);
  align-items: end;
  padding: clamp(48px, 8vw, 110px) var(--gutter) clamp(40px, 6vw, 80px);
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(58px, 11.8vw, 208px);
  line-height: 0.92;
  letter-spacing: -0.035em;
  color: var(--ink);
  font-feature-settings: "ss01" on, "ss03" on, "lnum" on;
}

.title-line {
  display: block;
  opacity: 0;
  transform: translateY(28px);
  animation: line-rise 950ms cubic-bezier(0.18, 0.7, 0.12, 1) forwards;
}

.title-line-1 {
  animation-delay: 60ms;
}

.title-line-2 {
  animation-delay: 160ms;
}

.title-line-3 {
  animation-delay: 260ms;
  padding-left: clamp(40px, 9vw, 168px);
}

.t-em {
  font-style: italic;
  font-weight: 500;
  font-feature-settings: "ss01" on, "ss03" on, "swsh" on;
}

.t-period {
  display: inline-block;
  color: var(--red);
  font-style: normal;
  font-weight: 700;
  margin-left: 0.04em;
  transform: translateY(0.02em);
}

@keyframes line-rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lead-aside {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 460px;
  padding-bottom: clamp(8px, 1.4vw, 18px);
  opacity: 0;
  animation: fade-rise 700ms ease-out 480ms forwards;
}

.lead-mark {
  flex: 0 0 auto;
  font-family: var(--serif);
  font-size: 36px;
  line-height: 0.78;
  font-weight: 400;
  color: var(--red);
  transform: translateY(2px);
}

.lead {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(15.5px, 1.18vw, 18.5px);
  line-height: 1.66;
  color: var(--ink-mid);
  font-weight: 400;
}

@keyframes fade-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- things (numbered editorial columns) ----------------- */

.things {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: clamp(48px, 7vw, 96px) var(--gutter);
  opacity: 0;
  animation: fade-rise 700ms ease-out 600ms forwards;
}

.thing {
  padding: 0 clamp(20px, 3vw, 56px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  position: relative;
}

.thing:first-child {
  padding-left: 0;
}

.thing:last-child {
  padding-right: 0;
}

.thing + .thing {
  border-left: 1px solid var(--rule);
}

.thing-num {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(48px, 6vw, 96px);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: clamp(6px, 0.5vw, 14px);
  transition: color 280ms ease;
}

.num-glyph {
  font-style: italic;
  font-weight: 400;
  font-size: 0.62em;
  color: var(--ink-mid);
  transform: translateY(-0.18em);
  display: inline-block;
}

.num-digits {
  font-feature-settings: "lnum" on, "ss03" on;
}

.thing:hover .thing-num,
.thing:focus-within .thing-num {
  color: var(--red);
}

.thing-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 500;
}

.thing-text {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(16px, 1.3vw, 19px);
  line-height: 1.6;
  color: var(--ink);
  max-width: 38ch;
}

/* ---- belief / pull-quote -------------------------------- */

.belief {
  padding: clamp(56px, 8vw, 110px) var(--gutter) clamp(48px, 7vw, 90px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  opacity: 0;
  animation: fade-rise 700ms ease-out 720ms forwards;
}

.belief-quote {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(28px, 4vw, 56px);
  line-height: 1.22;
  letter-spacing: -0.018em;
  color: var(--ink);
  max-width: 22ch;
  position: relative;
}

.belief-quote::before {
  content: "\201C";
  font-family: var(--serif);
  font-style: normal;
  font-weight: 600;
  color: var(--red);
  margin-right: 0.08em;
}

.belief-quote::after {
  content: "\201D";
  font-family: var(--serif);
  font-style: normal;
  font-weight: 600;
  color: var(--red);
  margin-left: 0.04em;
}

.belief-attr {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---- colophon (footer) ---------------------------------- */

.colophon {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 22px var(--gutter) 28px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.cl-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.cl-link {
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1px;
  transition:
    color 200ms ease,
    border-color 200ms ease;
}

.cl-link:hover {
  color: var(--red);
  border-color: var(--red);
}

.cl-link:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

.dot {
  font-style: normal;
  color: var(--ink-faint);
}

.cl-mid {
  text-align: center;
  letter-spacing: 0.42em;
  color: var(--ink-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cl-right {
  display: inline-flex;
  justify-content: flex-end;
  white-space: nowrap;
}

/* ---- responsive ----------------------------------------- */

@media (max-width: 960px) {
  .m-mid {
    display: none;
  }

  .masthead {
    grid-template-columns: 1fr auto;
  }

  .hero {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 28px;
  }

  .title-line-3 {
    padding-left: clamp(28px, 8vw, 100px);
  }

  .lead-aside {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .masthead {
    padding: 18px var(--gutter);
  }

  .hero {
    padding: clamp(36px, 8vw, 72px) var(--gutter) clamp(36px, 8vw, 60px);
  }

  .title {
    font-size: clamp(56px, 16vw, 120px);
  }

  .title-line-3 {
    padding-left: 0;
  }

  .things {
    grid-template-columns: 1fr;
    padding: clamp(40px, 8vw, 64px) var(--gutter);
  }

  .thing {
    padding: 0;
  }

  .thing + .thing {
    border-left: none;
    border-top: 1px solid var(--rule);
    padding-top: 36px;
    margin-top: 36px;
  }

  .colophon {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 12px;
    padding: 24px var(--gutter) 28px;
  }

  .cl-left {
    justify-content: center;
  }

  .cl-mid {
    letter-spacing: 0.32em;
    font-size: 10.5px;
  }

  .cl-right {
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .brand {
    font-size: 16px;
  }

  .belief-quote {
    font-size: clamp(24px, 7.5vw, 34px);
    max-width: 18ch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .title-line,
  .lead-aside,
  .things,
  .belief {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* ---- print ---------------------------------------------- */

@media print {
  .grain,
  body::before {
    display: none;
  }

  .lang-toggle {
    display: none;
  }

  body {
    background: white;
  }
}
