/* ============================================================
   Benedikt Faber — Portfolio
   shared.css — variables, reset, base, nav, footer
   Loaded on every page before page-specific styles.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

:root {
  /* Palette is in OKLCH so neutrals share a warm hue family with the
     cream background. No pure black, no pure white — every surface
     carries a trace of the brand temperature. */
  --color-accent:       oklch(57.5% 0.18 32);     /* vermilion */
  --color-accent-soft:  oklch(57.5% 0.18 32 / 0.14);
  --color-dark:         oklch(23% 0.04 262);      /* deep navy */
  --color-bg:           oklch(96% 0.008 70);      /* warm cream */
  --color-bg-tinted:    oklch(93% 0.008 70);      /* deeper cream */
  --color-white:        oklch(99% 0.004 70);      /* warm near-white, never pure */
  --color-text:         oklch(19% 0.005 60);      /* near-black, warm */
  --color-muted:        oklch(45% 0.008 65);      /* muted warm gray */
  --color-footer-text:  oklch(96% 0.008 70);      /* same as bg */
  --color-footer-muted: oklch(67% 0.025 270);     /* cool gray-blue on navy */
  --color-border:       oklch(89% 0.008 65);      /* hairline */
  --color-dark-border:  oklch(26.5% 0.055 262);   /* navy hairline */

  /* Easing — stronger curves than default `ease` for intentional motion.
     Sourced from animations.dev. */
  --ease-out-soft:      cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out-strong: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer:        cubic-bezier(0.32, 0.72, 0, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  background: var(--color-bg);
  color: var(--color-text);
  padding-top: 56px;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.25s ease;
}

button {
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

/* ============================================================
   FOCUS-VISIBLE SYSTEM
   The desktop custom cursor uses `cursor: none`, so without a
   keyboard-visible focus ring the entire site is invisible to
   tab-navigators. Vermilion ring on light surfaces, cream ring on
   dark. Offset clears the rounded affordances so it reads as a
   halo, not a stamp.
   ============================================================ */

:focus {
  outline: none;
}

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

nav :focus-visible,
.nav-overlay :focus-visible,
.footer :focus-visible,
.hero :focus-visible,
.cs-section.bg-dark :focus-visible {
  outline-color: var(--color-footer-text);
}

.work-card:focus-visible,
.work-feature:focus-visible {
  outline-offset: 6px;
}

/* ============================================================
   NAV
   Hamburger-only on every viewport.
   ============================================================ */

nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--color-dark);
  z-index: 300;
}

.nav-inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 48px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--color-footer-text);
  text-decoration: none;
  line-height: 1;
  transition: color 0.25s ease;
}

.nav-logo:hover {
  color: var(--color-accent);
}

.nav-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 48px;
  height: 48px;
  position: relative;
  z-index: 300;
}

.nav-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-footer-text);
  border-radius: 1px;
  transform-origin: center;
  transition: transform 280ms var(--ease-out-soft),
              opacity 280ms var(--ease-out-soft),
              background 220ms var(--ease-out-soft);
}

.nav-hamburger:hover span {
  background: var(--color-accent);
}

.nav-hamburger.is-open span:first-child {
  transform: translateY(5px) rotate(45deg);
}

.nav-hamburger.is-open span:last-child {
  transform: translateY(-5px) rotate(-45deg);
}

.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background: var(--color-dark);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  /* Always rendered, hidden via opacity so it can transition. */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 260ms var(--ease-out-soft),
              visibility 0ms linear 260ms;
}

.nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 260ms var(--ease-out-soft),
              visibility 0ms linear 0ms;
}

.nav-overlay-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  padding: 0;
  margin: 0;
}

.nav-overlay-links a {
  display: inline-block;
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 36px;
  color: var(--color-footer-text);
  text-decoration: none;
  /* Each link starts shifted + faded; on .is-open they cascade in. */
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 280ms var(--ease-out-soft),
              transform 320ms var(--ease-out-soft),
              color 220ms var(--ease-out-soft);
}

.nav-overlay.is-open .nav-overlay-links a {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger the cascade — small, deliberate delays. */
.nav-overlay.is-open .nav-overlay-links li:nth-child(1) a { transition-delay: 80ms; }
.nav-overlay.is-open .nav-overlay-links li:nth-child(2) a { transition-delay: 140ms; }
.nav-overlay.is-open .nav-overlay-links li:nth-child(3) a { transition-delay: 200ms; }

.nav-overlay-links a:hover {
  color: var(--color-accent);
}

.nav-overlay-links a.active {
  text-decoration: underline;
  text-decoration-color: var(--color-accent);
  text-underline-offset: 6px;
}

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  background: var(--color-dark);
  padding: 100px 48px 72px;
  width: 100%;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-headline {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(32px, 5vw, 64px);
  color: var(--color-footer-text);
  line-height: 1.1;
}

.footer-subhead {
  margin-top: 20px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 17px;
  color: var(--color-footer-muted);
  line-height: 1.55;
}

.footer-contacts {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-contact-link {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: clamp(28px, 3.5vw, 44px);
  color: var(--color-footer-text);
  text-decoration: none;
  line-height: 1.3;
  transition: color 0.25s ease;
  width: fit-content;
}

.footer-contact-link:hover {
  color: var(--color-accent);
}

.footer-bottom {
  max-width: 1200px;
  margin: 72px auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--color-dark-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-copy {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: 14px;
  color: var(--color-footer-muted);
}


/* ============================================================
   RESPONSIVE — nav + footer only
   ============================================================ */

@media (max-width: 1024px) {
  .nav-inner {
    padding: 0 32px;
  }
  .footer {
    padding-left: 32px;
    padding-right: 32px;
  }
}

@media (max-width: 768px) {
  .nav-inner {
    padding: 0 24px;
  }

  .footer {
    padding: 80px 24px 56px;
  }

  .footer-inner {
    flex-direction: column;
    gap: 48px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .scroll-top {
    right: 20px;
    bottom: 20px;
    width: 44px;
    height: 44px;
  }
}

/* ============================================================
   CUSTOM CURSOR (desktop only — disabled on touch devices)
   ============================================================ */

@media (pointer: fine) {
  body,
  a,
  button,
  label,
  input,
  textarea,
  select,
  .work-card,
  .work-feature,
  .nav-hamburger,
  .nav-logo,
  .scroll-top,
  .video-frame {
    cursor: none;
  }
}

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  /* Solid cursor; the colour switches by surface (see .surface-* below).
     Default = dark blue for light/cream/white surfaces. */
  background: var(--color-dark);
  border: 2px solid transparent;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  will-change: transform;
  transition: opacity 200ms var(--ease-out-soft),
              width 220ms var(--ease-out-soft),
              height 220ms var(--ease-out-soft),
              margin 220ms var(--ease-out-soft),
              background-color 200ms var(--ease-out-soft),
              border-color 200ms var(--ease-out-soft);
}

/* Center dot — invisible by default, fades in on hover */
.cursor::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-dark);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 200ms var(--ease-out-soft),
              background-color 200ms var(--ease-out-soft);
}

/* Orange surface (hero) → white cursor */
.cursor.surface-orange {
  background: var(--color-white);
}

.cursor.surface-orange::after {
  background: var(--color-white);
}

/* Dark surfaces (nav, footer, bg-dark sections, overlay) → orange cursor */
.cursor.surface-dark {
  background: var(--color-accent);
}

.cursor.surface-dark::after {
  background: var(--color-accent);
}

.cursor.is-active {
  opacity: 1;
}

/* Hover state — circle becomes a ring with a center dot. Size grows.
   Hover color mapping:
     • light/white/cream surfaces → orange
     • orange hero                → orange (matches the surface accent)
     • dark surfaces              → white */
.cursor.is-hover {
  width: 64px;
  height: 64px;
  margin: -16px 0 0 -16px;
  background: transparent;
  border-color: var(--color-accent);
}

.cursor.is-hover::after {
  background: var(--color-accent);
  opacity: 1;
}

/* Play-triangle icon child — used over video frames. Rounded corners
   come from stroke-linejoin: round on the SVG path, which the JS
   injects on cursor creation. Cream color regardless of surface so
   the cursor reads consistently against the dark video scrim. */
.cursor-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 18px;
  transform: translate(-50%, -50%);
  color: var(--color-footer-text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease-out-soft);
}

/* Video-hover state is self-sufficient — defines its own ring growth +
   cream border so the cursor stays correct even when the underlying
   overlay button flips to display:none on play (which fires mouseleave
   on the button and would otherwise strip .is-hover). */
.cursor.is-video-hover {
  width: 64px;
  height: 64px;
  margin: -16px 0 0 -16px;
  background: transparent;
  border-color: var(--color-footer-text);
}

.cursor.is-video-hover .cursor-play {
  opacity: 1;
}

/* When the play triangle is showing, hide the center dot. */
.cursor.is-video-hover::after {
  opacity: 0;
}

.cursor.is-hover.surface-dark {
  border-color: var(--color-white);
}

.cursor.is-hover.surface-dark::after {
  background: var(--color-white);
}

/* Click state — shrinks back to the non-hover 32px size while
   keeping the ring + center-dot style. Triggered on any mousedown. */
.cursor.is-click {
  width: 32px;
  height: 32px;
  margin: 0;
  background: transparent;
  border-color: var(--color-accent);
}

.cursor.is-click::after {
  background: var(--color-accent);
  opacity: 1;
}

.cursor.is-click.surface-dark {
  border-color: var(--color-white);
}

.cursor.is-click.surface-dark::after {
  background: var(--color-white);
}

/* Click state over a video frame: ring shrinks to the normal 32px click
   size with cream border, the play triangle fades out. The ring with
   nothing inside is the press feedback. The ::after dot stays hidden
   (reserved for regular-hover states on non-video surfaces). */
.cursor.is-video-hover.is-click {
  width: 32px;
  height: 32px;
  margin: 0;
  border-color: var(--color-footer-text);
}

.cursor.is-video-hover.is-click::after {
  opacity: 0;
}

.cursor.is-video-hover.is-click .cursor-play {
  opacity: 0;
}

.cursor.is-video-hover.is-click .cursor-play {
  opacity: 0;
}

/* ============================================================
   SCROLL-TO-TOP BUTTON
   ============================================================ */

.scroll-top {
  position: fixed;
  right: 32px;
  bottom: 32px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-dark);
  color: var(--color-footer-text);
  border: 1.5px solid var(--color-footer-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 260ms var(--ease-out-soft),
              transform 220ms var(--ease-out-soft),
              background 220ms var(--ease-out-soft),
              border-color 220ms var(--ease-out-soft),
              visibility 0s linear 260ms;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 260ms var(--ease-out-soft),
              transform 220ms var(--ease-out-soft),
              background 220ms var(--ease-out-soft),
              border-color 220ms var(--ease-out-soft),
              visibility 0s linear 0s;
}

.scroll-top:hover {
  background: var(--color-accent);
}

/* Press feedback — fast, instant confirmation that the button heard the user. */
.scroll-top.visible:active {
  transform: translateY(0) scale(0.92);
  transition: transform 110ms var(--ease-out-soft),
              background 220ms var(--ease-out-soft);
}

.scroll-top svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* ============================================================
   SCROLL REVEAL
   Elements with .reveal start slightly faded + offset. JS adds
   .is-visible via IntersectionObserver when they enter the viewport
   so they settle into place with intentional motion.
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1100ms var(--ease-out-soft),
              transform 1100ms var(--ease-out-soft);
  will-change: transform, opacity;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger — small delays cascade items in a list so they land
   sequentially rather than all at once. */
.work-grid > .reveal.is-visible:nth-child(1) { transition-delay: 0ms; }
.work-grid > .reveal.is-visible:nth-child(2) { transition-delay: 80ms; }
.work-grid > .reveal.is-visible:nth-child(3) { transition-delay: 160ms; }
.work-grid > .reveal.is-visible:nth-child(4) { transition-delay: 240ms; }

.cv-list > .reveal.is-visible:nth-child(1) { transition-delay: 0ms; }
.cv-list > .reveal.is-visible:nth-child(2) { transition-delay: 70ms; }
.cv-list > .reveal.is-visible:nth-child(3) { transition-delay: 140ms; }
.cv-list > .reveal.is-visible:nth-child(4) { transition-delay: 210ms; }

.process-flow > .reveal.is-visible:nth-child(1) { transition-delay: 0ms; }
.process-flow > .reveal.is-visible:nth-child(3) { transition-delay: 80ms; }
.process-flow > .reveal.is-visible:nth-child(5) { transition-delay: 160ms; }
.process-flow > .reveal.is-visible:nth-child(7) { transition-delay: 240ms; }
.process-flow > .reveal.is-visible:nth-child(9) { transition-delay: 320ms; }

.persona-attrs > .reveal.is-visible:nth-child(1) { transition-delay: 0ms; }
.persona-attrs > .reveal.is-visible:nth-child(2) { transition-delay: 90ms; }
.persona-attrs > .reveal.is-visible:nth-child(3) { transition-delay: 180ms; }

.problem-stats > .reveal.is-visible:nth-child(1) { transition-delay: 0ms; }
.problem-stats > .reveal.is-visible:nth-child(2) { transition-delay: 90ms; }
.problem-stats > .reveal.is-visible:nth-child(3) { transition-delay: 180ms; }

/* Reduced motion — content is shown immediately, decorative motion
   is paused. Functional transitions degrade to instant. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal,
  .reveal.is-visible {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .nav-overlay,
  .nav-overlay-links a {
    transition: opacity 100ms linear;
  }

  /* The marquee is the loudest motion on the page. Park it. */
  .marquee-track {
    animation: none;
  }

  /* Hover-lift transforms on tiles. */
  .work-card,
  .work-feature,
  .work-card:hover,
  .work-card:active,
  .work-feature:hover,
  .work-feature:active,
  .cv-item,
  .cv-item:hover,
  .cv-item:active,
  .video-frame,
  .video-frame:hover,
  .video-frame:active {
    transition: color 220ms linear, border-color 220ms linear;
    transform: none;
  }

  .scroll-top,
  .scroll-top.visible {
    transform: none;
    transition: opacity 120ms linear, visibility 0s linear;
  }

  .cursor {
    transition: opacity 120ms linear;
  }
}
