/* ==========================================================================
   Eoin McLaughlin — "The Factsheet"
   Custom styles beyond Tailwind utilities.
   Colours and fonts are also registered in the inline Tailwind config (index.html).
   ========================================================================== */

:root {
  --base: #0A0F0D;
  --base-2: #101814;
  --ivory: #ECE8DF;
  --muted: #9AA39E;
  --glow-1: #0E3B2E;
  --glow-2: #135C47;
  --emerald: #2FA37A;
  --brass: #B8975A;
  --hair: rgba(255, 255, 255, .08);
  --hair-2: rgba(255, 255, 255, .14);
  --ease: cubic-bezier(.16, 1, .3, 1);   /* calm ease-out, nothing bouncy */
  --nav-h: 64px;
}

html { background: var(--base); scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  background: linear-gradient(180deg, var(--base) 0%, var(--base-2) 100%);
  color: var(--ivory);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(47, 163, 122, .35); color: #fff; }

.tnum { font-variant-numeric: tabular-nums; }

/* Small uppercase labels with generous letter-spacing */
.label {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: .6875rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Visible focus states everywhere */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 1px solid var(--emerald);
  outline-offset: 4px;
  border-radius: 2px;
}

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: .6rem 1rem; background: var(--ivory); color: var(--base); border-radius: 2px; }
.skip-link:focus { top: 1rem; }

/* --------------------------------------------------------------------------
   Atmosphere: slow emerald blooms, film grain, cursor light
   -------------------------------------------------------------------------- */
.blooms { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bloom { position: absolute; border-radius: 9999px; filter: blur(110px); will-change: transform; }
.bloom-a { width: 70vmax; height: 70vmax; top: -35vmax; right: -25vmax;
  background: radial-gradient(circle, rgba(19, 92, 71, .42), transparent 62%);
  animation: bloom-a 72s ease-in-out infinite alternate; }
.bloom-b { width: 60vmax; height: 60vmax; bottom: -32vmax; left: -22vmax;
  background: radial-gradient(circle, rgba(14, 59, 46, .6), transparent 62%);
  animation: bloom-b 90s ease-in-out infinite alternate; }
.bloom-c { width: 40vmax; height: 40vmax; top: 40%; left: 45%;
  background: radial-gradient(circle, rgba(16, 70, 74, .22), transparent 62%);   /* deep teal */
  animation: bloom-c 110s ease-in-out infinite alternate; }
@keyframes bloom-a { to { transform: translate3d(-10vw, 12vh, 0) scale(1.12); } }
@keyframes bloom-b { to { transform: translate3d(12vw, -10vh, 0) scale(1.18); } }
@keyframes bloom-c { to { transform: translate3d(-18vw, -14vh, 0) scale(.9); } }

.grain {
  position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.cursor-light {
  position: fixed; left: 0; top: 0; width: 640px; height: 640px; margin: -320px 0 0 -320px;
  border-radius: 50%; pointer-events: none; z-index: 0; opacity: 0;
  background: radial-gradient(circle, rgba(47, 163, 122, .07), transparent 60%);
  transition: opacity .8s var(--ease);
}
.cursor-light.is-on { opacity: 1; }

/* --------------------------------------------------------------------------
   Surfaces: architectural glass panels with hairline border + top highlight
   -------------------------------------------------------------------------- */
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .012));
  border: 1px solid var(--hair);
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.lift { transition: transform .6s var(--ease), border-color .6s var(--ease), box-shadow .6s var(--ease); }
.lift:hover {
  transform: translateY(-3px);
  border-color: rgba(47, 163, 122, .32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px rgba(47, 163, 122, .08), 0 20px 44px -24px rgba(47, 163, 122, .45);
}

.hairline { height: 1px; background: var(--hair); }

/* --------------------------------------------------------------------------
   Sections: large faint numbers (parallax)
   -------------------------------------------------------------------------- */
.section { position: relative; overflow-x: clip; }   /* contains the large numbers so the page never scrolls sideways */
.section-num {
  position: absolute; right: -.04em; top: 2.5rem; z-index: -1;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(8rem, 24vw, 19rem); line-height: .8;
  color: rgba(236, 232, 223, .035);
  pointer-events: none; user-select: none; will-change: transform;
}
.section-title em { font-style: italic; color: var(--emerald); }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: .6rem; padding: .85rem 1.5rem; border-radius: 999px; font-size: .9375rem; font-weight: 500; transition: background .5s var(--ease), color .5s var(--ease), border-color .5s var(--ease), transform .5s var(--ease); }
.btn-solid { background: var(--ivory); color: var(--base); }
.btn-solid:hover { background: #fff; transform: translateY(-2px); }
.btn-line { border: 1px solid var(--hair-2); color: var(--ivory); }
.btn-line:hover { border-color: var(--emerald); color: #fff; transform: translateY(-2px); }
.btn svg { transition: transform .5s var(--ease); }
.btn:hover svg { transform: translateX(3px); }

/* --------------------------------------------------------------------------
   Nav: fades in after the hero; emerald progress line
   -------------------------------------------------------------------------- */
#nav {
  opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
  background: rgba(10, 15, 13, .78);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hair);
}
#nav.is-visible, #nav:focus-within { opacity: 1; transform: none; pointer-events: auto; }
.nav-link { position: relative; color: var(--muted); transition: color .4s var(--ease); }
.nav-link::after { content: ""; position: absolute; left: 0; right: 0; bottom: -.45rem; height: 1px; background: var(--emerald); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease); }
.nav-link:hover, .nav-link.is-active { color: var(--ivory); }
.nav-link.is-active::after { transform: scaleX(1); }
#progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 70; background: var(--emerald); transform-origin: left; transform: scaleX(0); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; will-change: transform; }
.hero-name { font-size: clamp(4.25rem, 15.5vw, 12rem); line-height: .86; letter-spacing: -.015em; }
.intro-anim { opacity: 0; transform: translateY(14px); animation: rise .8s var(--ease) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* Ticker */
.ticker { overflow: hidden; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); background: rgba(10, 15, 13, .55); }
.ticker-track { display: flex; width: max-content; animation: ticker 80s linear infinite; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
.ticker-list { display: flex; align-items: center; flex-shrink: 0; gap: 0; padding: .85rem 0; margin: 0; list-style: none;
  font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .75rem; letter-spacing: .12em; white-space: nowrap; }
.ticker-list li { display: inline-flex; align-items: center; gap: .55em; color: var(--ivory); }
.ticker-list li::after { content: "·"; color: var(--muted); margin: 0 1.6em; }
.ticker-list .tk-v { color: var(--muted); }
.ticker-list .tk-up { color: var(--emerald); font-size: .85em; }
.ticker-list .tk-star { color: var(--brass); }
@keyframes ticker { to { transform: translateX(-50%); } }

/* --------------------------------------------------------------------------
   Scroll reveals (fade + slight rise, staggered via --d)
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: var(--d, 0ms); }
.reveal.is-in { opacity: 1; transform: none; }

/* --------------------------------------------------------------------------
   Key facts (factsheet label/value rows)
   -------------------------------------------------------------------------- */
.facts > div { display: flex; justify-content: space-between; gap: 1.5rem; padding: .85rem 0; border-top: 1px solid var(--hair); }
.facts dt { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.facts dd { text-align: right; font-size: .9375rem; }

/* Headline figures */
.figure-num { font-family: "Instrument Serif", Georgia, serif; font-size: clamp(3.25rem, 7vw, 5.25rem); line-height: 1; }
.count { display: inline; }

/* --------------------------------------------------------------------------
   Expandable holding rows (smooth height via grid rows)
   -------------------------------------------------------------------------- */
.expand { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .7s var(--ease); }
.expand > .expand-inner { overflow: hidden; min-height: 0; }
.expand.is-open { grid-template-rows: 1fr; }
.expand-inner > div { opacity: 0; transition: opacity .6s var(--ease) .1s; }
.expand.is-open .expand-inner > div { opacity: 1; }

.plus { width: 2rem; height: 2rem; border: 1px solid var(--hair-2); border-radius: 999px; display: grid; place-items: center; flex-shrink: 0; transition: border-color .5s var(--ease), background .5s var(--ease); }
.plus::before, .plus::after { content: ""; grid-area: 1 / 1; width: .65rem; height: 1px; background: var(--ivory); transition: transform .5s var(--ease); }
.plus::after { transform: rotate(90deg); }
[aria-expanded="true"] .plus::after { transform: rotate(0deg); }
[aria-expanded="true"] .plus, .holding-btn:hover .plus { border-color: var(--emerald); }

.badge { display: inline-flex; align-items: center; gap: .4rem; font-family: "IBM Plex Mono", monospace; font-size: .625rem; letter-spacing: .16em; text-transform: uppercase; padding: .25rem .55rem; border-radius: 2px; }
.badge-current { color: var(--emerald); border: 1px solid rgba(47, 163, 122, .5); }
.badge-current::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 3px rgba(47, 163, 122, .18); }

/* Bullets: a short emerald dash */
.dash > li { position: relative; padding-left: 1.3rem; }
.dash > li::before { content: ""; position: absolute; left: 0; top: .75em; width: .65rem; height: 1px; background: var(--emerald); }

/* Progression within one organisation (most recent role first) */
.progression { position: relative; list-style: none; padding-left: 1.75rem; }
.progression::before { content: ""; position: absolute; left: .3rem; top: .7rem; bottom: .7rem; width: 1px; background: linear-gradient(to bottom, var(--emerald), rgba(255, 255, 255, .1)); }
.progression > li { position: relative; }
.progression > li + li { margin-top: 2.25rem; }
.progression > li::before { content: ""; position: absolute; left: calc(-1.75rem + .3rem - 4px); top: .7rem; width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--emerald); background: var(--base); }
.progression > li.is-current::before { background: var(--emerald); box-shadow: 0 0 0 4px rgba(47, 163, 122, .16); }

/* --------------------------------------------------------------------------
   Tabs
   -------------------------------------------------------------------------- */
[role="tablist"] { scrollbar-width: none; }
[role="tablist"]::-webkit-scrollbar { display: none; }
@media (max-width: 767px) {   /* hint that the tab row scrolls sideways on phones */
  [role="tablist"] { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); padding-right: 2rem; }
}
[role="tab"] { position: relative; color: var(--muted); white-space: nowrap; padding-bottom: .85rem; transition: color .4s var(--ease); }
[role="tab"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--emerald); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease); }
[role="tab"][aria-selected="true"] { color: var(--ivory); }
[role="tab"][aria-selected="true"]::after { transform: scaleX(1); }
[role="tab"]:hover { color: var(--ivory); }
[role="tabpanel"][hidden] { display: none !important; }
[role="tabpanel"] { animation: fade-in .6s var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Research note (Welltower)
   -------------------------------------------------------------------------- */
.note-card { overflow: hidden; }
.note-card::before {   /* faint ruled-paper top band, like a research cover */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--emerald), rgba(47, 163, 122, 0) 70%);
}
.ribbon {
  position: absolute; top: 0; right: 1.25rem; width: 7.25rem; padding: 1rem .6rem 1.4rem;
  background: linear-gradient(180deg, #c7a86b, var(--brass));
  color: #14110b; text-align: center;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%);
  font-family: "IBM Plex Mono", monospace; text-transform: uppercase;
  box-shadow: 0 10px 24px -12px rgba(184, 151, 90, .6);
}
.ribbon b { display: block; font-size: .6875rem; letter-spacing: .14em; font-weight: 500; }
.ribbon span { display: block; margin-top: .3rem; font-size: .5625rem; letter-spacing: .1em; opacity: .8; }
.stamp { display: inline-block; font-family: "IBM Plex Mono", monospace; font-size: .625rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--hair-2); padding: .35rem .6rem; border-radius: 2px; transform: rotate(-1.5deg); }
.buy { font-family: "IBM Plex Mono", monospace; font-size: .75rem; letter-spacing: .2em; color: var(--base); background: var(--emerald); padding: .3rem .7rem; border-radius: 2px; font-weight: 500; }
.tag { display: inline-flex; align-items: center; font-family: "IBM Plex Mono", monospace; font-size: .6875rem; letter-spacing: .08em; padding: .3rem .6rem; border: 1px solid var(--hair-2); border-radius: 2px; color: var(--ivory); }

/* --------------------------------------------------------------------------
   Education: term-sheet rows and module list
   -------------------------------------------------------------------------- */
.term > div { display: grid; grid-template-columns: 1fr; gap: .35rem; padding: 1rem 0; border-top: 1px solid var(--hair); }
.term dt { font-family: "IBM Plex Mono", monospace; font-size: .6875rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); padding-top: .2rem; }
@media (min-width: 768px) { .term > div { grid-template-columns: 11rem 1fr; gap: 2rem; } }

.modules li { display: grid; grid-template-columns: 4.5rem 1fr; gap: .75rem; align-items: baseline; padding: .55rem 0; border-top: 1px solid rgba(255, 255, 255, .06); color: var(--ivory); break-inside: avoid; }
.modules li:first-child { border-top: 0; }
.modules code { font-family: "IBM Plex Mono", monospace; font-size: .75rem; letter-spacing: .06em; color: var(--emerald); }   /* every module styled equally */

/* --------------------------------------------------------------------------
   Toolkit: evidence matrix (desktop) → stacked list (mobile)
   Each row is a button that expands to per-context detail and project notes.
   -------------------------------------------------------------------------- */
.mx-row { border-top: 1px solid var(--hair); transition: background .5s var(--ease); }
.mx-row:last-child { border-bottom: 1px solid var(--hair); }
.mx-row:hover, .mx-row:has([aria-expanded="true"]) { background: rgba(47, 163, 122, .04); }
.mx-head { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: .6rem .75rem; padding: 1.1rem .25rem; align-items: center; }
.mx-tool { font-size: 1.0625rem; font-weight: 500; grid-column: 1; grid-row: 1; }
.mx-head .plus { grid-column: 2; grid-row: 1; width: 1.6rem; height: 1.6rem; }
.mx-cells { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem; }
.mx-cell { display: none; }
.mx-cell.on { display: inline-flex; align-items: center; gap: .4rem; font-family: "IBM Plex Mono", monospace; font-size: .6875rem; letter-spacing: .08em; padding: .25rem .55rem; border: 1px solid rgba(47, 163, 122, .4); border-radius: 2px; color: var(--ivory); }
.mx-cell .mark { width: 6px; height: 6px; border-radius: 1px; background: var(--emerald); }
.mx-sum { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.mx-colheads { display: none; }

/* Expanded detail: what was done in each context */
.mx-detail { padding: .25rem .25rem 1.5rem; }
.mx-contexts > div { display: grid; grid-template-columns: 1fr; gap: .2rem; padding: .7rem 0; border-top: 1px solid rgba(255, 255, 255, .06); }
.mx-contexts dt { font-family: "IBM Plex Mono", monospace; font-size: .6875rem; letter-spacing: .14em; text-transform: uppercase; color: var(--emerald); }
.mx-contexts dd { color: rgba(236, 232, 223, .88); font-size: .9375rem; line-height: 1.6; }
.mx-projects { display: grid; gap: .75rem; margin-top: 1rem; }
.project { border: 1px solid var(--hair); border-radius: 3px; padding: 1.1rem 1.2rem; background: rgba(255, 255, 255, .015); }

@media (min-width: 640px) {
  .mx-contexts > div { grid-template-columns: 8.5rem 1fr; gap: 1.5rem; }
  .mx-projects { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 900px) {
  .mx-grid, .mx-head { grid-template-columns: minmax(9.5rem, 1.3fr) repeat(4, minmax(0, 1fr)) 2.5rem; }
  .mx-colheads { display: grid; gap: .75rem; padding: 0 .25rem .9rem; }
  .mx-head { padding: 1rem .25rem; }
  .mx-tool, .mx-head .plus { grid-column: auto; grid-row: auto; }
  .mx-head .plus { justify-self: end; }
  .mx-cells { display: contents; }
  .mx-cell, .mx-cell.on { display: flex; justify-content: center; align-items: center; padding: 0; border: 0; }
  .mx-cell .mx-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .mx-cell .mark { width: 9px; height: 9px; box-shadow: 0 0 0 4px rgba(47, 163, 122, .14); }
  .mx-cell:not(.on)::before { content: ""; width: 10px; height: 1px; background: rgba(236, 232, 223, .16); }
  .mx-sum { display: none; }
  .mx-detail { padding: .25rem 3.5rem 1.75rem .25rem; }
  .mx-row .mx-cell { position: relative; }
}

/* --------------------------------------------------------------------------
   Reduced motion: no parallax, canvas animation, ticker scroll or count-ups
   (JS also checks this preference)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bloom, .intro-anim, .ticker-track, [role="tabpanel"] { animation: none !important; }
  .intro-anim { opacity: 1; transform: none; }
  .ticker { overflow-x: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .expand, .expand-inner > div, .lift, .btn { transition: none !important; }
  .lift:hover, .btn:hover { transform: none; }
}
