/* romainallain.fr
   One reading column beside a sticky rail. Near-white ground, black ink, one green accent.
   Everything derives from the tokens below. Dark mode follows the system setting. */

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/schibsted-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url("fonts/schibsted-grotesk-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #FBFBFA;
  --surface: #F3F3F1;
  --ink: #151515;
  --ink-2: #63635E;
  --line: #E4E4E0;
  --accent: #146B3E;
  --accent-ink: #FFFFFF;
  --spark: #C8F25A;
  --dot: rgba(21, 21, 21, 0.10);
  --dot-hot: rgba(20, 107, 62, 0.6);
  --font: "Schibsted Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --gutter: clamp(16px, 5vw, 48px);
  --rail: 17rem;
  --measure: 40rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121313;
    --surface: #1B1C1B;
    --ink: #EDEEEA;
    --ink-2: #A3A49E;
    --line: #2A2B29;
    --accent: #8FD9A8;
    --accent-ink: #0B2516;
    --dot: rgba(237, 238, 234, 0.09);
    --dot-hot: rgba(200, 242, 90, 0.65);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: var(--line) var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent); transition: text-decoration-color .15s ease-out, color .15s ease-out; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
p, dl, dd, figure { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; text-wrap: balance; }
strong, b { font-weight: 500; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; }
.num { font-variant-numeric: tabular-nums; }
.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; }
.skip { position: absolute; left: var(--gutter); top: -3rem; z-index: 20; background: var(--ink); color: var(--bg); padding: 0.5rem 0.75rem; text-decoration: none; border-radius: 2px; }
.skip:focus { top: 0.75rem; }
.skip:hover { color: var(--bg); }

/* Layout */
.page { max-width: 76rem; margin-inline: auto; padding: 0 var(--gutter); display: grid; grid-template-columns: 1fr; gap: 0 4rem; }
@media (min-width: 900px) { .page { grid-template-columns: var(--rail) minmax(0, var(--measure)); } }

/* Rail */
.rail { padding-block: clamp(2rem, 5vw, 3.5rem) 1.5rem; display: grid; gap: 1.5rem; align-content: start; border-bottom: 1px solid var(--line); }
@media (min-width: 900px) {
  .rail { position: sticky; top: 0; height: 100vh; height: 100dvh; padding-block: 3.5rem 2rem; border-bottom: 0; gap: 2rem; overflow: auto; }
}
.portrait { width: 88px; height: 88px; border-radius: 4px; object-fit: cover; margin-bottom: 1.1rem; }
.name { font-size: 1.75rem; line-height: 1.05; font-weight: 500; letter-spacing: -0.022em; text-decoration: none; display: inline-block; }
.name:hover { color: var(--ink); }
.role { color: var(--ink-2); font-size: 0.9375rem; line-height: 1.45; margin-top: 0.5rem; }
.index { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; }
@media (min-width: 900px) { .index { display: grid; gap: 0.35rem; } }
.index a { text-decoration: none; color: var(--ink-2); font-size: 0.9375rem; display: inline-flex; align-items: center; gap: 0.6rem; padding-block: 0.1rem; }
.index a::before { content: ""; display: none; width: 1.25rem; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left center; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.index a:hover { color: var(--ink); }
.index a[aria-current="true"] { color: var(--ink); }
@media (min-width: 900px) { .index a::before { display: block; } .index a[aria-current="true"]::before { transform: scaleX(1); } }
.rail-contact { display: grid; gap: 0.3rem; font-size: 0.9375rem; }
.rail-contact .mail { font-weight: 500; }
.rail-contact .where { color: var(--ink-2); }
.status { font-size: 0.9375rem; color: var(--ink); font-weight: 500; }

/* Main */
main { min-width: 0; }
section { padding-block: clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--line); scroll-margin-top: 1rem; }
section:first-of-type { border-top: 0; padding-top: clamp(2.5rem, 5vw, 3.5rem); }
@media (min-width: 900px) { section:first-of-type { padding-top: 3.5rem; } }
h2 { font-size: clamp(1.625rem, 1.2rem + 1.4vw, 2rem); line-height: 1.15; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1.5rem; margin-bottom: 1.75rem; }
.meta { color: var(--ink-2); font-size: 0.9375rem; }

.hero h1 { font-size: clamp(2.125rem, 1.3rem + 3.4vw, 3.375rem); line-height: 1.06; max-width: 20ch; }
.lede { margin-top: 1.75rem; max-width: 60ch; font-size: 1.125rem; }
.lede + .lede { margin-top: 1rem; }
.write { margin-top: 2rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; }
.write span { color: var(--ink-2); font-size: 0.9375rem; }
.write span a { color: var(--ink); }

.traits { list-style: none; margin: 3.25rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.trait { padding: 1rem 0 1.1rem; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr; gap: 0.25rem 2rem; align-items: baseline; }
@media (min-width: 640px) { .trait { grid-template-columns: 10rem 1fr; } }
.trait b { font-size: 1.125rem; line-height: 1.35; font-weight: 500; letter-spacing: -0.01em; }
.trait div { display: grid; gap: 0.15rem; }
.trait .sub { font-weight: 500; font-size: 0.9375rem; line-height: 1.5; }
.trait p { color: var(--ink-2); font-size: 0.9375rem; line-height: 1.5; }

.work { list-style: none; margin: 0; padding: 0; display: grid; gap: 3rem; }
.tile { position: relative; aspect-ratio: 16 / 10; max-width: 100%; background: var(--surface); border: 1px solid var(--line); overflow: hidden; transition: border-color .15s ease-out; }
.work li:hover .tile { border-color: var(--ink-2); }
.tile svg, .tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .ph { position: absolute; left: 12px; top: 12px; font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); padding: 0.15rem 0.45rem; }
.work figcaption { margin-top: 1rem; display: grid; grid-template-columns: 1fr; gap: 0.25rem 2rem; }
@media (min-width: 560px) { .work figcaption { grid-template-columns: 11rem 1fr; } }
.work figcaption b { font-weight: 500; font-size: 0.9375rem; line-height: 1.5; }
.work figcaption b small { display: block; font-weight: 400; color: var(--ink-2); font-size: 0.875rem; }
.work figcaption span { color: var(--ink-2); font-size: 0.9375rem; line-height: 1.5; }

.btn {
  display: inline-flex; align-items: center; gap: 0.55rem; cursor: pointer; text-decoration: none;
  font-size: 0.9375rem; font-weight: 500; line-height: 1;
  padding: 0.85rem 1.2rem; border: 1px solid var(--ink); background: var(--ink); color: var(--bg); border-radius: 2px;
  transition: background-color .15s ease-out, color .15s ease-out, border-color .15s ease-out;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: transparent; color: var(--ink); }
.btn svg { width: 16px; height: 16px; flex: none; }
.cv-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.75rem; }
.cv-pages { display: grid; gap: 1.5rem; }
.cv-pages img { width: 100%; border: 1px solid var(--line); background: #fff; }

.side { display: grid; gap: 0.5rem; max-width: 56ch; }
.side .who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
.side .who b { font-size: 1.125rem; }
.side .who span { color: var(--ink-2); font-size: 0.9375rem; }
.side p { color: var(--ink-2); }
.side a.more { width: max-content; font-size: 0.9375rem; }

/* Form */
form { display: grid; gap: 1.25rem; max-width: 34rem; margin-top: 2rem; }
.row { display: grid; gap: 1.25rem; }
@media (min-width: 560px) { .row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 0.4rem; font-size: 0.9375rem; font-weight: 500; }
.field small { font-weight: 400; color: var(--ink-2); }
input:not([type="checkbox"]), textarea {
  font: inherit; color: var(--ink); background: transparent;
  border: 0; border-bottom: 1px solid var(--ink-2); border-radius: 0; padding: 0.6rem 0; width: 100%; min-width: 0;
  caret-color: var(--accent); transition: border-color .15s ease-out;
}
input::placeholder, textarea::placeholder { color: var(--ink-2); opacity: 0.8; font-weight: 300; }
input:hover, textarea:hover { border-color: var(--ink); }
input:focus-visible, textarea:focus-visible { outline: 0; border-bottom-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
textarea { min-height: 6.5rem; resize: vertical; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.err { color: #B3261E; font-size: 0.875rem; display: none; font-weight: 400; }
@media (prefers-color-scheme: dark) { .err { color: #FFB4AB; } }
.field.invalid input { border-bottom-color: #B3261E; }
.field.invalid .err { display: block; }
.privacy { font-size: 0.875rem; color: var(--ink-2); max-width: 52ch; }
.sent, .fail { display: none; padding: 1.25rem 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); max-width: 34rem; margin-top: 2rem; }
.sent b, .fail b { font-size: 1.25rem; display: block; margin-bottom: 0.35rem; }
.sent:target, form[data-state="sent"] + .sent { display: block; }
form[data-state="sent"], form[data-state="failed"] { display: none; }
form[data-state="failed"] ~ .fail { display: block; }

/* Footer */
footer { grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 2.5rem 0 4rem; font-size: 0.875rem; color: var(--ink-2); display: grid; gap: 1.25rem; }
@media (min-width: 900px) { footer { grid-column: 2; } }
footer p { max-width: 60ch; }
footer .links { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; }
footer h3 { font-size: 0.875rem; font-weight: 500; color: var(--ink); margin-bottom: 0.35rem; }
.md-btn { display: none; align-items: center; gap: 0.45rem; cursor: pointer; background: transparent; border: 1px solid var(--line); color: var(--ink-2); padding: 0.4rem 0.7rem; border-radius: 2px; font-size: 0.8125rem; transition: color .15s ease-out, border-color .15s ease-out; }
.md-btn:hover { color: var(--ink); border-color: var(--ink-2); }
.md-btn svg { width: 14px; height: 14px; }
html.twist-markdown .md-btn { display: inline-flex; }

/* Twist: dot grid ground */
html.twist-dots body { position: relative; }
html.twist-dots body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--dot) 0.6px, transparent 1.1px);
  background-size: 16px 16px; background-position: 8px 8px;
}
/* Twist: cursor spotlight on the dot grid, inside the rail only (fine pointers, desktop layout) */
@media (pointer: fine) and (min-width: 900px) {
  html.twist-dots.twist-spotlight .rail::before {
    content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background-image: radial-gradient(var(--dot-hot) 0.8px, transparent 1.3px);
    background-size: 16px 16px; background-position: 8px 8px; background-attachment: fixed;
    -webkit-mask-image: radial-gradient(200px circle at var(--mx, -1000px) var(--my, -1000px), #000 0%, transparent 70%);
    mask-image: radial-gradient(200px circle at var(--mx, -1000px) var(--my, -1000px), #000 0%, transparent 70%);
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
@media print {
  .rail nav, .md-btn, form, .skip { display: none !important; }
  .page { display: block; }
  section { break-inside: avoid; }
}
