/* =========================================================================
   Michael Spear — Portfolio
   Design tokens + base styles
   ========================================================================= */

:root {
  /* Color */
  --ink: #1A1A18;          /* headings */
  --body-text: #47463F;    /* body copy */
  --muted: #6E6C64;        /* meta text, dates, labels */
  --line: #E4E2DD;         /* dividers */
  --line-strong: #C9C6BF;  /* borders on cards/tags */
  --accent: #3D5A45;       /* forest green — links, emphasis */
  --tag-bg: rgba(61, 90, 69, 0.08); /* pill tag background */
  --bg: #FAFAF8;

  /* Type */
  --font: "Source Serif 4", Georgia, "Times New Roman", serif;

  /* Layout */
  --content-width: 720px;
  --section-pad: 160px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Respect browser zoom */
html {
  font-size: 100%;
  scroll-behavior: smooth;
  /* proximity (not mandatory): sections still snap into place when you come
     to rest near their start, but you can scroll freely through sections
     taller than the viewport — no getting trapped before the gallery. */
  scroll-snap-type: y proximity;
  /* keep snap/anchor targets clear of the fixed top nav */
  scroll-padding-top: 56px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.875rem;      /* 14px base */
  line-height: 1.7;
  font-weight: 400;
  color: var(--body-text);
  background-color: var(--bg);
  /* subtle two-layer gradient: radial wash over vertical gradient */
  background-image:
    radial-gradient(120% 60% at 50% 0%, rgba(61, 90, 69, 0.045), transparent 60%),
    linear-gradient(180deg, #FBFBF9 0%, #F4F3EF 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* =========================================================================
   Top navigation
   ========================================================================= */

.topnav {
  position: sticky;
  top: 0;
  z-index: 200;
  background-color: rgba(250, 250, 248, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid transparent;
}

.topnav__inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 24px;
  display: flex;
  gap: 24px;
}

.topnav__link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.topnav__link:hover {
  color: var(--ink);
  opacity: 1;
}

/* =========================================================================
   Layout primitives
   ========================================================================= */

.section {
  scroll-snap-align: start;
  padding: var(--section-pad) 24px;
}

.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
}

/* =========================================================================
   Typography
   ========================================================================= */

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

p {
  margin: 0 0 1.25rem;
}

p:last-child {
  margin-bottom: 0;
}

/* Real link — accent-green underline */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: opacity 0.2s var(--ease);
}

a:hover {
  opacity: 0.7;
}

/* Inline body link — accent, underline, medium weight; darkens on hover */
.link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.link:hover {
  color: var(--ink);
  opacity: 1;
}

/* Pet name — dotted-underline affordance that reveals a photo on hover/focus */
.pet {
  position: relative;
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  cursor: pointer;
  outline: none;
}

.pet__photo {
  position: absolute;
  left: 50%;
  bottom: 100%;
  margin-bottom: 8px;
  width: 168px;
  height: 168px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 34px -10px rgba(26, 26, 24, 0.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 6px) scale(0.96);
  transform-origin: bottom center;
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease),
    visibility 0s linear 0.18s;
  z-index: 50;
}

/* Shown state — via JS toggle (.is-open, used for touch) or keyboard focus */
.pet.is-open .pet__photo,
.pet:focus-visible .pet__photo {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0) scale(1);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease),
    visibility 0s;
}

/* Mouse hover reveal — only on devices that actually hover, so touch taps
   don't leave a sticky hovered photo that can't be dismissed. */
@media (hover: hover) {
  .pet:hover .pet__photo {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0) scale(1);
    transition: opacity 0.18s var(--ease), transform 0.18s var(--ease),
      visibility 0s;
  }
}

.pet:focus-visible {
  color: var(--ink);
}

/* Inline emphasis — bold + underline, ink color (distinct from links) */
.hl {
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* =========================================================================
   About / Hero
   ========================================================================= */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  padding-top: 24px;
  padding-bottom: 24px;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 2rem;
}

.hero__body {
  font-size: 1.0625rem;   /* 17px — slightly larger for hero readability */
  line-height: 1.75;
  color: var(--body-text);
}

/* =========================================================================
   Section divider (Work)
   ========================================================================= */

.divider {
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 40px 24px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--line);
}

.divider__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* =========================================================================
   Case study
   ========================================================================= */

.case__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.case h2 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
}

.case__body {
  font-size: 0.9375rem;   /* 15px */
  line-height: 1.75;
}

.case__gallery {
  margin-top: 48px;
}

/* Pull-stat / callout emphasis line */
.case__stat {
  color: var(--ink);
  font-weight: 600;
}

/* =========================================================================
   Tag pills
   ========================================================================= */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  background-color: var(--tag-bg);
  color: var(--accent);
  font-size: 0.6875rem;    /* 11px */
  font-weight: 500;
  line-height: 1.4;
}

/* =========================================================================
   Spotlight gallery
   ========================================================================= */

.gallery__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
}

/* Portrait capture (e.g. a side panel) — centered floating panel,
   sized by height so the whole panel stays on screen */
.gallery__stage--panel {
  width: auto;
  height: min(78vh, 680px);
  margin-left: auto;
  margin-right: auto;
}

.gallery__stage-item {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

/* Screenshots ship with their own shadow + corners baked in — show them whole */
img.gallery__stage-item {
  object-fit: contain;
}

/* Screen-recording videos fill the frame edge to edge.
   Images carry their own baked-in shadow; videos get a matching one here. */
video.gallery__stage-item {
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 18px 40px -12px rgba(26, 26, 24, 0.24);
}

.gallery__stage-item.is-active {
  opacity: 1;
}

/* Tap-to-play overlay — shown while the active video is paused */
.gallery__stage.has-video {
  cursor: pointer;
}

.gallery__stage-play {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* taps pass through to the stage's play handler */
  z-index: 10;
}

.gallery__stage.has-video.is-paused .gallery__stage-play {
  display: flex;
}

.gallery__stage-play::before {
  content: "";
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background-color: rgba(26, 26, 24, 0.55);
}

.gallery__stage-play::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #fafaf8;
  margin-left: 5px; /* optically center the triangle in the circle */
}

/* Placeholder box */
.gallery__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #EAE9E3;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.gallery__peeks {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.gallery__peek {
  position: relative;
  width: 64px;
  height: 64px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background-color: #EAE9E3;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.gallery__peek img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery__peek.is-active {
  border-color: var(--accent);
  border-width: 2px;
}

.gallery__peek:hover {
  transform: translateY(-2px);
}

/* Play icon overlay for video peeks */
.gallery__peek--video::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform: translate(-40%, -50%);
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #FFFFFF;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

.gallery__peek--video::before {
  content: "";
  position: absolute;
  inset: 0;
  background-color: rgba(26, 26, 24, 0.28);
  z-index: 0;
}

/* =========================================================================
   Sign-off
   ========================================================================= */

.signoff {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.signoff__title {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 32px;
}

.signoff__links {
  display: flex;
  justify-content: center;
  gap: 40px;
}

.signoff__link {
  color: var(--body-text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.signoff__link:hover {
  color: var(--ink);
  opacity: 1;
}

/* =========================================================================
   Dot tracker
   ========================================================================= */

.tracker {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;                 /* zones abut — seamless vertical handoff */
  padding-right: 28px;
}

/* The button is a large invisible hit zone; the visible dot is its ::before.
   Zones are tall (touch vertically) and wide (extend left) so hover activates
   as the cursor scans near the rail, not only dead-on the dot. */
.tracker__dot {
  position: relative;
  display: block;
  width: 120px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.tracker__dot::before {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--line-strong);
  transition: background-color 0.3s var(--ease), transform 0.3s var(--ease);
}

.tracker__dot:hover::before {
  background-color: var(--muted);
}

.tracker__dot.is-active::before {
  background-color: var(--accent);
  transform: translateY(-50%) scale(1.5);
}

/* Keep the focus ring on the visible dot, not the wide hit zone */
.tracker__dot:focus-visible {
  outline: none;
}

.tracker__dot:focus-visible::before {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Label — plain muted text just left of the dot, shown on hover/focus/active */
.tracker__dot::after {
  content: attr(data-label);
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, font-size 0.2s var(--ease), color 0.2s ease;
}

.tracker__dot:hover::after,
.tracker__dot:focus-visible::after,
.tracker__dot.is-active::after {
  opacity: 1;
}

/* Selected section — larger label (weight/color unchanged) */
.tracker__dot.is-active::after {
  font-size: 1rem;
}

@media (max-width: 900px) {
  .tracker {
    display: none;
  }
}

/* =========================================================================
   Accessibility
   ========================================================================= */

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
    scroll-snap-type: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* =========================================================================
   Responsive
   ========================================================================= */

@media (max-width: 640px) {
  :root {
    --section-pad: 96px;
  }

  .hero__body {
    font-size: 1rem;
  }
}
