/* ---------------------------------------------------------
   Sam Griffiths — minimal personal site
   Palette: warm paper background, deep ink text, terracotta accent
   Type: Space Grotesk (titles) / Source Serif 4 (body)
--------------------------------------------------------- */

:root {
  --bg: #f6f5f1;
  --ink: #20241f;
  --ink-soft: #565a4f;
  --accent: #b5502f;
  --accent-soft: rgba(181, 80, 47, 0.1);
  --line: #dcdad0;
  --shine: #fff6df;
  --shadow: 0 20px 40px -24px rgba(32, 36, 31, 0.28);
  --entry-hover-bg: rgba(181, 80, 47, 0.05);
  --card-shine: rgba(255, 255, 255, 0.55);
  --surface: #fffdf8;
  --scrim: rgba(32, 28, 22, 0.5);
  --code-bg: #211d1a;
  --code-ink: #eee;
  --max-width: 1200px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a17;
    --ink: #eae8e1;
    --ink-soft: #a4a99c;
    --accent: #e2916a;
    --accent-soft: rgba(226, 145, 106, 0.14);
    --line: #34372f;
    --shine: #ffd76a;
    --shadow: 0 20px 40px -24px rgba(0, 0, 0, 0.6);
    --entry-hover-bg: rgba(226, 145, 106, 0.08);
    --card-shine: rgba(255, 255, 255, 0.1);
    --surface: #232019;
    --scrim: rgba(0, 0, 0, 0.62);
    --code-bg: #14120f;
    --code-ink: #dcdfd6;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1c1a17;
  --ink: #eae8e1;
  --ink-soft: #a4a99c;
  --accent: #e2916a;
  --accent-soft: rgba(226, 145, 106, 0.14);
  --line: #34372f;
  --shine: #ffd76a;
  --shadow: 0 20px 40px -24px rgba(0, 0, 0, 0.6);
  --entry-hover-bg: rgba(226, 145, 106, 0.08);
  --card-shine: rgba(255, 255, 255, 0.1);
  --surface: #232019;
  --scrim: rgba(0, 0, 0, 0.62);
  --code-bg: #14120f;
  --code-ink: #dcdfd6;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

/* Forced, temporary fade during an explicit theme switch */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease),
    border-color 0.35s var(--ease), box-shadow 0.35s var(--ease),
    fill 0.35s var(--ease), stroke 0.35s var(--ease) !important;
}

h1, h2, h3 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 0.4em;
}

/* Animated underline links — background-size wipe, works inline */
a {
  color: var(--accent);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  padding-bottom: 1px;
  transition: background-size 0.4s var(--ease), color 0.3s var(--ease);
}
a:hover, a:focus {
  background-size: 100% 1px;
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Reveal-on-scroll: hidden only when JS has confirmed it can restore them */
.js .hero,
.js .home-section,
.js .list-page,
.js .single-header,
.js .single-content,
.js .entry-list .entry,
.js .showcase-item,
.js .page-hero,
.js .product-page,
.js .card-grid .card {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.js .hero.in-view,
.js .home-section.in-view,
.js .list-page.in-view,
.js .single-header.in-view,
.js .single-content.in-view,
.js .entry-list .entry.in-view,
.js .showcase-item.in-view,
.js .page-hero.in-view,
.js .product-page.in-view,
.js .card-grid .card.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Wipe-in dividers */
@keyframes wipeIn {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.site-header,
.hero,
.single-header,
.page-hero,
.site-footer {
  position: relative;
}
.site-header::after,
.hero::after,
.single-header::after,
.page-hero::after,
.site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
  transform-origin: left;
  animation: wipeIn 0.9s var(--ease) 0.15s both;
}
.site-header::after { bottom: 0; }
.hero::after { bottom: 0; }
.single-header::after { bottom: 0; }
.page-hero::after { bottom: 0; }
.site-footer::before { top: 0; }

/* Header */
.site-header {
  border-bottom: none;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 28px 24px;
}
.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 0;
  background-image: none;
}
.site-name {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  background: linear-gradient(100deg, var(--ink) 35%, var(--shine) 50%, var(--ink) 65%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: background-position 1s var(--ease);
}
.site-brand:hover .site-name {
  background-position: -40% 0;
}
.site-logo {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  transition: border-color 0.4s var(--ease), transform 0.4s var(--ease);
}
.site-brand:hover .site-logo {
  border-color: var(--accent);
  transform: scale(1.05);
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  /* Anchor for the dropdown panel once it goes full-width on small screens */
  position: relative;
}
.site-nav a {
  font-family: var(--sans);
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.site-nav a.is-active {
  color: var(--ink);
  background-size: 100% 1px;
}

/* Contact dropdown — hover on pointer devices, tap/Enter everywhere else */
.nav-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}
.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0 0 1px;
  border: 0;
  background: none;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: inherit;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.3s var(--ease);
}
.nav-dropdown-toggle:hover,
.nav-dropdown.is-open .nav-dropdown-toggle {
  color: var(--ink);
}
.nav-dropdown-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.nav-dropdown-panel {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 40;
  min-width: 268px;
  /* Bridges the gap under the toggle so the pointer can travel into the panel */
  padding-top: 12px;
  opacity: 0;
  visibility: hidden;
  translate: 0 -6px;
  transition: opacity 0.3s var(--ease), translate 0.3s var(--ease),
    visibility 0s linear 0.3s;
}
.nav-dropdown.is-open .nav-dropdown-panel {
  opacity: 1;
  visibility: visible;
  translate: 0 0;
  transition-delay: 0s;
}
.nav-dropdown-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 11px;
  border-radius: 8px;
  background-image: none;
  color: var(--ink);
  transition: background-color 0.25s var(--ease);
}
.nav-dropdown-item:hover,
.nav-dropdown-item:focus {
  background-color: var(--entry-hover-bg);
  background-size: 0 1px;
}
.nav-dropdown-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-dropdown-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.nav-dropdown-label {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--ink);
}
.nav-dropdown-value {
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

@media (hover: hover) and (pointer: fine) {
  .nav-dropdown:hover .nav-dropdown-panel {
    opacity: 1;
    visibility: visible;
    translate: 0 0;
    transition-delay: 0s;
  }
  .nav-dropdown:hover .nav-dropdown-toggle {
    color: var(--ink);
  }
}

/* Hero */
.hero {
  padding: 88px 0 52px;
  margin-bottom: 44px;
}
.hero-title {
  font-size: 4.4rem;
  line-height: 1.02;
  margin: 0 auto 0.2em;
  display: block;
  width: fit-content;
  text-align: center;
  background-image: linear-gradient(100deg, var(--ink) 40%, var(--shine) 50%, var(--ink) 60%);
  background-size: 250% 100%;
  background-position: 130% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shineText 1.8s var(--ease) 0.5s 1 forwards;
}
@keyframes shineText {
  to { background-position: -30% 0; }
}
.hero-tagline {
  font-family: var(--sans);
  color: var(--ink-soft);
  font-size: 1.02rem;
  max-width: 46ch;
}
.hero-body {
  margin-top: 20px;
}

/* Marquee — scrolling list of roles */
.marquee {
  margin-top: 22px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.marquee-track {
  display: flex;
  align-items: center;
  width: max-content;
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  animation: marqueeScroll 22s linear infinite;
}
.marquee-item {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  color: var(--ink-soft);
  padding: 0 14px;
}
.marquee-sep {
  display: flex;
  align-items: center;
  padding: 0 4px;
}
.marquee-sep::before {
  content: "";
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
@keyframes marqueeScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Home sections */
.home-section {
  margin-bottom: 48px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h2 {
  font-size: 1.2rem;
}
.see-all {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* Entry lists (blog + portfolio) */
.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.entry {
  position: relative;
  overflow: hidden;
  padding: 18px 16px;
  margin: 0 -16px;
  border-bottom: 1px solid var(--line);
  border-radius: 6px;
  transition: background-color 0.4s var(--ease), transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.entry:first-child {
  padding-top: 18px;
}
.entry::before {
  content: "";
  position: absolute;
  top: 0;
  left: -30%;
  width: 26%;
  height: 100%;
  background: linear-gradient(100deg, transparent, var(--card-shine) 50%, transparent);
  transform: skewX(-18deg) translateX(0%);
  opacity: 0;
  pointer-events: none;
}
.entry:hover {
  background-color: var(--entry-hover-bg);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.entry:hover::before {
  animation: cardShine 1s var(--ease) forwards;
}
@keyframes cardShine {
  0% { opacity: 1; transform: skewX(-18deg) translateX(0%); }
  100% { opacity: 1; transform: skewX(-18deg) translateX(560%); }
}
.entry-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink);
  display: inline-block;
}
.entry-title::after {
  content: "\2192";
  display: inline-block;
  margin-left: 6px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.entry:hover .entry-title::after {
  opacity: 1;
  transform: translateX(0);
}
.entry-date {
  display: block;
  font-family: var(--sans);
  color: var(--ink-soft);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  margin-top: 2px;
}
.entry-summary {
  margin: 8px 0 0;
  color: var(--ink-soft);
  max-width: 60ch;
}

/* List page (blog / portfolio index) */
.list-page h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}
.list-intro {
  color: var(--ink-soft);
  margin-bottom: 32px;
  max-width: 60ch;
}

/* Single page (post / project) */
/* The article is its own centred column inside the 1200px wrap, so the text
   sits in the middle of the page rather than hugging the left edge. */
.single {
  max-width: 820px;
  margin: 0 auto;
}
.single-header {
  padding-bottom: 28px;
  margin-bottom: 36px;
  text-align: center;
}
.single-header h1 {
  font-size: 2.4rem;
}
.single-date {
  font-family: var(--sans);
  color: var(--ink-soft);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}
.single-link {
  margin-top: 10px;
}
.single-content p,
.single-content ul,
.single-content ol {
  max-width: 68ch;
}
.single .single-content p,
.single .single-content ul,
.single .single-content ol {
  max-width: none;
}
.single-content pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 16px;
  overflow-x: auto;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}
.single-content code {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 0.88em;
}
.single-content p code, .single-content li code {
  background: var(--accent-soft);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.single-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.single-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 20px 0;
  padding: 4px 0 4px 18px;
  color: var(--ink-soft);
  font-style: italic;
}

/* Page hero — shared by the store and blog index pages */
.page-hero {
  padding: 64px 0 36px;
  margin-bottom: 44px;
  text-align: center;
}
.page-hero h1 {
  font-size: 2.4rem;
}
.page-intro {
  font-family: var(--sans);
  color: var(--ink-soft);
  font-size: 1.02rem;
  max-width: 52ch;
  margin: 0 auto;
}
.page-intro p {
  margin: 0;
}
.card-empty {
  color: var(--ink-soft);
  text-align: center;
}

/* ---------------------------------------------------------
   Cards — shared by the store, the blog index and the home
   page. The wrapper holds the perspective and the scroll
   reveal; the inner element does the rotating.
--------------------------------------------------------- */
.card-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 30px;
}
.card {
  perspective: 1000px;
}
.card-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background-color: var(--surface);
  background-image: none; /* cancel the global animated link underline */
  color: var(--ink);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(var(--card-scale, 1));
  transform-style: preserve-3d;
  transition: transform 0.55s var(--ease), box-shadow 0.45s var(--ease),
    border-color 0.45s var(--ease);
}
/* While the pointer drives it, drop the transform transition so the card
   tracks the cursor 1:1; it eases back when the class is removed. */
.card.is-tilting .card-inner {
  --card-scale: 1.03;
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transition: box-shadow 0.45s var(--ease), border-color 0.45s var(--ease);
}
.card-inner:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.card-glare {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  /* Fades to transparent *white* rather than the `transparent` keyword, which
     would interpolate through grey and haze the card. */
  background: radial-gradient(
    circle at var(--gx, 50%) var(--gy, 50%),
    var(--card-shine),
    rgba(255, 255, 255, 0) 55%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s var(--ease);
}
.card.is-tilting .card-glare {
  opacity: 1;
}

/* Layered depth — these lift towards the viewer as the card tilts */
.card-media {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  background: var(--bg);
  transition: transform 0.45s var(--ease);
}
.card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card.is-tilting .card-media {
  transform: translateZ(22px);
}
.card.is-tilting .card-info {
  transform: translateZ(34px);
}
.card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 3.6rem;
  color: var(--accent);
  opacity: 0.55;
  background: linear-gradient(140deg, var(--accent-soft), transparent 70%);
}
.card-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 8px 8px;
  transition: transform 0.45s var(--ease);
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.card-price {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent);
  white-space: nowrap;
}
.card-meta {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}
.card-summary {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.card-cta {
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), color 0.4s var(--ease);
}
.card-inner:hover .card-cta,
.card-inner:focus-visible .card-cta {
  opacity: 1;
  transform: none;
  color: var(--accent);
}

/* Unavailable posts — the card still shows, but it is inert: no link, no
   tilt, and the thumbnail is drained of colour so it reads as pending. */
.card--unavailable .card-inner {
  cursor: default;
}
.card--unavailable .card-media {
  filter: grayscale(1);
  opacity: 0.45;
}
.card--unavailable .card-title,
.card--unavailable .card-meta,
.card--unavailable .card-summary {
  color: var(--ink-soft);
}
.card--unavailable .card-title {
  opacity: 0.7;
}
/* The live CTA fades in on hover; this one is always visible instead. */
.card-cta--muted {
  opacity: 1;
  transform: none;
  color: var(--ink-soft);
}

/* Home navigation cards — the label sits centred over the image */
.card-grid--nav {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card--nav .card-inner {
  padding: 0;
}
.card--nav .card-media {
  aspect-ratio: 3 / 4;
  /* 1px inside the card's 16px outer curve, so the image meets the border exactly */
  border-radius: 15px;
}
/* Full-bleed leaves no padding to lift into: a layer this size magnifies past the
   border and swallows it, so the image stays the card's face. The label carries the
   depth instead — it sits centred, with room to slide. */
.card--nav.is-tilting .card-media {
  transform: none;
}
/* The scrim rides with the image rather than with the lifted text, so tilting
   can't drag a dark edge out past the card. */
.card--nav .card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(18, 15, 12, 0.74),
    rgba(18, 15, 12, 0.32)
  );
}
/* Without an image the tile carries the colour itself, so the scrim above it
   still has something to sit on. The dark stop is fixed rather than themed —
   the overlay text is white in both themes. */
.card--nav .card-placeholder {
  opacity: 1;
  background: linear-gradient(155deg, var(--accent), #241a14);
}
/* Nothing but a centring box for the label — the scrim it used to paint now lives
   on .card-media, which is what lets this layer lift without showing an edge. */
.card-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  transition: transform 0.45s var(--ease);
}
.card--nav.is-tilting .card-overlay {
  transform: translateZ(46px);
}
.card-overlay-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(1.9rem, 1.35rem + 1.6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #fff;
}
/* The blurb stays collapsed until hover. The 0fr/1fr grid row is what makes
   the height animatable, so the title glides to centre as it opens. */
.card-overlay-text {
  display: grid;
  grid-template-rows: 0fr;
  font-family: var(--sans);
  font-size: 0.86rem;
  line-height: 1.5;
  max-width: 26ch;
  color: rgba(255, 255, 255, 0.86);
  opacity: 0;
  transition: grid-template-rows 0.45s var(--ease), opacity 0.25s var(--ease);
}
.card-overlay-text > span {
  min-height: 0;
  overflow: hidden;
}
.card-inner:hover .card-overlay-text,
.card-inner:focus-visible .card-overlay-text {
  grid-template-rows: 1fr;
  opacity: 1;
  transition: grid-template-rows 0.45s var(--ease),
    opacity 0.4s var(--ease) 0.12s;
}
.card-overlay-cta {
  margin-top: 4px;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.card-inner:hover .card-overlay-cta,
.card-inner:focus-visible .card-overlay-cta {
  opacity: 1;
  transform: none;
}

/* ---------------------------------------------------------
   Portfolio showcase — alternating full-width project rows.
   Deliberately not the card grid: the portfolio gets room to
   breathe where the blog and store get density.
--------------------------------------------------------- */
.showcase {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: showcase;
  display: flex;
  flex-direction: column;
  gap: clamp(56px, 8vw, 116px);
}
.showcase-item {
  counter-increment: showcase;
}
.showcase-link {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: center;
  gap: clamp(26px, 4.5vw, 60px);
  color: inherit;
  padding-bottom: 0;
  background-image: none; /* cancel the global animated link underline */
}
.showcase-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 14px;
  border-radius: 4px;
}
/* Every other row flips, so the eye zig-zags down the page */
.showcase-item:nth-child(even) .showcase-media {
  order: 2;
}

.showcase-media {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 11;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease),
    border-color 0.6s var(--ease);
}
.showcase-link:hover .showcase-media {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}
.showcase-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  transition: transform 0.9s var(--ease);
}
.showcase-link:hover .showcase-media img {
  transform: scale(1.06);
}
/* Placeholder tile — a drawn panel rather than an empty box */
.showcase-canvas {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 120% at 18% 10%, rgba(255, 255, 255, 0.2), transparent 46%),
    linear-gradient(150deg, var(--accent) 0%, #2a1b14 78%);
}
.showcase-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 36px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 36px);
  -webkit-mask-image: radial-gradient(78% 78% at 50% 42%, #000, transparent 76%);
  mask-image: radial-gradient(78% 78% at 50% 42%, #000, transparent 76%);
}
/* Three variants so a run of placeholders doesn't read as one repeated tile */
.showcase-item:nth-child(3n + 2) .showcase-canvas {
  background:
    radial-gradient(110% 110% at 82% 16%, rgba(255, 255, 255, 0.18), transparent 48%),
    linear-gradient(205deg, var(--accent) 4%, #1d1712 82%);
}
.showcase-item:nth-child(3n + 3) .showcase-canvas {
  background:
    radial-gradient(130% 130% at 50% 108%, rgba(255, 255, 255, 0.16), transparent 52%),
    linear-gradient(115deg, #2a1b14 6%, var(--accent) 96%);
}
.showcase-letter {
  position: relative;
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(4rem, 11vw, 8.5rem);
  line-height: 1;
  letter-spacing: -0.05em;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.7s var(--ease);
}
@supports (-webkit-text-stroke: 1px black) {
  .showcase-letter {
    color: transparent;
    -webkit-text-stroke: 2px rgba(255, 255, 255, 0.55);
  }
}
.showcase-link:hover .showcase-letter {
  transform: scale(1.05);
}
.showcase-scrim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to top, rgba(18, 15, 12, 0.28), transparent 55%);
  opacity: 0;
  transition: opacity 0.6s var(--ease);
  pointer-events: none;
}
.showcase-link:hover .showcase-scrim {
  opacity: 1;
}

.showcase-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}
.showcase-index {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(2.4rem, 4.4vw, 3.8rem);
  line-height: 0.85;
  color: var(--line);
  transition: transform 0.5s var(--ease), color 0.5s var(--ease),
    -webkit-text-stroke-color 0.5s var(--ease);
}
.showcase-index::before {
  content: counter(showcase, decimal-leading-zero);
}
@supports (-webkit-text-stroke: 1px black) {
  .showcase-index {
    color: transparent;
    -webkit-text-stroke: 1.6px var(--line);
  }
  .showcase-link:hover .showcase-index {
    -webkit-text-stroke-color: var(--accent);
  }
}
.showcase-link:hover .showcase-index {
  color: var(--accent);
  transform: translateY(-3px);
}
.showcase-meta {
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.showcase-dot {
  color: var(--accent);
}
.showcase-title {
  margin: 0;
  font-size: clamp(1.8rem, 3.2vw, 2.7rem);
  line-height: 1.05;
  /* Same sweep as the site name in the header, so the page still feels local */
  background: linear-gradient(100deg, var(--ink) 35%, var(--shine) 50%, var(--ink) 65%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: background-position 1s var(--ease);
}
.showcase-link:hover .showcase-title {
  background-position: -40% 0;
}
.showcase-summary {
  color: var(--ink-soft);
  max-width: 44ch;
}
.showcase-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.showcase-tag {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease);
}
.showcase-link:hover .showcase-tag {
  color: var(--ink);
  border-color: var(--ink-soft);
}
/* Visible at rest — the arrow does the moving, so touch users get the cue too */
.showcase-cta {
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color 0.4s var(--ease);
}
.showcase-cta span {
  display: inline-block;
  transition: transform 0.4s var(--ease);
}
.showcase-link:hover .showcase-cta {
  color: var(--accent);
}
.showcase-link:hover .showcase-cta span {
  transform: translateX(6px);
}

/* Product page price */
.product-price {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--accent);
  margin: 0 0 18px;
}
.product-features {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  gap: 6px;
  font-family: var(--sans);
  font-size: 0.86rem;
  color: var(--ink-soft);
}
.product-features li {
  position: relative;
  padding-left: 20px;
}
.product-features li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
/* Gallery — product pages */
.product-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.product-gallery-main {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.product-gallery-main img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.product-thumb {
  width: 62px;
  height: 62px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.product-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.product-thumb:hover {
  transform: translateY(-2px);
}
.product-thumb.is-active {
  border-color: var(--accent);
}
.product-thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Buy button */
.product-actions {
  margin-top: 24px;
}
.product-buy {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background-color: var(--accent);
  background-image: none;
  color: var(--bg);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.product-buy:hover,
.product-buy:focus {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.product-buy-price {
  padding-left: 12px;
  border-left: 1px solid currentColor;
  opacity: 0.75;
}
.product-buy.is-disabled {
  background-color: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
  cursor: not-allowed;
}
.product-buy.is-disabled:hover {
  transform: none;
  box-shadow: none;
}
.product-buy-note {
  margin: 12px 0 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 36ch;
}
/* Product page */
.product-back {
  font-family: var(--sans);
  font-size: 0.85rem;
  margin: 0 0 28px;
}
.product-back a {
  color: var(--ink-soft);
}
.product-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.product-page-info h1 {
  font-size: 2rem;
}
.product-page-summary {
  margin-top: 0;
  color: var(--ink-soft);
}
.product-page-desc {
  margin-top: 52px;
}

/* Footer */
.site-footer {
  margin-top: 64px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 24px;
  font-family: var(--sans);
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.footer-links a {
  margin-left: 16px;
  color: var(--ink-soft);
}

/* Theme toggle (requires JS; hidden without it) */
.no-js .theme-toggle {
  display: none;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: 16px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--accent);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.theme-toggle-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
  opacity: 1;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.theme-toggle-icon.icon-sun {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle-icon.icon-moon {
  fill: currentColor;
  stroke: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5) rotate(90deg);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-icon.icon-sun {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5) rotate(-90deg);
  }
  :root:not([data-theme="light"]) .theme-toggle-icon.icon-moon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}
:root[data-theme="dark"] .theme-toggle-icon.icon-sun {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5) rotate(-90deg);
}
:root[data-theme="dark"] .theme-toggle-icon.icon-moon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) rotate(0deg);
}

/* Staggered reveal for list items */
.entry-list .entry:nth-child(1) { transition-delay: 0ms; }
.entry-list .entry:nth-child(2) { transition-delay: 60ms; }
.entry-list .entry:nth-child(3) { transition-delay: 120ms; }
.entry-list .entry:nth-child(4) { transition-delay: 180ms; }
.entry-list .entry:nth-child(5) { transition-delay: 240ms; }
.entry-list .entry:nth-child(6) { transition-delay: 300ms; }
.entry-list .entry:nth-child(n+7) { transition-delay: 360ms; }
.showcase-item:nth-child(1) { transition-delay: 0ms; }
.showcase-item:nth-child(2) { transition-delay: 90ms; }
.showcase-item:nth-child(n+3) { transition-delay: 180ms; }
.card-grid .card:nth-child(1) { transition-delay: 0ms; }
.card-grid .card:nth-child(2) { transition-delay: 80ms; }
.card-grid .card:nth-child(3) { transition-delay: 160ms; }
.card-grid .card:nth-child(n+4) { transition-delay: 240ms; }

@media (max-width: 760px) {
  .showcase-link {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  /* Media always first once stacked, so the rhythm stays predictable */
  .showcase-item:nth-child(even) .showcase-media {
    order: 0;
  }
  .showcase-media {
    aspect-ratio: 16 / 10;
  }
  .showcase-summary {
    max-width: none;
  }
  .product-page-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

@media (max-width: 640px) {
  .single-header h1 { font-size: 1.9rem; }
  /* Five nav items no longer fit on one line at phone widths */
  .site-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 16px;
  }
  .site-nav a,
  .nav-dropdown-toggle { font-size: 0.76rem; }
  /* Panel spans the nav instead of hanging off the toggle, so it can't overflow */
  .nav-dropdown { position: static; }
  .nav-dropdown-panel {
    left: 0;
    right: 0;
    min-width: 0;
    padding-top: 10px;
  }
  .hero-title { font-size: 2.6rem; }
  .page-hero { padding: 44px 0 28px; }
  .page-hero h1 { font-size: 1.9rem; }
  .card-grid { gap: 22px; }
  /* Stacked portrait tiles would be a screen each, so go letterbox */
  .card--nav .card-media { aspect-ratio: 16 / 9; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .hero-title { font-size: 2.1rem; }
  .header-inner { padding: 20px; }
  .site-logo { width: 44px; height: 44px; }
  .nav-dropdown-item { padding: 10px; }
  .nav-dropdown-icon { width: 28px; height: 28px; }
  .nav-dropdown-icon svg { width: 16px; height: 16px; }
  .footer-inner { flex-direction: column; }
  .footer-links a:first-child { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
  .theme-toggle-icon,
  .theme-transitioning,
  .theme-transitioning *,
  .theme-transitioning *::before,
  .theme-transitioning *::after {
    transition: none !important;
  }
  .js .hero,
  .js .home-section,
  .js .list-page,
  .js .single-header,
  .js .single-content,
  .js .entry-list .entry,
  .js .showcase-item,
  .js .page-hero,
  .js .product-page,
  .js .card-grid .card {
    opacity: 1 !important;
    transform: none !important;
  }
  .card-inner,
  .card-media,
  .card-info,
  .card-overlay {
    transform: none !important;
  }
  .card-cta,
  .card-overlay-cta {
    opacity: 1;
  }
  .nav-dropdown-panel {
    translate: none !important;
  }
  .hero-title,
  .site-name {
    background-position: 0 0 !important;
  }
}
