/* spgl.co — built from Figma "2027 spgl" / EXPORT / For Claude (node 415:1481) */

:root {
  --bg: #141414;
  --fg: #fff;
  --muted: 0.4;          /* secondary text opacity */
  --column: 460px;       /* text column width */
  --gap-section: 64px;   /* space between groups */
  --gap-row: 8px;        /* space between list rows */
  --pad-y: 100px;        /* top/bottom page padding and edge-blur height */
  --preview-gap: 16px;   /* space between cursor (or focused row) and preview */
  --preview: 260px;      /* hover thumbnail, square */

  color-scheme: dark;
}

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

html {
  background: var(--bg);
  /* keep keyboard focus and in-page scrolling clear of the edge blurs */
  scroll-padding-block: var(--pad-y);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/24px -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: from-font;
  text-underline-position: from-font;
  text-decoration-skip-ink: none;
}

/* only on devices that can hover: phones keep a tapped link "hovered",
   so it would stay dimmed after coming back from a new tab */
@media (hover: hover) {
  a:hover { opacity: 0.7; }
}

:focus-visible {
  outline: 1px solid var(--fg);
  outline-offset: 4px;
}

/* ---------- Layout ---------- */

.wrapper {
  width: min(var(--column), 100% - 32px);
  margin: 0 auto;
  padding: var(--pad-y) 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap-section);
  word-break: break-word;
}

.group {
  display: flex;
  flex-direction: column;
  gap: var(--gap-row);
}

header.group { gap: 0; }

.name { font: inherit; }  /* an h1 for structure, styled like body text */

.muted,
.label { opacity: var(--muted); }

.label {
  font: inherit;
  transition: opacity 0.15s ease;
}

/* ---------- Hero ---------- */

.hero {
  display: flex;
  flex-direction: column;
  gap: 36px;               /* one empty 36px line between paragraphs */
  font-size: 24px;
  line-height: 36px;
  /* no single word alone on a paragraph's last line (at 1440px the breaks
     already match Figma and don't change) */
  text-wrap: pretty;
}

/* ---------- Lists ---------- */

/* Rows have no gaps between them: the 8px spacing lives in each row's
   padding, so the hover area is continuous and doesn't flicker when the
   pointer moves from one row to the next. The negative margin keeps the
   overall layout identical to the Figma spacing. */
.list {
  list-style: none;
  display: flex;
  flex-direction: column;
  margin: calc(var(--gap-row) / -2) 0;
}

.item {
  position: relative;
  display: flex;
  gap: 8px;
  padding: calc(var(--gap-row) / 2) 0;
}

.item > span:not(.muted) { white-space: nowrap; }
.item > .muted { flex: 1 1 0; min-width: 1px; }

.year {
  flex: none;
  width: 92px;
  opacity: var(--muted);
  font-feature-settings: "cv08" 1;
  font-variant-numeric: tabular-nums;  /* digits line up down the column */
}

/* ---------- Featured Works hover previews ---------- */

.work {
  cursor: default;
  outline: none;
}

/* Dimming fades the row's text, not the row itself: the preview sits inside
   the row, so fading the row would fade the preview in with it. */
.work > span { transition: opacity 0.15s ease; }

.work:focus-visible > span:first-child {
  text-decoration: underline;
  text-underline-position: from-font;
}

/* hovering a work: dim the other works and brighten the section label.
   A dimmed row's title goes to 40% and its description, already at 40%,
   to 16% (40% of 40%). */
/* .is-scrolling (set by preview.js while the page scrolls) turns the whole
   hover state off until the mouse moves again. Hover only counts on devices
   that can hover; phones keep a tapped row "hovered", which would leave the
   other rows dimmed. */
@media (hover: hover) {
  .works:not(.is-scrolling):has(.work:hover) .work:not(:hover) > span { opacity: var(--muted); }
  .works:not(.is-scrolling):has(.work:hover) .work:not(:hover) > .muted { opacity: calc(var(--muted) * var(--muted)); }
  .works:not(.is-scrolling):has(.work:hover) .label { opacity: 1; }
}
.works:not(.is-scrolling):has(.work:focus-visible) .work:not(:focus-visible) > span { opacity: var(--muted); }
.works:not(.is-scrolling):has(.work:focus-visible) .work:not(:focus-visible) > .muted { opacity: calc(var(--muted) * var(--muted)); }
.works:not(.is-scrolling):has(.work:focus-visible) .label { opacity: 1; }

/* touch and hold: preview.js sets .is-peeking on .works and .is-peek on the
   row under the finger */
.works.is-peeking .work:not(.is-peek) > span { opacity: var(--muted); }
.works.is-peeking .work:not(.is-peek) > .muted { opacity: calc(var(--muted) * var(--muted)); }
.works.is-peeking .label { opacity: 1; }

/* touch screens: a long press peeks instead of selecting text or opening
   the callout menu */
@media (hover: none), (pointer: coarse) {
  .work {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }
}

/* The preview follows the cursor. static/js/preview.js sets --x/--y
   (top-left corner, in viewport pixels) on .works; it eases toward the
   pointer so the image trails slightly behind it. */
.preview {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--preview);
  height: var(--preview);
  overflow: hidden;        /* clips the image to the rounded corners */
  translate: var(--x, -9999px) var(--y, -9999px);
  scale: 0.96;
  rotate: var(--tilt, 0deg); /* sway, set by preview.js */
  border-radius: 16px;
  opacity: 0;
  filter: blur(12px);      /* comes into focus as it fades in */
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.3s cubic-bezier(0.2, 0, 0, 1),
    scale 0.3s cubic-bezier(0.2, 0, 0, 1),
    filter 0.4s cubic-bezier(0.2, 0, 0, 1),
    visibility 0.3s;
  transform-origin: center;  /* sway and grow-in pivot on the middle */
  z-index: 3;              /* above the edge blur, as in Figma */
}

.works:not(.is-scrolling) .work:focus-visible .preview,
.works.is-peeking .work.is-peek .preview {
  opacity: 1;
  scale: 1;
  filter: none;
  visibility: visible;
}

@media (hover: hover) {
  .works:not(.is-scrolling) .work:hover .preview {
    opacity: 1;
    scale: 1;
    filter: none;
    visibility: visible;
  }
}

/* moving from one row to the next swaps the preview instantly; only the
   first one blurs in and the last one blurs out (preview.js sets this) */
.works.is-switching .preview { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .preview { scale: 1; filter: none; transition: none; }
}

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

/* credit tag in the bottom-right corner: a dark frosted pill, so the
   white text stays readable over light or busy images */
.credit {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgb(20 20 20 / 0.6);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 12px;
  line-height: 16px;
  white-space: nowrap;     /* one line, even when "Image:" is translated */
}

/* ---------- Edge blurs (top and bottom of the viewport) ----------
   Progressive blur: five stacked layers, each blurring twice as much as
   the last and masked to its own band, so the blur ramps up smoothly
   from 0 at the inner edge to 10px at the window edge. */

.edge-blur {
  position: fixed;
  left: 0;
  right: 0;
  height: var(--pad-y);
  pointer-events: none;
  z-index: 2;
}

.edge-blur--top    { top: 0;    --dir: to top; }    /* blurriest at the top */
.edge-blur--bottom { bottom: 0; --dir: to bottom; } /* blurriest at the bottom */

.edge-blur > div {
  position: absolute;
  inset: 0;
  -webkit-backdrop-filter: blur(var(--b));
  backdrop-filter: blur(var(--b));
  -webkit-mask-image: linear-gradient(var(--dir), var(--m));
  mask-image: linear-gradient(var(--dir), var(--m));
}

.edge-blur > div:nth-child(1) { --b: 0.625px; --m: transparent 0%, #000 20%, #000 40%, transparent 60%; }
.edge-blur > div:nth-child(2) { --b: 1.25px;  --m: transparent 20%, #000 40%, #000 60%, transparent 80%; }
.edge-blur > div:nth-child(3) { --b: 2.5px;   --m: transparent 40%, #000 60%, #000 80%, transparent 100%; }
.edge-blur > div:nth-child(4) { --b: 5px;     --m: transparent 60%, #000 80%, #000 100%; }
.edge-blur > div:nth-child(5) { --b: 10px;    --m: transparent 80%, #000 100%; }

/* ---------- Email: "Copy email" / "Copied" label ----------
   Follows the cursor like the previews (preview.js sets --x/--y/--tilt on
   it) and blurs into focus the same way. A frosted pill, so it stays
   readable over text. */

.email-link { cursor: pointer; }

.cursor-label {
  position: fixed;
  top: 0;
  left: 0;
  translate: var(--x, -9999px) var(--y, -9999px);
  scale: 0.96;
  rotate: var(--tilt, 0deg);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
  opacity: 0;
  filter: blur(12px);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.3s cubic-bezier(0.2, 0, 0, 1),
    scale 0.3s cubic-bezier(0.2, 0, 0, 1),
    filter 0.4s cubic-bezier(0.2, 0, 0, 1),
    visibility 0.3s;
  transform-origin: center;
  z-index: 3;              /* above the edge blur, like the previews */
}

.cursor-label.is-visible {
  opacity: 1;
  scale: 1;
  filter: none;
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .cursor-label { scale: 1; filter: none; transition: none; }
}

/* for screen readers only: announces "Email address copied" */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Copy that depends on the device ----------
   Mouse devices see .on-hover text, touch screens see .on-touch text. */

.on-touch { display: none; }

@media (hover: none) {
  .on-hover { display: none; }
  .on-touch { display: inline; }
}

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  :root { --pad-y: 64px; }

  .hero {
    font-size: 20px;
    line-height: 30px;
    gap: 30px;
  }

  /* let long descriptions drop below the title instead of squeezing */
  .item { flex-wrap: wrap; column-gap: 8px; row-gap: 0; }
  .item > .muted { flex-basis: auto; }

  /* Featured Works: the description always gets its own line, so every
     row has the same shape whether or not it would have fit */
  .work > .muted { flex-basis: 100%; }
}

/* ---------- Load-in: text blurs into focus, top to bottom ----------
   Each line/row gets an index --i (set by the script at the end of
   index.html) and starts 60ms after the one above it. The animation only
   has a `from` state and fills backwards, so once it ends every element
   is back to its normal styles (hover dimming etc. are unaffected).
   List rows animate their text spans rather than the row itself, so the
   row never gets a filter that would throw off the fixed hover preview. */

@keyframes focus-in {
  from {
    opacity: 0;
    filter: blur(12px);
    translate: 0 12px;
  }
}

header.group > *,
.hero > p,
.label,
.group > p,
.item > span {
  animation: focus-in 1.4s cubic-bezier(0.19, 1, 0.22, 1) backwards;
  animation-delay: calc(var(--i, 0) * 60ms + 100ms);
}

@media (prefers-reduced-motion: reduce) {
  header.group > *,
  .hero > p,
  .label,
  .group > p,
  .item > span { animation: none; }
}
