/* =========================================================================
   Thomas Toulgoet: site theme
   Built on the mark: a T and an upside-down T locked into an exact square.
   Language: geometric, symmetrical, precise. Ink monochrome on warm off-white;
   contrast comes from scale, weight and inverted ink blocks, not colour.
   See CLAUDE.md → Brand.
   ========================================================================= */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ink: #111111;
  --ink-2: #3a3936;          /* secondary text */
  --muted: #6b6a66;
  --line: #e2e0d9;
  --bg: #fbfaf7;             /* warm off-white */
  --surface: #f3f2ee;
  --on-ink: #fbfaf7;         /* text on inverted ink blocks */
  --accent: var(--ink);
  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --track-display: -0.035em;
  --track-tight: -0.015em;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #f2f2f0; --ink-2: #c9c8c3; --muted: #9a9993; --line: #2b2c2f; --bg: #111214; --surface: #18191c; --on-ink: #111214; }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
::selection { background: var(--ink); color: var(--on-ink); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.idx { font-family: var(--mono); font-size: .72rem; letter-spacing: .02em; color: var(--muted); font-variant-numeric: tabular-nums; }
.label, h2 { font-size: .72rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

/* ---------- buttons: sharp, solid, with a moving arrow ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .7rem;
  padding: .85rem 1.15rem;
  font: 600 .88rem/1 var(--font); letter-spacing: .01em;
  color: var(--on-ink); background: var(--ink);
  border: 1px solid var(--ink); border-radius: 0;
  text-decoration: none; white-space: nowrap;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.btn .arr { display: inline-block; transition: transform .25s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }
.btn:hover { background: transparent; color: var(--ink); }
.btn-sm { padding: .55rem .8rem; font-size: .78rem; }
.btn-invert { background: var(--on-ink); color: var(--ink); border-color: var(--on-ink); }
.btn-invert:hover { background: transparent; color: var(--on-ink); }
.btn-ghost-invert { background: transparent; color: var(--on-ink); border-color: color-mix(in srgb, var(--on-ink) 45%, transparent); }
.btn-ghost-invert:hover { border-color: var(--on-ink); color: var(--on-ink); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--ink); text-decoration: none; }
.brand .logo { width: 30px; height: 30px; display: block; flex: none; }
/* stacked wordmark: two lines, exactly the height of the mark (like the T over the upside-down T) */
.wordmark { display: flex; flex-direction: column; justify-content: space-between; height: 30px; font-weight: 600; font-size: .72rem; line-height: 1; letter-spacing: .16em; text-transform: uppercase; }
.wordmark span { display: block; }
.site-header nav { display: flex; align-items: center; gap: 1.6rem; }
.site-header nav a:not(.btn) { color: var(--ink-2); text-decoration: none; font-size: .86rem; font-weight: 500; position: relative; }
.site-header nav a:not(.btn)::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform .25s var(--ease); }
.site-header nav a:not(.btn):hover { color: var(--ink); }
.site-header nav a:not(.btn):hover::after { transform: scaleX(1); }
@media (max-width: 40rem) {
  .site-header nav { gap: 1rem; }
  .site-header nav .btn { display: none; }
  .site-header nav a:not(.btn) { font-size: .82rem; }
}

/* ---------- section scaffolding ---------- */
main > section { scroll-margin-top: 5.5rem; }
.sec-head { display: flex; align-items: center; gap: .9rem; margin: 0 0 2rem; }
.sec-head h2 { margin: 0; color: var(--ink); }
.sec-head .rule { flex: 1; height: 1px; background: var(--line); }

/* ---------- hero: tagline over a bird's-eye view of a crowd crossing ---------- */
.hero { position: relative; display: grid; align-content: start; min-height: clamp(420px, 66vh, 660px); padding-top: clamp(3rem, 7vw, 5.5rem); padding-bottom: clamp(2rem, 5vw, 3.5rem); }
.hero > :not(canvas) { position: relative; z-index: 1; }
.display { margin: 0; max-width: 24ch; font-size: clamp(1.5rem, 2.9vw, 2.25rem); line-height: 1.22; font-weight: 500; letter-spacing: -0.02em; }
/* the street runs edge to edge across the screen; the readout below it stays on the content column */
.has-crowd .crowd { position: absolute; top: 0; bottom: 0; left: 50%; width: 100vw; transform: translateX(-50%); height: 100%; display: block; z-index: 0; }   /* the street runs the full width of the screen */
@media (max-width: 40rem) { .hero { min-height: clamp(360px, 70vh, 520px); } }

.has-crowd { overflow: visible; }
body { overflow-x: hidden; }

/* ---------- three topics: each half of the mark, then the whole mark (the two together) ---------- */
.topics-band { padding-bottom: clamp(4rem, 8vw, 6.5rem); }
.topics-band .label { margin: 0 0 1rem; text-transform: none; letter-spacing: 0; font-size: .95rem; font-weight: 500; color: var(--muted); }
.topics { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.topics li { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 1.1rem; row-gap: .35rem; align-items: center; padding: 1.6rem 1.5rem 1.7rem 0; }
.topics li + li { border-left: 1px solid var(--line); padding-left: 1.5rem; }
.topics .glyph { grid-row: 1 / 3; width: 2.6rem; height: 2.6rem; }
.topics .glyph path { fill: var(--ink); }
.topics .glyph path.ghost { fill: none; stroke: var(--ink); stroke-width: 1.5; opacity: .3; }
.topics .topic { font-size: clamp(1.1rem, 1.9vw, 1.4rem); font-weight: 600; letter-spacing: var(--track-tight); line-height: 1.2; }
@media (max-width: 40rem) {
  .topics { grid-template-columns: 1fr; }
  .topics li + li { border-left: none; border-top: 1px solid var(--line); padding-left: 0; }
}

/* ---------- research ---------- */
.research { padding-bottom: clamp(4rem, 8vw, 6.5rem); }
.controls { display: flex; align-items: center; gap: .6rem; }
.controls button {
  width: 2.4rem; height: 2.4rem; display: grid; place-items: center;
  font: 500 .95rem/1 var(--font); color: var(--ink); cursor: pointer;
  background: transparent; border: 1px solid var(--line); border-radius: 0;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.controls button:hover { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.controls .count { font-family: var(--mono); font-size: .78rem; min-width: 4.2rem; text-align: center; font-variant-numeric: tabular-nums; }
.track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border: 1px solid var(--line); }
.track::-webkit-scrollbar { display: none; }
.track:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.slide {
  flex: 0 0 100%; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: flex-start;
  min-height: 21rem; padding: clamp(1.6rem, 4vw, 3rem);
  background: var(--bg);
}
.slide .meta { margin: 0 0 1.25rem; font-family: var(--mono); font-size: .74rem; color: var(--muted); letter-spacing: .02em; }
.slide h3 { margin: 0 0 .7rem; max-width: 22ch; font-size: clamp(1.6rem, 3.6vw, 2.5rem); line-height: 1.08; font-weight: 600; letter-spacing: -0.025em; }
.slide .authors { margin: 0 0 1rem; color: var(--muted); }
.slide .summary { margin: 0 0 2rem; max-width: 52ch; color: var(--ink-2); font-size: 1.05rem; }
.slide .btn { margin-top: auto; }
.slide.featured { background: var(--ink); color: var(--on-ink); }
.slide.featured .meta { color: color-mix(in srgb, var(--on-ink) 65%, transparent); }
.slide.featured .authors, .slide.featured .summary { color: color-mix(in srgb, var(--on-ink) 78%, transparent); }

/* ---------- notes ---------- */
.notes { padding-bottom: clamp(4rem, 8vw, 6.5rem); }
.note { display: grid; grid-template-columns: 9rem 1fr auto; gap: 1.5rem; align-items: baseline; padding: 1.6rem 0; border-top: 1px solid var(--line); }
.note:last-of-type { border-bottom: 1px solid var(--line); }
.note .meta { margin: 0; font-family: var(--mono); font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.note h3 { margin: 0 0 .35rem; font-size: 1.3rem; font-weight: 600; letter-spacing: var(--track-tight); line-height: 1.25; }
.note p { margin: 0; color: var(--ink-2); max-width: 60ch; }
.note .arr { color: var(--muted); transition: transform .25s var(--ease), color .2s; }
.note:hover .arr { transform: translateX(4px); color: var(--ink); }
@media (max-width: 40rem) { .note { grid-template-columns: 1fr auto; } .note .meta { grid-column: 1 / -1; } }

/* ---------- watchlist: one row per company (index · name/details · why) ---------- */
.watchlist { padding-bottom: clamp(4rem, 8vw, 6.5rem); }
.watch-intro { margin: 0 0 2rem; max-width: 58ch; color: var(--ink-2); font-size: 1.05rem; line-height: 1.55; }
.co { display: grid; grid-template-columns: 3rem minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem 2.5rem; align-items: baseline; padding: 1.6rem 0; border-top: 1px solid var(--line); }
.co:last-of-type { border-bottom: 1px solid var(--line); }
.co-idx { margin: 0; font-family: var(--mono); font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.co h3 { margin: 0 0 .25rem; font-size: 1.3rem; font-weight: 600; letter-spacing: var(--track-tight); line-height: 1.25; }
.co-meta { margin: 0 0 .5rem; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.co-what { margin: 0; color: var(--ink-2); max-width: 46ch; }
.co-why { margin: 0; color: var(--ink); max-width: 46ch; line-height: 1.5; }
.co-label { display: block; margin-bottom: .35rem; font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.watch-note { margin: 1.2rem 0 0; font-size: .78rem; color: var(--muted); }
@media (max-width: 50rem) { .co { grid-template-columns: 2.5rem minmax(0, 1fr); } .co-why { grid-column: 2; } }

/* ---------- about ---------- */
.about { padding-bottom: clamp(4rem, 8vw, 6.5rem); }
/* the About band now holds a single quote Thomas likes (Brian Tracy) */
.quote { margin: 0; max-width: 40ch; }
.quote blockquote { margin: 0; position: relative; }
.quote blockquote p { margin: 0; font-size: clamp(1.4rem, 2.8vw, 2rem); line-height: 1.32; letter-spacing: var(--track-tight); font-weight: 500; text-wrap: balance; }
.quote blockquote p::before { content: "\201C"; position: absolute; left: -.55em; color: var(--muted); }
.quote blockquote p::after { content: "\201D"; }
.quote figcaption { margin-top: 1.4rem; display: flex; align-items: center; gap: .8rem; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.quote figcaption::before { content: ""; width: 2rem; height: 1px; background: currentColor; }
@media (max-width: 40rem) { .quote blockquote p::before { position: static; } }

/* ---------- contact: inverted ink band ---------- */
.contact { background: var(--ink); color: var(--on-ink); padding: clamp(3.5rem, 8vw, 6rem) 0; }
.sec-head.invert h2 { color: var(--on-ink); }
.sec-head.invert .idx { color: color-mix(in srgb, var(--on-ink) 55%, transparent); }
.sec-head.invert .rule { background: color-mix(in srgb, var(--on-ink) 22%, transparent); }
.contact-links { display: flex; flex-wrap: wrap; gap: .8rem; margin: 0; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.foot { display: flex; align-items: center; gap: .6rem; height: 4rem; font-size: .72rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.foot .sp { flex: 1; }
.foot .idx { letter-spacing: .02em; text-transform: none; font-weight: 400; }

/* ---------- quiet colour: pale tints that carry meaning (topics), plus rhythm and a highlighter ----------
   Sage = Growth investing · Lilac = Psychology and behaviour · Sand = About band · Butter = hover/selection.
   The mark, type, buttons and rules stay ink. */
:root {
  --sage-bg: #e4ebe3;  --sage-ink: #3f5a46;
  --lilac-bg: #e9e6f2; --lilac-ink: #4d4772;
  --sand: #f2ede3;
  --butter: #f5eec8;
  --sky-bg: #e2eaf0;   --sky-ink: #3d5566;      /* third topic: What the future could look like */
  --sage-mid: #a8c0ac; --lilac-mid: #b8b0d6;   /* stronger pastels for thin lines */
}
@media (prefers-color-scheme: dark) {
  :root { --sage-bg: #1f2a22; --sage-ink: #a9c4ae; --lilac-bg: #25222f; --lilac-ink: #c3bce0; --sky-bg: #1e252b; --sky-ink: #a9bfcf; --sand: #18171a; --butter: #4a4320; --sage-mid: #7f9c86; --lilac-mid: #948bba; }
}
::selection { background: var(--butter); color: var(--ink); }

/* every research piece blends both topics: a thin sage | lilac stripe along the top of each card */
.slide { position: relative; }
.slide::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--sage-mid) 0 50%, var(--lilac-mid) 50% 100%); }

/* hero topics: each half of the mark sits on its topic's tint; the column washes on hover */
.topics li { padding-left: 1rem; padding-right: 1rem; transition: background .3s var(--ease); }
.topics li + li { padding-left: 1.5rem; }
@media (max-width: 40rem) { .topics li + li { padding-left: 1rem; } }
.topics .glyph { width: 3.3rem; height: 3.3rem; padding: .55rem; }
.topics .t-growth .glyph { background: var(--sage-bg); }
.topics .t-psych .glyph { background: var(--lilac-bg); }
.topics .t-future .glyph { background: var(--sky-bg); }
.topics .t-growth .idx { color: var(--sage-ink); }
.topics .t-psych .idx { color: var(--lilac-ink); }
.topics .t-future .idx { color: var(--sky-ink); }
.topics .t-growth:hover { background: color-mix(in srgb, var(--sage-bg) 45%, transparent); }
.topics .t-psych:hover { background: color-mix(in srgb, var(--lilac-bg) 45%, transparent); }
.topics .t-future:hover { background: color-mix(in srgb, var(--sky-bg) 45%, transparent); }

/* About sits on a full-width band of warm sand, for rhythm: off-white → sand → off-white → ink */
.about.band-sand { background: var(--sand); padding: clamp(4rem, 8vw, 6.5rem) 0; }

/* highlighter on hover for text links and note titles */
a:not(.btn):hover, .note:hover h3 { background: linear-gradient(transparent 58%, var(--butter) 58%); }
.site-header nav a:not(.btn):hover { background: none; }

/* compare: everything above switched off */

/* ---------- clocks in the sticky header (clock.js): Pacific + Eastern, T-shaped hands — a play on the mark ---------- */
.hdr { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 4.75rem; }
.hdr .brand { justify-self: start; }
.hdr nav { justify-self: end; }
.clocks { display: flex; align-items: center; border-left: 1px solid var(--line); border-right: 1px solid var(--line); height: 100%; }
.clock { display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem; height: 100%; }
.clock + .clock { border-left: 1px solid var(--line); }
.clock-face { width: 40px; height: 40px; display: block; flex: none; }
.clock-face .frame { fill: none; stroke: var(--ink); stroke-width: 1; vector-effect: non-scaling-stroke; }
.clock-face .ticks rect, .clock-face .hand rect, .clock-face .pin { fill: var(--ink); }
.clock-face .ticks rect { opacity: .4; }
.clock-face .sec { fill: var(--lilac-mid); }
.clock[data-label="Pacific"] .clock-face .sec { fill: var(--sage-mid); }
.clock-read { display: flex; flex-direction: column; gap: .32rem; line-height: 1; }
.clock-place { order: -1; font-size: .62rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.clock-time { font-family: var(--mono); font-size: 1rem; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: .01em; white-space: nowrap; }
.clock-time .tz { color: var(--muted); font-size: .72em; margin-left: .35em; }
/* medium screens: hide the Contact button in the header to make room */
@media (max-width: 62rem) { .site-header nav .btn { display: none; } .clock { padding: 0 1rem; } }
/* small screens: clocks get their own row under the logo + nav, still pinned */
@media (max-width: 50rem) {
  .hdr { grid-template-columns: 1fr auto; grid-template-rows: 3.75rem auto; height: auto; }
  .clocks { grid-column: 1 / -1; grid-row: 2; height: auto; border: none; border-top: 1px solid var(--line); justify-content: center; }
  .clock { flex: 1; justify-content: center; padding: .55rem .5rem; height: auto; }
  .clock-face { width: 32px; height: 32px; }
  .clock-time { font-size: .92rem; }
}
@media print { .clocks { display: none; } }

/* ---------- tessellation behind the About and Contact bands (graphics.js) ---------- */
.has-tess { position: relative; overflow: hidden; }
.has-tess > .wrap { position: relative; z-index: 1; }
.tess { position: absolute; inset: 0; pointer-events: none; z-index: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000 80%); mask-image: linear-gradient(90deg, transparent 30%, #000 80%); }
.tess path { fill: currentColor; }
.about .tess { color: var(--ink); opacity: .06; }
.contact .tess { color: var(--on-ink); opacity: .09; }
.tess .flipper-half { transform-box: fill-box; transform-origin: center; transition: transform 1.1s cubic-bezier(.65, 0, .35, 1); }
.tess .flipper-half.turned { transform: rotate(180deg); }

/* ---------- scroll reveal (site.js) ---------- */
html.reveal-on [data-reveal] { opacity: 0; transform: translateY(14px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
html.reveal-on [data-reveal].in { opacity: 1; transform: none; }

/* ---------- intro animation overlay (intro.js) ---------- */
.intro-overlay { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; cursor: pointer; transition: opacity .45s ease; }
.intro-overlay svg { width: min(92vw, 900px); height: auto; overflow: visible; }
.intro-overlay.leaving { opacity: 0; pointer-events: none; }
html.intro-playing .site-header, html.intro-playing main, html.intro-playing .site-footer { opacity: 0; }
.site-header, main, .site-footer { transition: opacity .6s ease .1s; }
html.intro-playing .brand .logo, html.logo-flying .brand .logo { visibility: hidden; }

/* ---------- pre-launch: everything from Research down is hidden; nav links say "Coming soon" (site.js).
   To launch a section: remove "is-soon" from its <section> and data-soon from its nav link. ---------- */
.is-soon { display: none !important; }
.soon-toast { position: fixed; z-index: 60; margin: 0; padding: .55rem .8rem; background: var(--ink); color: var(--on-ink);
  font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease); }
.soon-toast.on { opacity: 1; transform: none; }
