/* ─── Google Fonts ─── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500&display=swap');

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Core palette ── */
  --cream:      #111110;   /* Background — dark warm black */
  --ink:        #F0ECE6;   /* Primary text — warm off-white */
  --muted:      #8A8480;   /* Body text, secondary */
  --subtle:     #6A6560;   /* Tertiary text */
  --ghost:      #504B47;   /* Labels, meta */
  --stone:      #3D3830;   /* Pill borders, decorative */
  --rule:       #252220;   /* All borders */
  --dust:       #1A1815;   /* Subtle fills, tag backgrounds */
  --white:      #1C1917;   /* Card backgrounds */

  /* ── Accent ── */
  --accent:     #9065EA;   /* Primary accent — purple */
  --accent-lt:  #2D1F5E;   /* Accent light — dark purple fill */
  --success:    #5FA876;   /* Success / positive states */

  /* ── Gradient accent (coral → violet) ── */
  --coral:      #D85A30;   /* Gradient warm end */
  --coral-lt:   #F0997B;   /* Gradient warm end, lighter — text on dark */
  --gradient-hero: linear-gradient(90deg, var(--coral-lt) 0%, var(--accent) 100%);

  /* ── Legacy aliases (used by case study overrides) ── */
  --violet:     #9065EA;   /* → --accent */
  --teal:       #14B8A6;

  /* ── Type ── */
  --serif:    'DM Serif Display', Georgia, serif;
  --sans:     'DM Sans', system-ui, sans-serif;

  /* ── Layout ── */
  --radius:    8px;
  --radius-lg: 12px;
  --max-w:     780px;
  --page-x:    clamp(20px, 5vw, 48px);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

a { color: inherit; text-decoration: none; }

/* ─── Layout ─── */
.page-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--page-x);
}

/* ─── Nav ─── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(17, 17, 16, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--cream);
  border-bottom: 0.5px solid var(--rule);
  padding: 0 var(--page-x);
}

.site-nav__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

/* ─── Nav logo with animated pulse dot ─── */
.site-nav__logo {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.site-nav__logo::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--violet);
  animation: nav-dot-pulse 3s ease-in-out infinite;
}

@keyframes nav-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.35; transform: scale(0.65); }
}

.site-nav__links {
  display: flex;
  gap: 28px;
  list-style: none;
}

.site-nav__links a {
  font-size: 13px;
  color: var(--subtle);
  position: relative;
  transition: color 0.15s;
}

.site-nav__links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gradient-hero);
  transition: width 0.2s ease;
}

.site-nav__links a:hover { color: var(--ink); }
.site-nav__links a:hover::after { width: 100%; }
.site-nav__links a.active { color: var(--ink); }
.site-nav__links a.active::after { width: 100%; }

/* ─── Section utility ─── */
.section {
  padding: 56px 0;
  border-bottom: 0.5px solid var(--rule);
}
.section:last-of-type { border-bottom: none; }

.section__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section__label::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--rule);
}

/* ─── Gradient text utility — use sparingly, e.g. one section label ─── */
.text-gradient-accent {
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ─── Eyebrow ─── */
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 16px;
}

/* ─── Typography ─── */
.display {
  font-family: var(--serif);
  font-size: clamp(36px, 6vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
}

/* ─── Animated gradient on italic in hero ─── */
.display em {
  font-style: italic;
  background: linear-gradient(
    90deg,
    var(--coral-lt) 0%,
    var(--accent) 60%,
    var(--coral-lt) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: gradient-shift 5s linear infinite;
}

@keyframes gradient-shift {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}

@media (prefers-reduced-motion: reduce) {
  .display em {
    animation: none;
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    -webkit-text-fill-color: var(--muted);
    color: var(--muted);
  }
  .site-nav__logo::after { animation: none; }
}

.headline {
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.subhead {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.75;
  max-width: 520px;
}

.body-text {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 18px;
}
.body-text:last-child { margin-bottom: 0; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 11px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.12s, background 0.15s;
  border: none;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: var(--gradient-hero);
  color: #ffffff;
}
.btn--primary:hover { filter: brightness(0.9); }

.btn--ghost {
  background: none;
  color: var(--subtle);
  padding: 0;
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn--ghost:hover { color: var(--ink); }

/* ─── Tags / pills ─── */
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--dust);
  color: var(--muted);
}

/* ─── Tag color variants — apply to 1-2 tags per case study max, rest stay neutral ─── */
.tag--coral {
  background: transparent;
  border: 0.5px solid var(--coral);
  color: var(--coral-lt);
}
.tag--violet {
  background: transparent;
  border: 0.5px solid var(--accent);
  color: var(--accent);
}

.pill {
  display: inline-block;
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 100px;
  border: 0.5px solid var(--stone);
  color: var(--muted);
  background: var(--white);
}

/* ─── Meta grid (3-col border table) ─── */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 0.5px solid var(--rule);
  border-left: 0.5px solid var(--rule);
  margin-top: 32px;
}
.meta-grid__cell {
  padding: 16px 20px;
  border-right: 0.5px solid var(--rule);
  border-bottom: 0.5px solid var(--rule);
}
.meta-grid__label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 4px;
}
.meta-grid__value {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

/* ─── Image placeholder ─── */
.img-slot {
  background: var(--dust);
  border: 0.5px dashed var(--stone);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ghost);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: relative;
}
.img-slot svg { width: 28px; height: 28px; stroke: var(--stone); fill: none; }
.img-slot__sub { font-size: 10px; color: var(--stone); letter-spacing: 0; text-transform: none; margin-top: -4px; }

/* ─── Quote block ─── */
.quote-block {
  background: var(--white);
  border: 0.5px solid var(--rule);
  border-left: 3px solid var(--coral);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 24px;
  margin: 28px 0;
}
.quote-block__text {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  font-style: italic;
  margin-bottom: 8px;
}
.quote-block__attr {
  font-size: 12px;
  color: var(--ghost);
}

/* ─── Constraint cards ─── */
.constraint-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}
.constraint-card {
  background: var(--white);
  border: 0.5px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.constraint-card__title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 10px;
}
.constraint-card__list {
  list-style: none;
  padding: 0;
}
.constraint-card__list li {
  font-size: 13px;
  color: var(--subtle);
  line-height: 1.8;
  padding-left: 16px;
  position: relative;
}
.constraint-card__list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--stone);
}

/* ─── Decision list ─── */
.decision-list { margin-top: 4px; }
.decision-item {
  padding: 24px 0;
  border-top: 0.5px solid var(--rule);
}
.decision-item:first-child { border-top: none; padding-top: 0; }
.decision-item__num {
  font-size: 11px;
  color: var(--ghost);
  margin-bottom: 6px;
}
.decision-item__title {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
}
.decision-item__body {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 10px;
}
.decision-item__tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* ─── Outcomes ─── */
.outcome-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}
.outcome-card {
  background: var(--white);
  border: 0.5px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
}
.outcome-card__stat {
  font-family: var(--serif);
  font-size: 32px;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 6px;
  line-height: 1;
}
.outcome-card__desc {
  font-size: 12px;
  color: var(--subtle);
  line-height: 1.55;
}

/* ─── Prototype CTA ─── */
.proto-cta {
  background: var(--ink);
  border-radius: var(--radius);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.proto-cta__label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stone);
  margin-bottom: 5px;
}
.proto-cta__title {
  font-size: 15px;
  font-weight: 500;
  color: var(--cream);
}
.proto-cta__btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  background: var(--gradient-hero);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s;
  text-decoration: none;
  display: inline-block;
}
.proto-cta__btn:hover { filter: brightness(0.9); }

/* ─── Reflection grid ─── */
.reflection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}
.reflection-card {
  background: var(--white);
  border: 0.5px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.reflection-card__head {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 12px;
}
.reflection-card__list { list-style: none; padding: 0; }
.reflection-card__list li {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
  padding-left: 14px;
  position: relative;
}
.reflection-card__list li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--ghost);
}

/* ─── Image pairs ─── */
.img-pair {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 12px;
  margin: 28px 0;
}
.img-single { margin: 28px 0; }

/* ─── Next project bar ─── */
.next-project {
  padding: 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: opacity 0.15s;
}
.next-project:hover { opacity: 0.65; }
.next-project__label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 6px;
}
.next-project__title {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.next-project__arrow {
  font-size: 28px;
  color: var(--stone);
}

/* ─── Work item rows — violet slide-in accent on hover ─── */
.work-item-row {
  position: relative;
  padding-left: 0;
  transition: padding-left 0.22s ease;
}
.work-item-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--coral-lt), var(--accent));
  border-radius: 0 2px 2px 0;
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.22s ease;
}
.work-item-row:hover::before { transform: scaleY(1); }
.work-item-row:hover { padding-left: 12px; }

/* ─── Skill cards — dot-grid background ─── */
.skill-card {
  background-color: var(--white);
  background-image: radial-gradient(circle, var(--stone) 1px, transparent 1px);
  background-size: 18px 18px;
  background-position: 2px 2px;
  border: 0.5px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: border-color 0.18s, background-color 0.18s;
}
.skill-card:hover { border-color: var(--coral); }

/* ─── Footer ─── */
.site-footer {
  border-top: 0.5px solid var(--rule);
  padding: 24px var(--page-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer__copy {
  font-size: 12px;
  color: var(--ghost);
}
.site-footer__links {
  display: flex;
  gap: 20px;
  list-style: none;
}
.site-footer__links a {
  font-size: 12px;
  color: var(--ghost);
  transition: color 0.15s;
}
.site-footer__links a:hover { color: var(--ink); }

/* ─── Scroll reveal ─── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.32s; }
.reveal-delay-4 { transition-delay: 0.44s; }

/* ─── Hero load animation ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-animate > * {
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
}
.hero-animate > *:nth-child(1) { animation-delay: 0.05s; }
.hero-animate > *:nth-child(2) { animation-delay: 0.18s; }
.hero-animate > *:nth-child(3) { animation-delay: 0.3s; }
.hero-animate > *:nth-child(4) { animation-delay: 0.42s; }
.hero-animate > *:nth-child(5) { animation-delay: 0.54s; }

/* ─── Image enlarge UI ─── */
.img-slot { position: relative; }
.img-enlarge-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(28, 25, 23, 0.92);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.14s ease, background 0.14s ease;
}
.img-enlarge-btn:hover {
  transform: translateY(-1px);
  background: rgba(40, 36, 33, 0.98);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(16, 16, 14, 0.84);
}
.image-lightbox.is-open { display: flex; }

.image-lightbox__panel {
  position: relative;
  width: min(1100px, 92vw);
  max-height: 90vh;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: #11110f;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.image-lightbox__img {
  width: 100%;
  max-height: calc(90vh - 66px);
  object-fit: contain;
  border-radius: 10px;
  background: #0a0a09;
}
.image-lightbox__close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  color: #f7f7f4;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
body.lightbox-open { overflow: hidden; }

/* ─── Background gradient themes ─── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}
body.theme-aurora::before {
  background: linear-gradient(160deg, #050e1c 0%, #081a0e 60%, #0e1116 100%);
  opacity: 1;
}
body.theme-ember::before {
  background: linear-gradient(160deg, #200a04 0%, #150c08 55%, #0c0c16 100%);
  opacity: 1;
}
body.theme-iris::before {
  background: linear-gradient(150deg, #120a28 0%, #120e1e 55%, #080e1c 100%);
  opacity: 1;
}
body.theme-mist::before {
  background: linear-gradient(150deg, #060c1c 0%, #081210 50%, #0c0e14 100%);
  opacity: 1;
}
body.theme-aurora .site-nav,
body.theme-ember .site-nav,
body.theme-iris .site-nav,
body.theme-mist .site-nav {
  background: rgba(10, 10, 10, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ─── Theme Picker widget ─── */
.theme-picker {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.theme-picker__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  background: var(--white);
  border: 1px solid var(--stone);
  border-radius: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.95);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.theme-picker.is-open .theme-picker__panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.theme-picker__toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--stone);
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.theme-picker__toggle:hover {
  border-color: var(--ghost);
  color: var(--ink);
}
.theme-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.theme-swatch:hover { transform: scale(1.18); }
.theme-swatch.is-active { border-color: var(--ink); }
.theme-swatch[data-theme="void"]   { background: #3a3530; border-color: var(--stone); }
.theme-swatch[data-theme="aurora"] { background: radial-gradient(circle at 35% 35%, #2a9a6a, #091a10); }
.theme-swatch[data-theme="ember"]  { background: radial-gradient(circle at 35% 35%, #d04a18, #2a0a04); }
.theme-swatch[data-theme="iris"]   { background: radial-gradient(circle at 35% 35%, #8050e0, #180830); }
.theme-swatch[data-theme="mist"]   { background: radial-gradient(circle at 35% 35%, #3070d0, #071428); }

@media (prefers-reduced-motion: reduce) {
  body::before { transition: none; }
  .theme-picker__panel, .theme-swatch { transition: none; }
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .constraint-grid { grid-template-columns: 1fr; }
  .outcome-row { grid-template-columns: 1fr; }
  .reflection-grid { grid-template-columns: 1fr; }
  .img-pair { grid-template-columns: 1fr; }
  .site-nav__links { gap: 16px; }
  .proto-cta { flex-direction: column; align-items: flex-start; }
  .page-wrap > div[style*="1fr 1fr"] { display: flex !important; flex-direction: column-reverse; }
}
