/* DiVinciX — site styles, version 1.2
   Inspired by the three-arc logo: red #E62C13, orange #FF7E20 and blue #2D79F0 around a
   Reuleaux triangle. White background in light mode, black in dark mode (follows the
   visitor's system setting). */

@font-face { font-family: "Sora"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/sora-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/sora-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: italic; font-weight: 400; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }

:root {
  --bg: #FFFFFF;
  --ink: #0A0A0A;
  --ink-2: #4B4B55;
  --rule: #E6E6EA;
  --red: #E62C13;
  --orange: #FF7E20;
  --blue: #2D79F0;
  --link: #1D5BC8;
  --link-hover: #0A0A0A;
  --focus: #2D79F0;
  --button-bg: #0A0A0A;
  --button-ink: #FFFFFF;
  --field-bg: #FFFFFF;
  --field-border: #8A8A94;
  --error: #C2240F;
  --ring: rgba(10, 10, 10, 0.10);
  --cover-shadow: 0 14px 40px rgba(0, 0, 0, 0.12);
  --tri: linear-gradient(90deg, var(--red) 0 33.34%, var(--orange) 33.34% 66.67%, var(--blue) 66.67% 100%);

  --display: "Sora", "Helvetica Neue", Arial, system-ui, sans-serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --ink: #F5F5F5;
    --ink-2: #A9A9B3;
    --rule: #26262B;
    --link: #6AA4FF;
    --link-hover: #FFFFFF;
    --focus: #FF7E20;
    --button-bg: #F5F5F5;
    --button-ink: #000000;
    --field-bg: #0B0B0D;
    --field-border: #6B6B75;
    --error: #FF6A4D;
    --ring: rgba(255, 255, 255, 0.14);
    --cover-shadow: 0 0 0 1px #26262B;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}

.page { min-height: 100vh; overflow-x: hidden; }

a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

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

.wrap { max-width: 1120px; margin: 0 auto; padding-left: 32px; padding-right: 32px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.muted { color: var(--ink-2); }
.strong { color: var(--ink); font-style: italic; }
.x { color: var(--red); }
.nowrap { white-space: nowrap; }
cite { font-style: italic; }

/* The three-color bar, echoing the logo's arcs */
.tri-bar { display: block; width: 96px; height: 4px; border-radius: 2px; background: var(--tri); }

/* Logo mark (inline SVG, colors come from the paths) */
.mark { display: block; flex: none; }

/* Header */
.site-header {
  padding-top: 28px; padding-bottom: 28px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-word { font-family: var(--display); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.brand-word .x { color: inherit; }
.header-right { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.site-nav { display: flex; gap: 26px; font-size: 15px; font-weight: 500; }
.site-nav a { color: var(--ink); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--ink); border-image: var(--tri) 1; }
.site-nav a[aria-current="page"] { border-image: var(--tri) 1; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-2); border: 1px solid var(--rule); padding: 6px 12px; border-radius: 999px;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }

/* Hero: flowing light lines behind the headline.
   Light mode uses a version with the black removed; dark mode uses the original. */
.hero { position: relative; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url("/assets/hero/hero-light.webp?v=1.8.2") 50% 58% / cover no-repeat;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent);
          mask-image: linear-gradient(to bottom, #000 78%, transparent);
}
@media (prefers-color-scheme: dark) {
  .hero::before { background-image: url("/assets/hero/hero-dark.webp?v=1.8.2"); }
}
.hero-copy { position: relative; padding-top: 120px; padding-bottom: 200px; max-width: 1120px; display: flex; flex-direction: column; gap: 28px; }
.hero-copy > * { max-width: 820px; }
.hero h1 { font-size: clamp(34px, 4.3vw, 62px); line-height: 1.06; text-wrap: balance; }
.hero .lede { max-width: 640px; text-wrap: pretty; }
.hero-text { position: relative; z-index: 0; max-width: 820px; display: flex; flex-direction: column; gap: 28px; }
/* Light mode: the left side of the hero is plain white behind the text, so the lines
   only show to the right of the copy. The block's right edge fades out over 160px so the
   lines emerge from behind it instead of being cut off by a hard edge. */
.hero { overflow: hidden; }
.hero-text::before {
  content: ""; position: absolute; z-index: -1;
  top: -600px; bottom: -600px; left: -100vw; right: -200px;
  background: linear-gradient(to right, var(--bg) calc(100% - 160px), transparent);
}
@media (prefers-color-scheme: dark) {
  .hero-text::before { display: none; }
}
h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(40px, 5.8vw, 74px); line-height: 1.04; letter-spacing: -0.03em;
}
.lede { font-size: 20px; color: var(--ink-2); max-width: 560px; }

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 28px;
  background: var(--button-bg); color: var(--button-ink);
  font: 600 16px/1 var(--sans); text-decoration: none;
  border: 0; border-radius: 999px; cursor: pointer;
  transition: box-shadow 0.15s ease;
}
.button:hover { color: var(--button-ink); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--orange); }
.button:disabled { opacity: 0.7; cursor: progress; }
.hero-text .button { align-self: flex-start; margin-top: 4px; }
.hero-copy .tri-bar { max-width: 96px; }

/* Section labels: small three-color bar, then mono caps */
.label {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-weight: 400; font-size: 13px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2);
}
.label::before { content: ""; width: 24px; height: 3px; border-radius: 2px; background: var(--tri); flex: none; }

/* About */
.about { border-top: 1px solid var(--rule); }
.about-grid {
  padding-top: 96px; padding-bottom: 96px;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 64px;
}
.etymology { font-family: var(--display); font-weight: 500; font-size: 19px; letter-spacing: -0.01em; color: var(--ink); }
.dot { color: var(--orange); }

/* Home: research teaser */
.research { border-top: 1px solid var(--rule); }
.research-inner {
  padding-top: 96px; padding-bottom: 96px;
  display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 56px; align-items: center;
}
.research-cover img, .paper-cover {
  display: block; width: 100%; height: auto; border-radius: 4px; box-shadow: var(--cover-shadow);
}

/* Contact and download sections */
.contact { border-top: 1px solid var(--rule); position: relative; }
.contact::before { content: ""; position: absolute; top: -2px; left: 50%; transform: translateX(-50%); width: 96px; height: 4px; border-radius: 2px; background: var(--tri); }
.contact-inner { max-width: 640px; margin: 0 auto; padding: 96px 32px; display: flex; flex-direction: column; gap: 32px; }
.display-1 { font-family: var(--display); font-weight: 600; font-size: clamp(40px, 5.4vw, 68px); line-height: 1.05; letter-spacing: -0.03em; }
.display-2 { font-family: var(--display); font-weight: 600; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.12; letter-spacing: -0.02em; }
.display-3 { font-family: var(--display); font-weight: 600; font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; }

.form { display: flex; flex-direction: column; gap: 22px; }
.interests { margin: 0; padding: 0; border: 0; min-width: 0; }
.interests legend { padding: 0; margin-bottom: 12px; font-size: 15px; font-weight: 500; }
.pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pills input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.pills label {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  font-size: 15px; font-weight: 500; border-radius: 999px; cursor: pointer;
  color: var(--ink); border: 1px solid var(--field-border); background: transparent;
}
.pills input:checked + label { background: var(--button-bg); border-color: var(--button-bg); color: var(--button-ink); font-weight: 600; }
.pills input:focus-visible + label { outline: 2px solid var(--focus); outline-offset: 2px; }

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 18px; align-items: start; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 15px; font-weight: 500; }
.field input {
  font: inherit; min-height: 48px; padding: 0 14px;
  background: var(--field-bg); color: var(--ink);
  border: 1px solid var(--field-border); border-radius: 8px;
}
.field input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.field input[aria-invalid="true"] { border-color: var(--error); }

.checks { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.check { display: flex; align-items: flex-start; gap: 12px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--blue); }
.check label { font-size: 15px; cursor: pointer; }
.optional { font-weight: 400; color: var(--ink-2); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.fineprint { font-size: 14px; color: var(--ink-2); }
.form-status { font-size: 15px; font-weight: 500; color: var(--error); }
.form-status:empty { display: none; }
.form .button { align-self: flex-start; }
.notice { color: var(--ink-2); }

.done { outline: none; }
.button-ghost {
  align-self: flex-start; min-height: 48px; padding: 0 22px;
  font: inherit; font-weight: 500; background: transparent; color: var(--ink);
  border: 1px solid var(--field-border); border-radius: 999px; cursor: pointer;
}

/* Paper picker on the download form: each paper is a selectable row with its cover */
.paper-choice { margin: 0; padding: 0; border: 0; min-width: 0; }
.paper-choice legend { padding: 0; margin-bottom: 12px; font-size: 15px; font-weight: 500; }
.paper-options { display: flex; flex-direction: column; gap: 10px; }
.paper-options input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.paper-option {
  display: grid; grid-template-columns: 56px 1fr 22px; gap: 16px; align-items: center;
  padding: 10px 16px 10px 10px; border: 1px solid var(--field-border); border-radius: 10px; cursor: pointer;
}
.paper-option img { display: block; width: 56px; height: auto; border-radius: 2px; box-shadow: var(--cover-shadow); }
.paper-option-title { display: block; font-weight: 600; line-height: 1.3; }
.paper-option-meta { display: block; font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.paper-option::after {
  content: ""; width: 20px; height: 20px; border-radius: 5px; border: 1.5px solid var(--field-border);
  justify-self: end;
}
.paper-options input:checked + .paper-option { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.paper-options input:checked + .paper-option::after {
  border-color: var(--button-bg); background: var(--button-bg)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3.2L15 7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}
.paper-options input:focus-visible + .paper-option { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  .paper-options input:checked + .paper-option::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3.2L15 7' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}
.research-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 28px; }
.text-link { font-weight: 500; }
.download-list { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }

/* Research page */
.page-intro { padding-top: 72px; padding-bottom: 56px; display: flex; flex-direction: column; gap: 20px; }
.papers { padding-bottom: 96px; display: flex; flex-direction: column; gap: 72px; }
.paper {
  display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 56px; align-items: start;
  padding-top: 56px; border-top: 1px solid var(--rule); scroll-margin-top: 24px;
}
.paper-body { display: flex; flex-direction: column; gap: 16px; max-width: 620px; }
.paper-sub { font-family: var(--display); font-weight: 500; font-size: 19px; letter-spacing: -0.01em; color: var(--ink-2); }
.paper-meta { font-size: 15px; color: var(--ink-2); }
.paper-body .button { align-self: flex-start; margin-top: 8px; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); }
.footer-inner {
  padding-top: 32px; padding-bottom: 32px;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;
  font-size: 14px; color: var(--ink-2);
}
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--ink-2); }
.footer-links a:hover { color: var(--ink); }

/* Simple text pages (privacy, 404, download messages) */
.doc { max-width: 680px; margin: 0 auto; padding: 64px 32px 120px; display: flex; flex-direction: column; gap: 20px; }
.doc h1 { font-size: clamp(36px, 4.6vw, 52px); }
.doc h2 { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; margin-top: 16px; }
.doc p, .doc li { color: var(--ink-2); }
.doc ul { margin: 0; padding-left: 1.2em; }

@media (max-width: 720px) {
  .research-inner, .paper { grid-template-columns: 1fr; gap: 32px; }
  .research-cover, .paper-cover { max-width: 220px; }
}
@media (max-width: 560px) {
  .wrap { padding-left: 20px; padding-right: 20px; }
  .hero-copy { padding-top: 56px; padding-bottom: 120px; }
  .hero::before { background-position: 30% 78%; }
  .about-grid, .contact-inner { padding-top: 72px; padding-bottom: 72px; }
  .contact-inner { padding-left: 20px; padding-right: 20px; }
}

/* Phones, light mode: the text spans the full width, so the white block stops just below
   the button and the lines run in a band underneath it. */
@media (max-width: 560px) and (not (prefers-color-scheme: dark)) {
  .hero-copy { padding-bottom: 240px; }
  .hero::before {
    background-size: 170% auto; background-position: 20% 100%;
    -webkit-mask-image: linear-gradient(to bottom, #000 94%, transparent);
            mask-image: linear-gradient(to bottom, #000 94%, transparent);
  }
  .hero-text::before { top: -40px; bottom: -72px; right: -100vw; background: linear-gradient(to bottom, var(--bg) calc(100% - 48px), transparent); }
}
