/* ==========================================================================
   nicholasvasilescu.com - static site styles
   Single stylesheet. All design decisions live here.
   ========================================================================== */

/* Inter variable - served locally, no external requests */
@font-face {
  font-family: 'InterVar';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/wp-content/themes/twentytwenty/assets/fonts/inter/Inter-upright-var.woff2') format('woff2');
}
@font-face {
  font-family: 'InterVar';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('/wp-content/themes/twentytwenty/assets/fonts/inter/Inter-italic-var.woff2') format('woff2');
}

/* ---------------------------------------------------------------- tokens */
:root {
  --font-ui: 'InterVar', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-prose: ui-serif, 'Iowan Old Style', 'Charter', Georgia, Cambria, serif;

  --bg:        #fcfbf9;
  --surface:   #ffffff;
  --surface-2: #f4f2ee;
  --text:      #17161c;
  --muted:     #6b6875;
  --line:      #e6e2db;
  --accent:    #5233ff;
  --accent-ink:#ffffff;
  --accent-soft: rgba(82, 51, 255, 0.07);
  --glow-a: rgba(82, 51, 255, 0.13);
  --glow-b: rgba(255, 106, 61, 0.10);
  --shadow: 0 1px 2px rgba(20,18,30,.05), 0 8px 24px -12px rgba(20,18,30,.18);
  --shadow-lg: 0 2px 4px rgba(20,18,30,.06), 0 24px 60px -24px rgba(20,18,30,.3);

  --radius: 14px;
  --radius-sm: 9px;
  --container: 1140px;
  --prose: 68ch;
  --header-h: 68px;
}

:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    --bg:        #0b0a0f;
    --surface:   #14131b;
    --surface-2: #1b1926;
    --text:      #eeecf4;
    --muted:     #9c98a9;
    --line:      #272534;
    --accent:    #9d8cff;
    --accent-ink:#12101d;
    --accent-soft: rgba(157, 140, 255, 0.12);
    --glow-a: rgba(120, 96, 255, 0.20);
    --glow-b: rgba(255, 122, 80, 0.12);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 2px 4px rgba(0,0,0,.4), 0 24px 60px -24px rgba(0,0,0,.75);
  }
}
/* fallback for browsers without nested @media in :root */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0b0a0f;
    --surface:   #14131b;
    --surface-2: #1b1926;
    --text:      #eeecf4;
    --muted:     #9c98a9;
    --line:      #272534;
    --accent:    #9d8cff;
    --accent-ink:#12101d;
    --accent-soft: rgba(157, 140, 255, 0.12);
    --glow-a: rgba(120, 96, 255, 0.20);
    --glow-b: rgba(255, 122, 80, 0.12);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 2px 4px rgba(0,0,0,.4), 0 24px 60px -24px rgba(0,0,0,.75);
  }
}
:root[data-theme="dark"] {
  --bg:        #0b0a0f;
  --surface:   #14131b;
  --surface-2: #1b1926;
  --text:      #eeecf4;
  --muted:     #9c98a9;
  --line:      #272534;
  --accent:    #9d8cff;
  --accent-ink:#12101d;
  --accent-soft: rgba(157, 140, 255, 0.12);
  --glow-a: rgba(120, 96, 255, 0.20);
  --glow-b: rgba(255, 122, 80, 0.12);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-lg: 0 2px 4px rgba(0,0,0,.4), 0 24px 60px -24px rgba(0,0,0,.75);
}

/* ----------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, iframe, object, canvas { max-width: 100%; }
img { height: auto; border: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: .7rem 1.1rem; border-radius: 0 0 var(--radius-sm) 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: clamp(1.15rem, 4vw, 2.5rem); }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
@supports not (backdrop-filter: blur(1px)) { .site-header { background: var(--bg); } }

.header-inner {
  min-height: var(--header-h);
  display: flex; align-items: center; gap: 1.25rem;
  justify-content: space-between;
}
.brand {
  font-weight: 700; font-size: 1.02rem; letter-spacing: -0.021em;
  color: var(--text); text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .6rem;
}
.brand:hover { color: var(--accent); }
.brand-mark {
  width: 26px; height: 26px; flex: none; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #ff7a50));
  display: grid; place-items: center;
  color: #fff; font-size: .72rem; font-weight: 800; letter-spacing: -.03em;
}

.nav-toggle {
  display: none; align-items: center; gap: .5rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: .45rem .9rem; font: inherit; font-size: .875rem; font-weight: 600;
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--accent); color: var(--accent); }

.site-nav ul {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .1rem .15rem; list-style: none; margin: 0; padding: 0;
}
.site-nav a {
  display: block; padding: .42rem .62rem; border-radius: 8px;
  font-size: .855rem; font-weight: 500; letter-spacing: -0.006em;
  color: var(--muted); text-decoration: none; white-space: nowrap;
  transition: color .15s ease, background-color .15s ease;
}
.site-nav a:hover { color: var(--text); background: var(--accent-soft); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

@media (max-width: 1060px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    padding: .6rem clamp(1.15rem, 4vw, 2.5rem) 1.1rem;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav a { padding: .68rem .7rem; font-size: .98rem; border-radius: var(--radius-sm); }
}

/* ------------------------------------------------------------------ hero */
.page-hero {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1100px 380px at 12% -40%, var(--glow-a), transparent 62%),
    radial-gradient(760px 320px at 92% -12%, var(--glow-b), transparent 60%);
}
.page-hero .container { padding-block: clamp(3.2rem, 9vw, 6rem) clamp(2.2rem, 6vw, 3.4rem); }
.eyebrow {
  display: inline-block; margin: 0 0 1rem;
  font-size: .74rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent);
}
.page-title {
  margin: 0; font-weight: 700;
  font-size: clamp(2.5rem, 7.5vw, 4.6rem);
  line-height: 1.02; letter-spacing: -0.038em;
  max-width: 20ch;
}
.hero-rule {
  width: 64px; height: 4px; margin-top: 1.9rem; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #ff7a50));
}

/* --------------------------------------------------------------- content */
main { display: block; }
.page-body { padding-block: clamp(2.6rem, 6vw, 4.4rem) clamp(3.5rem, 9vw, 6rem); }

.prose { max-width: var(--prose); margin-inline: auto; }
.prose > p, .prose > ul, .prose > ol, .prose > blockquote {
  font-family: var(--font-prose);
  font-size: 1.115rem; line-height: 1.75;
}
.prose > p { margin: 0 0 1.45em; }
.prose > p:empty { display: none; }
.prose strong { font-weight: 650; }

.prose h2, .prose h3, .prose h4, .prose h5 {
  font-family: var(--font-ui); font-weight: 680;
  letter-spacing: -0.024em; line-height: 1.18;
  margin: 2.6em 0 .75em; scroll-margin-top: calc(var(--header-h) + 1.5rem);
}
.prose h2 { font-size: 1.92rem; }
.prose h3 { font-size: 1.52rem; }
.prose h4 { font-size: 1.235rem; }
.prose h2:first-child, .prose h3:first-child, .prose h4:first-child { margin-top: 0; }

.prose ul, .prose ol { padding-left: 1.35em; margin: 0 0 1.45em; }
.prose li { margin-bottom: .55em; }
.prose li::marker { color: var(--accent); }

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .885em; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 6px; padding: .12em .42em;
}

.prose blockquote {
  margin: 2.2em 0; padding: .2em 0 .2em 1.5em;
  border-left: 3px solid var(--accent);
  color: var(--text); font-style: italic;
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* WordPress colour utility, remapped onto the new palette */
.has-primary-color, .has-text-color.has-primary-color { color: var(--accent) !important; }

/* ---------------------------------------------------------------- images */
figure { margin: 2.6rem 0; }
.prose figure { max-width: none; }
figure.wp-block-image { text-align: center; }
figure.wp-block-image img,
.prose > img {
  display: block; margin-inline: auto;
  width: auto; max-width: 100%; height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--surface-2);
}
/* page's featured image, lifted to the top of the article */
figure.featured-image { margin-top: 0; margin-bottom: 3.2rem; }

figcaption, .wp-element-caption {
  margin-top: .95rem; font-size: .875rem; line-height: 1.55;
  color: var(--muted); text-align: center;
  max-width: 62ch; margin-inline: auto;
}

/* click-to-zoom affordance */
img.zoomable { cursor: zoom-in; transition: transform .35s cubic-bezier(.2,.7,.3,1), box-shadow .35s ease; }
img.zoomable:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.lightbox {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: rgba(8,7,12,.93);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  padding: clamp(1rem, 4vw, 3rem);
  opacity: 0; pointer-events: none; transition: opacity .22s ease;
  cursor: zoom-out; border: 0;
}
.lightbox.is-open { opacity: 1; pointer-events: auto; }
.lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.lightbox-close {
  position: absolute; top: clamp(.75rem, 2vw, 1.5rem); right: clamp(.75rem, 2vw, 1.5rem);
  width: 42px; height: 42px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25);
  font-size: 1.35rem; line-height: 1; display: grid; place-items: center;
}
.lightbox-close:hover { background: rgba(255,255,255,.22); }

/* --------------------------------------------------------- columns/group */
.wp-block-columns {
  display: flex; flex-wrap: wrap; gap: clamp(1.25rem, 3vw, 2.25rem);
  margin: 2.4rem 0; align-items: flex-start;
}
/* Column blocks break out past the prose measure - they hold side-by-side
   media (the 400px Hype animations) that the reading column would clip. */
.prose .wp-block-columns {
  width: min(calc(100vw - 3rem), 980px);
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}
.wp-block-column { flex: 1 1 min(100%, 400px); min-width: 0; }
.wp-block-column > :first-child, .wp-block-group > :first-child { margin-top: 0; }
.wp-block-column > :last-child, .wp-block-group > :last-child { margin-bottom: 0; }
.wp-block-group { margin: 2.2rem 0; }

/* ---------------------------------------------------------------- embeds */
.wp-block-embed { margin: 2.6rem 0; }
.wp-block-embed__wrapper { position: relative; }
.wp-block-embed iframe,
.prose iframe {
  display: block; width: 100%; aspect-ratio: 16 / 9; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); background: #000;
}
/* Tumult Hype animations are fixed-size canvases (400x400) whose contents are
   absolutely positioned - clamping the box to max-width:100% crops the drawing
   rather than scaling it. Production lets them overflow their column, so match
   that, and only scale down where the viewport genuinely cannot fit one. */
.HYPE_document {
  margin-inline: auto !important;
  border-radius: var(--radius);
}
@media (max-width: 470px) {
  /* scale from the left edge - `top center` pivots around the 400px layout
     box, which pushes the shrunken canvas off to the right */
  .HYPE_document { transform: scale(.8); transform-origin: top left; margin-inline: 0 !important; }
  .wp-block-column:has(.HYPE_document) { height: 330px; overflow: hidden; }
}

/* external article card (replaces WordPress oEmbed iframes) */
.link-card {
  display: block; margin: 2.4rem 0; padding: 1.4rem 1.6rem;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: var(--text);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.link-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.link-card .link-card-kicker {
  display: block; font-size: .72rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
  margin-bottom: .45rem;
}
.link-card .link-card-title {
  display: block; font-size: 1.14rem; font-weight: 640; letter-spacing: -.018em; line-height: 1.35;
}
.link-card .link-card-host { display: block; margin-top: .5rem; font-size: .85rem; color: var(--muted); }

/* ------------------------------------------------------------ press item */
.press-feature { margin: 2.4rem 0 0; }
.press-feature a { display: block; text-decoration: none; }
.press-feature img {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow); background: #fff;
  transition: transform .2s ease, box-shadow .2s ease;
}
.press-feature a:hover img { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.press-feature figcaption { text-align: left; max-width: none; }
.press-feature figcaption a { display: inline; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------ file / PDF */
.wp-block-file {
  margin: 2.4rem 0; padding: 1.25rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 1rem;
}
.wp-block-file__embed {
  width: 100%; min-height: 620px; height: 78vh;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.wp-block-file > a:not(.wp-block-file__button) {
  font-family: var(--font-ui); font-weight: 620; font-size: 1.02rem;
  letter-spacing: -.015em; color: var(--text); text-decoration: none;
}
.wp-block-file > a:not(.wp-block-file__button):hover { color: var(--accent); }
.wp-block-file__button, .wp-element-button {
  align-self: flex-start;
  display: inline-block; padding: .6rem 1.25rem;
  background: var(--accent); color: var(--accent-ink) !important;
  border: 0; border-radius: 999px;
  font-family: var(--font-ui); font-size: .875rem; font-weight: 650;
  letter-spacing: .01em; text-decoration: none;
  transition: transform .15s ease, filter .15s ease;
}
.wp-block-file__button:hover, .wp-element-button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.file-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-block: clamp(2.4rem, 5vw, 3.5rem);
}
.footer-inner { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; align-items: baseline; justify-content: space-between; }
.footer-name { font-weight: 660; letter-spacing: -.02em; }
.footer-meta { color: var(--muted); font-size: .875rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: .35rem 1.15rem; list-style: none; margin: 0; padding: 0; }
.footer-nav a { color: var(--muted); text-decoration: none; font-size: .875rem; }
.footer-nav a:hover { color: var(--accent); }

/* --------------------------------------------------------------- utility */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
@media print {
  .site-header, .site-footer, .lightbox { display: none !important; }
  body { background: #fff; color: #000; }
}
