/* =====================================================
   Ryan Wehner — main.css
   Static rebuild of ryanwehner.com (was WordPress / Twenty Twenty-Four)
===================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Palette */
  --color-base:        #f9f9f9;
  --color-base-2:      #ffffff;
  --color-contrast:    #111111;
  --color-contrast-2:  #636363;
  --color-contrast-3: #A4A4A4;

  --color-accent:    #cfcabe;
  --color-accent-2:  #c2a990;
  --color-accent-3:  #d8613c;
  --color-accent-4:  #b1c5a4;
  --color-accent-5:  #b5bdbc;

  --color-yellow:  #ffff00;
  --color-blue:    #0000ff;
  --color-magenta: #ee2a7b;

  --hl-yellow: rgba(255, 230, 80, 0.75);
  --hl-pink:   rgba(255, 45, 143, 0.95);

  /* Typography */
  --font-body:    "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-display: "Inter", system-ui, sans-serif;
  --font-mono:    "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --fs-small:    0.9rem;
  --fs-medium:   1.05rem;
  --fs-large:    clamp(1.39rem, 1.39rem + ((1vw - 0.2rem) * 0.767), 1.85rem);
  --fs-x-large:  clamp(1.85rem, 1.85rem + ((1vw - 0.2rem) * 1.083), 2.5rem);
  --fs-xx-large: clamp(2.5rem, 2.5rem + ((1vw - 0.2rem) * 1.283), 3.27rem);

  /* Spacing */
  --sp-10: 1rem;
  --sp-20: min(1.5rem, 2vw);
  --sp-30: min(2.5rem, 3vw);
  --sp-40: min(4rem, 5vw);
  --sp-50: min(6.5rem, 8vw);
  --sp-60: min(10.5rem, 13vw);

  --content-size: 620px;
  --wide-size: 1280px;

  /* Layout */
  --rw-header-h: 84px;
  --rw-gutter: 24px;

  /* Marquee tunables */
  --rw-marquee-duration: 18s;
  --rw-marquee-gap: 3rem;
  --rw-marquee-shift: 0px;

  /* Cursor dot */
  --rw-dot-size: 10px;
  --rw-dot-blend: normal;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 20px;
  line-height: 31px;
  color: var(--color-contrast);
  background: var(--color-base);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html { scroll-behavior: smooth; scroll-padding-top: var(--rw-header-h); }

img, svg, video { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration: underline; text-underline-offset: 0.16em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

ul { padding-left: 1.2em; margin: 1em 0; }
li { margin: 0.25em 0; }

p { margin: 0 0 1em; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 0.6em;
  color: var(--color-contrast);
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  left: 16px; top: 16px; width: auto; height: auto; padding: 8px 12px;
  background: #000; color: #fff; z-index: 100000;
}

/* ---------- Header ---------- */
.rw-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 99999;
  color: #000; /* default — JS flips to white over dark sections */
  transition: color 200ms ease;
  pointer-events: none;
}
.rw-header.is-on-dark { color: #fff; }
.rw-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--rw-gutter);
  pointer-events: auto;
}
.rw-site-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  line-height: 30px;
  letter-spacing: 0;
  color: inherit;
}
.rw-site-title a { text-decoration: none; color: inherit; }
.rw-site-title a:hover { opacity: 0.85; }

/* Nav */
.rw-nav__toggle {
  background: transparent;
  color: inherit;
  border: 0;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  opacity: 1;
  transition: opacity 200ms ease;
}
.rw-nav__toggle:hover { opacity: 0.85; }

/* Hide the hamburger while the overlay is open — the close X takes its place */
.rw-header:has(.rw-nav__overlay.is-open) .rw-nav__toggle {
  opacity: 0;
  pointer-events: none;
}

/* The overlay covers the full viewport but is click-through (pointer-events:
   none) so the page underneath stays scrollable. Only the menu list and the
   close button receive pointer events. */
.rw-nav__overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
  /* very light scrim so the page stays visible underneath */
  background: rgba(0, 0, 0, 0);
  transition: background 320ms ease;
}
.rw-nav__overlay.is-open { background: rgba(0, 0, 0, 0.18); }

.rw-nav__close {
  position: absolute;
  top: var(--rw-gutter);
  right: var(--rw-gutter);
  background: transparent;
  color: inherit;
  border: 0;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  pointer-events: none;
  opacity: 0;
  transition: opacity 240ms ease 60ms;
}
.rw-nav__overlay.is-open .rw-nav__close {
  opacity: 1;
  pointer-events: auto;
}

/* Menu list — right-aligned, dropping in just under the hamburger position.
   Slides in from the right edge with a per-item cascade. */
.rw-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  pointer-events: none;

  position: absolute;
  top: calc(var(--rw-gutter) + 44px);
  right: var(--rw-gutter);
  left: auto;
  text-align: right;

  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  line-height: 30px;
  letter-spacing: 0;
  color: inherit;

  transform: translate3d(110%, 0, 0);
  opacity: 0;
  transition:
    transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 280ms ease;
}
.rw-nav__overlay.is-open .rw-nav__list {
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  opacity: 1;
}

.rw-nav__list li {
  margin: 0;
  /* small per-item stagger so they cascade in just behind the list slide */
  opacity: 0;
  transform: translate3d(14px, 0, 0);
  transition: opacity 320ms ease, transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rw-nav__overlay.is-open .rw-nav__list li {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}
.rw-nav__list li:nth-child(1) { transition-delay: 80ms; }
.rw-nav__list li:nth-child(2) { transition-delay: 130ms; }
.rw-nav__list li:nth-child(3) { transition-delay: 180ms; }
.rw-nav__list li:nth-child(4) { transition-delay: 230ms; }
.rw-nav__list li:nth-child(5) { transition-delay: 280ms; }
.rw-nav__list li:nth-child(6) { transition-delay: 330ms; }

.rw-nav__list a {
  text-decoration: none;
  display: inline-block;
  padding: 0.15em 0.55em;
  background: #fff;
  color: #000;
  border-radius: 2px;
}
.rw-nav__list a:hover { background: var(--color-yellow); }

@media (prefers-reduced-motion: reduce) {
  .rw-nav__overlay,
  .rw-nav__list,
  .rw-nav__list li,
  .rw-nav__close { transition: none !important; }
}

/* ---------- Sections ---------- */
.rw-section {
  position: relative;
  z-index: 1;
  /* size to content — no forced 100vh */
  padding: clamp(64px, 8vw, 128px) clamp(20px, 3vw, 56px);
}
.rw-section:first-of-type { padding-top: calc(var(--rw-header-h) + var(--sp-30)); }

.rw-panel {
  width: 100%;
  max-width: 1400px; /* wide content area for big headings + lists */
  margin: 0 auto;
}
.rw-panel.rw-inner { background: transparent; }

/* Hero — only full-viewport section.
   Title is vertically centered; the bouncy arrow is pinned to the bottom. */
.rw-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  /* leave room at the bottom for the arrow so the centered title doesn't sit on top of it */
  padding-bottom: 120px;
}
.rw-hero .rw-panel { max-width: 720px; }

.rw-section {
  /* smooth color flip when the section becomes the in-view "active" one */
  transition: background-color 380ms ease;
}
.rw-section--white  { background: var(--color-base-2); }
.rw-section--cream  { background: var(--color-base); }

/* When a work section is the one currently being viewed, flip its background
   to the brand yellow. Driven by /assets/js/active-section.js. */
.rw-section.is-active { background: var(--color-yellow); }

@media (prefers-reduced-motion: reduce) {
  .rw-section { transition: none; }
}

/* ---------- Hero ---------- */
.rw-hero {
  background: #000;
  color: var(--color-base-2);
  text-align: center;
  overflow: hidden; /* clip the over-scaled video */
}
.rw-hero .rw-panel {
  /* simple, centered — no internal flex stretching */
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* Background video — sized to cover the hero (16:9 aware). The iframe is
   forced large enough that it overlaps both viewport dimensions, then
   centered, so cropping always covers the hero like object-fit: cover. */
.rw-hero__video {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.rw-hero__video iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100vw;
  height: 56.25vw;          /* 16:9 of viewport width */
  min-width: 177.78vh;      /* 16:9 inverse for tall viewports */
  min-height: 100vh;
  /* scale up slightly so the blurred soft edges fall outside the hero */
  transform: translate(-50%, -50%) scale(1.08);
  filter: blur(100px);
  border: 0;
  pointer-events: none;
}

/* Dark scrim so the white hero copy stays readable on any frame. Tweak
   the rgba alpha to taste. */
.rw-hero__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* Animated film grain — SVG fractal-noise tile that drifts each frame to
   give a subtle moving texture. Adjust opacity / blend mode to taste. */
.rw-hero__grain {
  position: absolute;
  inset: -10%;                    /* over-extend so the drift never reveals an edge */
  z-index: 1;                     /* same layer as scrim, sits above the video */
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.85'/></svg>");
  background-size: 220px 220px;
  background-repeat: repeat;
  animation: rwGrain 0.8s steps(8) infinite;
  will-change: transform;
}

@keyframes rwGrain {
  0%   { transform: translate3d(0, 0, 0); }
  10%  { transform: translate3d(-3%, -2%, 0); }
  20%  { transform: translate3d(2%, 4%, 0); }
  30%  { transform: translate3d(-4%, 1%, 0); }
  40%  { transform: translate3d(3%, -3%, 0); }
  50%  { transform: translate3d(-1%, 4%, 0); }
  60%  { transform: translate3d(4%, -1%, 0); }
  70%  { transform: translate3d(-3%, 3%, 0); }
  80%  { transform: translate3d(2%, -4%, 0); }
  90%  { transform: translate3d(-4%, -2%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .rw-hero__grain { animation: none; }
}
.rw-hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 40px;
  line-height: 48px;
  letter-spacing: -0.015em;
  max-width: 22ch;
  margin: 0 auto;
  color: #fff;
}
.rw-scroll-indicator {
  position: absolute;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  margin: 0;
  z-index: 2;
  font-size: 1.5rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.78);
  animation: rwBounce 2.4s ease-in-out infinite;
}
@keyframes rwBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

/* ---------- Section typography ---------- */
.rw-section h1 {
  font-family: var(--font-display);
  font-weight: 700;
  /* targets ~80px on desktop, scales down to ~36px on phones */
  font-size: clamp(2.25rem, 1rem + 4.4vw, 5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.55em;
}
.rw-section p {
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 31px;
  font-weight: 300;
  max-width: none; /* run full panel width to align with heading + lists */
  margin: 0 0 1.2em;
}
.rw-section ul {
  list-style: none;
  padding: 0;
  margin: 1.2em 0 0;
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: 0;
}
.rw-section ul li {
  position: relative;
  padding: 0 0 0 1.6em;
  margin: 0;
  border-bottom: 0;
}
.rw-section ul li::before {
  content: "";
  position: absolute;
  left: 0.45em;
  top: 0.6em; /* aligns with the cap height of monospace text */
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Overview section uses larger, looser type */
#work h1 {
  font-size: clamp(2.25rem, 1rem + 4.4vw, 5rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  max-width: 22ch;
  text-align: center;
  margin: 0 auto;
}
#work .rw-panel { text-align: center; }
#work .rw-panel p { margin-left: auto; margin-right: auto; }

#hero { background: #000; }

.rw-cta {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.1rem, 0.9rem + 1vw, 1.4rem);
  text-decoration-thickness: 2px;
}

/* ---------- Marquee divider ---------- */
.rw-marquee {
  position: relative;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  overflow: hidden;
  background: var(--color-blue);
  color: var(--color-base-2);
  white-space: nowrap;
  padding: var(--sp-10) 0;
}
.rw-marquee__text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  letter-spacing: -0.01em;
  margin: 0;
  padding: 0 1rem;
  white-space: nowrap;
  display: inline-block;
  color: var(--color-base-2);
}
.rw-marquee__track {
  display: flex;
  width: max-content;
  will-change: transform;
  animation: rwMarquee var(--rw-marquee-duration, 18s) linear infinite;
}
.rw-marquee__copy {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}
.rw-marquee__copy + .rw-marquee__copy { margin-left: var(--rw-marquee-gap, 3rem); }
.rw-marquee:hover .rw-marquee__track { animation-play-state: paused; }

@keyframes rwMarquee {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(calc(-1 * var(--rw-marquee-shift, 100%)), 0, 0); }
}

/* ---------- Reveal-on-scroll ---------- */
.rw-reveal {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 600ms ease, transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}
.rw-reveal.is-revealed {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}
.rw-reveal ul > li {
  opacity: 0;
  transform: translate3d(0, 12px, 0);
  transition: opacity 450ms ease, transform 550ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rw-reveal.is-revealed ul > li {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Line-by-line reveal for big paragraphs */
.rw-lines { display: block; }
.rw-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}
.rw-line > span {
  display: block;
  opacity: 0;
  transform: translate3d(0, 16px, 0);
  transition: opacity 500ms ease, transform 650ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}
.rw-lines.is-revealed .rw-line > span {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* ---------- Custom cursor (pointer fine only) ---------- */
@media (pointer: fine) {
  body { cursor: none; }
  a, button, .rw-nav__toggle, .rw-nav__close, .rw-sticker { cursor: none; }

  .custom-cursor {
    position: absolute;
    top: 0; left: 0;
    width: 14px;
    height: 14px;
    pointer-events: none;
    z-index: 100001;
    opacity: 0;
    transition: opacity 200ms ease;
    will-change: transform;
  }
  .custom-cursor-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #0066ff;
    transition: background 120ms ease, transform 120ms ease;
    box-shadow: 0 0 12px rgba(0, 102, 255, 0.45);
  }
  .custom-cursor.custom-cursor--link .custom-cursor-inner {
    transform: scale(1.6);
    background: #ffffff;
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.55);
  }
  .custom-cursor.clicking .custom-cursor-inner {
    transform: scale(0.7);
  }

  .cursor-trail {
    position: absolute;
    top: 0; left: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0066ff;
    pointer-events: none;
    z-index: 100000;
    opacity: 0;
    will-change: transform, opacity;
    mix-blend-mode: screen;
  }
}

@media (pointer: coarse), (prefers-reduced-motion: reduce) {
  body { cursor: auto; }
  .custom-cursor, .cursor-trail { display: none !important; }
}

/* ---------- Sticker (portfolio refresh note) ---------- */
.rw-sticker {
  position: fixed;
  left: clamp(16px, 68vw, calc(100vw - 360px));
  top: clamp(16px, 58vh, calc(100vh - 220px));
  z-index: 99998;
  /* keep solid color regardless of background */
  isolation: isolate;
  mix-blend-mode: normal;
  width: min(360px, calc(100vw - 40px));
  padding: 16px 18px 14px;
  background: var(--color-magenta);
  color: #fff;
  border-radius: 2px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  cursor: grab;
  user-select: none;
  font-family: var(--font-body);
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 14px, 0) scale(0.98);
}
.rw-sticker:active { cursor: grabbing; }
.rw-sticker.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
  transition: opacity 280ms ease, transform 420ms cubic-bezier(0.2, 1.0, 0.2, 1);
}
.rw-sticker__content { font-size: 14px; line-height: 1.35; }
.rw-sticker__content strong { font-weight: 700; }
.rw-sticker__content a {
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.16em;
  text-decoration-thickness: 2px;
}
.rw-sticker__content a:hover { opacity: 0.9; }
.rw-sticker__close {
  position: absolute;
  top: 6px; right: 8px;
  width: 26px; height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-size: 20px;
  line-height: 26px;
  cursor: pointer;
}
.rw-sticker__close:hover { color: #fff; }

@media (max-width: 768px) {
  .rw-sticker {
    left: 12px !important;
    right: 12px !important;
    top: auto !important;
    bottom: 16px !important;
    width: auto;
    max-width: none;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

/* ---------- Footer ---------- */
.rw-footer {
  background: #000;
  color: #fff;
  /* match horizontal margins of .rw-section */
  padding: var(--sp-50) clamp(20px, 3vw, 56px);
}
.rw-footer__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-30);
  max-width: 1400px; /* match .rw-panel max-width */
  margin: 0 auto;
}
@media (min-width: 720px) {
  .rw-footer__inner { grid-template-columns: 2fr 1fr 1fr; }
}
.rw-footer h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 1rem + 2vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
  max-width: 22ch;
  color: #fff;
}
.rw-footer h3 {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 0.6em;
  color: rgba(255, 255, 255, 0.6);
}
.rw-footer__big {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.1rem, 0.9rem + 1vw, 1.4rem);
  line-height: 1.35;
  margin: 0;
  color: #fff;
}
.rw-footer__big a { text-decoration: none; }
.rw-footer__big a:hover { text-decoration: underline; text-decoration-thickness: 2px; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
  .rw-reveal, .rw-reveal ul > li, .rw-line > span {
    opacity: 1 !important;
    transform: none !important;
  }
  .rw-marquee__track { animation: none !important; transform: none !important; }
  .rw-scroll-indicator { animation: none !important; }
}

/* ---------- Small-screen tweaks ---------- */
@media (max-width: 720px) {
  body { font-size: 18px; line-height: 28px; }
  .rw-section { padding: var(--sp-40) clamp(16px, 5vw, 28px); }
  .rw-footer  { padding: var(--sp-40) clamp(16px, 5vw, 28px); } /* keep parity */
  .rw-section p { font-size: 18px; line-height: 28px; }
  .rw-section ul { font-size: 18px; line-height: 28px; }
  .rw-hero__title { font-size: clamp(28px, 7.5vw, 40px); line-height: 1.2; }
  .rw-nav__list { font-size: clamp(1.4rem, 6vw, 2rem); }
}
