/* ============================================================
   Todd Broadrick — Portfolio
   Design tokens. One light theme site-wide, matching the palette
   used in the case studies (navy / teal / coral / green on paper).
   ============================================================ */
:root {
  --bg: #ffffff;
  --text: #0f172a;
  --text-muted: #334155;
  --panel-bg: #f8fafc;
  --panel-bg-solid: #f1f5f9;
  --panel-border: #e2e8f0;
  --btn-bg: #1a2e44;
  --btn-text: #ffffff;
  --accent: #0a7d88;
  --accent-warm: #f0564a;
  --hairline: #e2e8f0;

  --navy: #1a2e44;
  --navy-900: #132433;
  --teal: #0fa3b1;
  --teal-deep: #0a7d88;
  --coral: #f0564a;
  --green: #8bc53f;
  --amber: #c98a12;

  --font-display: 'Raleway', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Raleway', 'Helvetica Neue', Arial, sans-serif;

  --measure: 68ch;
  --radius: 18px;
  --radius-sm: 10px;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.75rem;
  --space-4: 2.75rem;
  --space-5: 4.5rem;
  --space-6: 7rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 var(--space-2);
}
p { margin: 0 0 var(--space-2); }
ul, ol { margin: 0 0 var(--space-2); padding-left: 1.25em; }

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

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

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* ============================================================
   Nav
   ============================================================ */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #ffffff;
  color: #000;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}
.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-nav .brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  color: #000;
  letter-spacing: -0.01em;
}
.site-nav .brand span { color: var(--accent); font-weight: 400; }
.nav-links {
  display: flex;
  gap: var(--space-4);
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
}
.nav-links a { text-decoration: none; color: #000; transition: color 0.15s ease; padding-bottom: 3px; border-bottom: 2px solid transparent; }
.nav-links a:hover { color: #444; }
.nav-links a[aria-current="page"] { border-bottom-color: var(--accent); }
.nav-toggle { display: none; }

@media (max-width: 720px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: #ffffff;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: var(--space-2) var(--space-3); border-top: 1px solid #eee; border-bottom: none; width: 100%; }
  .nav-toggle {
    display: block; background: none; border: 1px solid #000; border-radius: 6px;
    width: 40px; height: 36px; font-family: var(--font-display); cursor: pointer;
  }
}

/* ============================================================
   Home — interactive chat hero
   ============================================================ */
.chat-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4) var(--space-3);
  background:
    radial-gradient(900px 460px at 82% -8%, rgba(15,163,177,.12), transparent 60%),
    radial-gradient(700px 420px at 6% 108%, rgba(240,86,74,.08), transparent 60%);
}
.chat-hero-inner { width: 100%; max-width: 640px; text-align: center; margin: 0 auto; }
.chat-hero-inner.has-thread { text-align: left; }
.chat-hero .eyebrow {
  display: inline-block;
  padding: 0.35em 0.9em;
  border-radius: 999px;
  background: var(--panel-bg-solid);
  border: 1px solid var(--panel-border);
  color: var(--accent);
  font-weight: 600;
  margin-bottom: var(--space-3);
  animation: heroIn 0.5s ease both;
}
.chat-hero .eyebrow .wave { display: inline-block; animation: wave 2.2s ease-in-out 0.6s infinite; transform-origin: 70% 70%; }
.chat-hero h1 {
  font-size: clamp(2.4rem, 6.2vw, 3.7rem);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-2);
  text-align: center;
  transition: font-size 0.25s ease;
  animation: heroIn 0.6s ease 0.1s both;
}
.chat-hero.compact h1 { font-size: 1.5rem; }
.chat-hero h1 .grad,
.pg-head h1 .grad {
  background: linear-gradient(90deg,
    var(--teal-deep, #0a7d88) 20%,
    var(--teal, #0fa3b1) 40%,
    var(--coral, #f0564a) 50%,
    var(--teal, #0fa3b1) 60%,
    var(--teal-deep, #0a7d88) 80%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmerText 5s linear infinite;
}
@keyframes shimmerText {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}
@keyframes heroIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes wave {
  0%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
  60%, 100% { transform: rotate(0deg); }
}
.chat-hero .sub { color: var(--text-muted); font-size: 1.15rem; margin-bottom: var(--space-4); text-align: center; }
.chat-hero.compact .sub { display: none; }

@media (max-width: 720px), (max-height: 480px) {
  /* .chat-hero centers its content vertically within min-height:100vh, so
     the gap above the eyebrow shrinks toward just padding-top once the
     hero content is tall relative to the viewport (short phones, landscape) —
     bump the floor so it doesn't end up flush under the sticky nav. The
     max-height arm catches wide-but-short landscape phones that the
     max-width check alone would miss. */
  .chat-hero { padding-top: 60px; }
}

.chat-thread {
  display: none;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 46vh;
  overflow-y: auto;
  padding: var(--space-2) var(--space-1);
  margin-bottom: var(--space-3);
  scroll-behavior: smooth;
}
.chat-thread.visible { display: flex; }
.chat-msg { max-width: 82%; padding: 0.85em 1.2em; border-radius: 16px; font-size: 0.98rem; line-height: 1.5; animation: msgIn 0.25s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.chat-msg.user { align-self: flex-end; background: var(--btn-bg); color: var(--btn-text); border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: var(--panel-bg-solid); border: 1px solid var(--panel-border); color: var(--text); border-bottom-left-radius: 4px; }
.chat-msg.bot a { color: var(--accent); text-decoration: underline; }
.chat-msg.bot .msg-links { display: flex; flex-wrap: wrap; gap: 0.5em; margin-top: 0.7em; }
.chat-msg.bot .msg-links a {
  background: var(--btn-bg); color: var(--btn-text); text-decoration: none;
  padding: 0.5em 1em; border-radius: var(--radius-sm); font-family: var(--font-display); font-size: 0.85rem;
}
.chat-typing { align-self: flex-start; display: flex; gap: 4px; padding: 0.9em 1.2em; background: var(--panel-bg-solid); border: 1px solid var(--panel-border); border-radius: 16px; border-bottom-left-radius: 4px; }
.chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); opacity: .55; animation: typingBounce 1.2s infinite ease-in-out; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-input-row {
  display: flex;
  align-items: center;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: #ffffff;
  padding: 0.5em 0.5em 0.5em 1.6em;
  box-shadow: 0 10px 30px -14px rgba(15,23,42,.18);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.chat-input-row:focus-within { border-color: var(--accent); }
.chat-input-row input {
  background: none; border: none; outline: none; color: var(--text);
  font-family: var(--font-body); font-size: 0.98rem; flex: 1; min-width: 0;
}
.chat-input-row input::placeholder { color: var(--text-muted); opacity: .7; }
.chat-input-row .send {
  width: 38px; height: 38px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--btn-bg); flex-shrink: 0; transition: background 0.15s ease;
}
.chat-input-row .send:hover { background: var(--accent); }
.chat-input-row .send img { width: 16px; height: 16px; }

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55em;
  justify-content: center;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
  transition: max-height 0.28s ease, opacity 0.2s ease, margin-top 0.28s ease;
}
.chat-suggestions.open { max-height: 220px; opacity: 1; margin-top: var(--space-2); }
.chat-hero-inner.has-thread .chat-suggestions { justify-content: flex-start; }
.chat-suggestions .chip {
  font-family: var(--font-display);
  font-size: 0.88rem;
  color: var(--text-muted);
  background: var(--panel-bg-solid);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0.5em 1.1em;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.chat-suggestions .chip:hover, .chat-suggestions .chip:focus-visible { border-color: var(--accent); color: var(--accent); background: #ffffff; }
.chat-suggestions .chip:active { transform: scale(0.97); }

.social-row { display: flex; gap: var(--space-2); align-items: center; justify-content: center; margin-top: var(--space-4); }
.social-row a {
  display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center;
  border: 1px solid var(--panel-border); border-radius: 50%; transition: border-color 0.15s ease, transform 0.15s ease;
}
.social-row a:hover { border-color: var(--accent); transform: translateY(-2px); }
.social-row img { width: 18px; height: 18px; }

/* ============================================================
   Section headers
   ============================================================ */
.section-head { margin: var(--space-5) 0 var(--space-3); }
.section-head h2 { font-size: 2.4rem; margin: 0; }

/* ============================================================
   Project grid
   ============================================================ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  padding-bottom: var(--space-6);
}
.project-card {
  display: flex;
  background: var(--panel-bg);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  min-height: 260px;
  box-shadow: 0 0 0 1px var(--panel-border);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.project-card:hover { transform: translateY(-3px); background: var(--panel-bg-solid); box-shadow: 0 14px 30px -16px rgba(15,23,42,0.25); }
.project-card .thumb { width: 42%; flex-shrink: 0; overflow: hidden; }
.project-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.project-card:hover .thumb img { transform: scale(1.04); }
.project-card .body { padding: var(--space-3); display: flex; flex-direction: column; flex: 1; }
.project-card h3 { font-size: 1.6rem; margin-bottom: 0.6rem; }
.project-card p { font-size: 0.98rem; color: var(--text-muted); flex: 1; }
.project-card p strong { color: var(--text); font-weight: 600; }
.project-card .cta {
  display: inline-block;
  align-self: flex-start;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-family: var(--font-display);
  font-size: 0.85rem;
  padding: 0.6em 1.2em;
  border-radius: var(--radius-sm);
  margin-top: var(--space-2);
}

@media (max-width: 800px) {
  .project-grid { grid-template-columns: 1fr; }
  .project-card { flex-direction: column; }
  .project-card .thumb { width: 100%; height: 200px; }
}

/* ============================================================
   Charcoal / light panel — Resume, Other Creations, case studies
   ============================================================ */
.panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-3);
  margin-bottom: var(--space-4);
}

/* ============================================================
   Resume
   ============================================================ */
.resume-header {
  padding: var(--space-5) 0 var(--space-4);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
}
.resume-header h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); margin: 0; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-family: var(--font-display); font-size: 0.95rem; text-decoration: none;
  color: var(--text); padding: 0.6em 0; transition: color 0.15s ease;
}
.btn:hover { color: var(--btn-bg); }
.btn .icon-download { width: 16px; height: 16px; flex-shrink: 0; }
.btn-solid { background: var(--btn-bg); color: var(--btn-text); padding: 0.8em 1.6em; border-radius: var(--radius-sm); }
.btn-solid:hover { opacity: 0.85; color: var(--btn-text); }

.panel h2 { font-size: 2rem; margin-bottom: var(--space-3); }
.timeline-entry {
  display: grid; grid-template-columns: 220px 1fr; gap: var(--space-3);
  padding: var(--space-3) 0; border-top: 1px solid var(--hairline);
}
.timeline-entry:first-of-type { border-top: none; padding-top: 0; }
.timeline-entry .years { font-size: 0.95rem; color: var(--text-muted); }
.timeline-entry .role { font-size: 1.05rem; margin-top: 0.3em; }
.timeline-entry .org { font-size: 1.05rem; color: var(--text-muted); }
.timeline-entry .desc p, .timeline-entry .desc li { color: var(--text-muted); }

.proficiency-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.proficiency-row .chip { display: flex; align-items: center; gap: 0.6em; font-family: var(--font-display); font-size: 0.95rem; color: var(--text-muted); }
.proficiency-row img { width: 24px; height: 24px; object-fit: contain; }

@media (max-width: 620px) { .timeline-entry { grid-template-columns: 1fr; } }

/* ============================================================
   Other Creations
   ============================================================ */
.photo-banner { display: flex; border-radius: var(--radius); overflow: hidden; margin: var(--space-4) 0; min-height: 380px; }
.photo-banner .img-half { width: 42%; flex-shrink: 0; }
.photo-banner .img-half img { width: 100%; height: 100%; object-fit: cover; }
.photo-banner .text-half { flex: 1; padding: var(--space-4); display: flex; flex-direction: column; justify-content: center; background: var(--panel-bg); }
.photo-banner h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
.photo-banner p { color: var(--text-muted); max-width: 46ch; }

.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); padding-bottom: var(--space-6); }
.photo-grid figure { margin: 0; overflow: hidden; border-radius: 6px; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.photo-grid figure:hover img { transform: scale(1.03); }

@media (max-width: 720px) {
  .photo-banner { flex-direction: column; }
  .photo-banner .img-half { width: 100%; height: 220px; }
  .photo-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Playground — live AI side projects, embedded in place
   ============================================================ */
.pg-head { padding: var(--space-5) 0 var(--space-3); max-width: 800px; }
.pg-head .eyebrow {
  display: inline-block; padding: 0.35em 0.9em; border-radius: 999px;
  background: var(--panel-bg-solid); border: 1px solid var(--panel-border);
  color: var(--accent); font-weight: 600; margin-bottom: var(--space-2);
}
.pg-head h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.01em; }
.pg-deck { color: var(--text-muted); max-width: 62ch; }

.pg-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.pg-card {
  display: flex; flex-direction: column;
  background: var(--panel-bg); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 0 0 1px var(--panel-border);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.pg-card:hover { transform: translateY(-3px); background: var(--panel-bg-solid); box-shadow: 0 14px 30px -16px rgba(15,23,42,0.25); }

/* The card preview is the real app in a muted, non-interactive iframe,
   rendered at its natural width and scaled down by js/playground.js —
   so a card can't go stale the way a screenshot would. It only mounts
   once the card scrolls into view. */
.pg-preview {
  position: relative; height: 250px; overflow: hidden;
  background: var(--navy); border-bottom: 1px solid var(--panel-border); cursor: pointer;
}
.pg-preview iframe {
  position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0;
  pointer-events: none; background: #fff; opacity: 0; transition: opacity 0.45s ease;
}
.pg-preview.is-ready iframe { opacity: 1; }
.pg-preview-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--navy) 0%, var(--navy-900) 100%);
  font-family: var(--font-display); font-size: 1.7rem; color: rgba(255,255,255,0.5);
  transition: opacity 0.45s ease;
}
.pg-preview.is-ready .pg-preview-fallback { opacity: 0; }
.pg-preview::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(15,23,42,0) 55%, rgba(15,23,42,0.10) 100%);
  transition: background 0.25s ease;
}
.pg-card:hover .pg-preview::after { background: linear-gradient(180deg, rgba(15,23,42,0) 45%, rgba(15,23,42,0.18) 100%); }

.pg-body { padding: var(--space-3); display: flex; flex-direction: column; flex: 1; }
.pg-body h2 { font-size: 1.6rem; margin-bottom: 0.5rem; }
.pg-body > p { font-size: 0.98rem; color: var(--text-muted); margin-bottom: var(--space-2); }

.pg-tags { display: flex; flex-wrap: wrap; gap: 0.45em; margin-bottom: var(--space-3); }
.pg-tag {
  font-family: var(--font-display); font-size: 0.76rem; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--text-muted); background: #fff; border: 1px solid var(--panel-border);
  border-radius: 999px; padding: 0.35em 0.85em;
}

.pg-actions { display: flex; align-items: center; gap: var(--space-3); margin-top: auto; flex-wrap: wrap; }
.pg-launch {
  font-family: var(--font-display); font-size: 0.85rem; color: var(--btn-text); background: var(--btn-bg);
  border: none; border-radius: var(--radius-sm); padding: 0.75em 1.4em; cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}
.pg-launch:hover { background: var(--accent); }
.pg-launch:active { transform: scale(0.98); }
.pg-out { font-family: var(--font-display); font-size: 0.85rem; color: var(--text-muted); text-decoration: none; transition: color 0.15s ease; }
.pg-out em { font-style: normal; }
.pg-out:hover { color: var(--accent); }

.pg-note { color: var(--text-muted); font-size: 0.88rem; max-width: 64ch; margin: var(--space-4) 0 var(--space-6); }

/* ---- The stage: an immersive, in-page run of the real app ---- */
.pg-stage {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(10px, 2vw, 26px);
}
.pg-stage[hidden] { display: none; }
.pg-stage-backdrop {
  position: absolute; inset: 0; border: 0; padding: 0;
  background: rgba(9, 17, 28, 0.74);
  -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
  opacity: 0; transition: opacity 0.3s ease;
}
.pg-stage.is-open .pg-stage-backdrop { opacity: 1; }
.pg-stage-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; width: 100%; height: 100%; max-width: 1180px;
  opacity: 0; transform: translateY(16px) scale(0.985);
  transition: opacity 0.3s ease, transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
.pg-stage.is-open .pg-stage-inner { opacity: 1; transform: none; }

.pg-stage-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  padding: 0 0.25rem var(--space-2); flex-wrap: wrap;
}
.pg-stage-title { font-family: var(--font-display); font-weight: 600; color: #fff; margin: 0; font-size: 1.05rem; }
.pg-stage-tools { display: flex; align-items: center; gap: var(--space-2); }
.pg-stage-out, .pg-stage-close {
  font-family: var(--font-display); font-size: 0.85rem; color: rgba(255,255,255,0.82);
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px; padding: 0.5em 1.1em; text-decoration: none; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.pg-stage-out:hover, .pg-stage-close:hover { background: rgba(255,255,255,0.2); color: #fff; }
.pg-stage-out em, .pg-stage-close em { font-style: normal; }

.pg-stage-frame {
  position: relative; flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
}
.pg-stage-frame iframe {
  border: 0; width: 100%; height: 100%; border-radius: 14px; background: #fff;
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.7);
  opacity: 0; transition: opacity 0.35s ease;
}
.pg-stage-frame.is-loaded iframe { opacity: 1; }
/* Mobile-first apps run in a phone-shaped frame instead of stretched wide. */
.pg-stage-frame.phone iframe {
  width: min(400px, 100%); height: 100%; max-height: 860px;
  border-radius: 34px; box-shadow: 0 0 0 9px #101c29, 0 30px 70px -28px rgba(0,0,0,0.75);
}
.pg-stage-loading {
  position: absolute; display: flex; align-items: center; gap: 0.6em;
  font-family: var(--font-display); font-size: 0.9rem; color: rgba(255,255,255,0.75);
  pointer-events: none; transition: opacity 0.25s ease;
}
.pg-stage-frame.is-loaded .pg-stage-loading { opacity: 0; }
.pg-spinner {
  width: 15px; height: 15px; border-radius: 50%; display: inline-block;
  border: 2px solid rgba(255,255,255,0.28); border-top-color: #fff;
  animation: pgSpin 0.8s linear infinite;
}
@keyframes pgSpin { to { transform: rotate(360deg); } }

html.pg-locked, html.pg-locked body { overflow: hidden; }

@media (max-width: 860px) {
  .pg-grid { grid-template-columns: 1fr; }
  .pg-preview { height: 210px; }
  .pg-stage { padding: 0; }
  .pg-stage-inner { padding: 10px 10px 0; }
  .pg-stage-frame iframe, .pg-stage-frame.phone iframe { border-radius: 14px 14px 0 0; box-shadow: none; max-height: none; }
}

/* ============================================================
   Footer
   ============================================================ */
footer.site-footer { padding: var(--space-4) 0; }
footer.site-footer .wrap {
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  font-family: var(--font-display); font-size: 0.85rem; color: var(--text-muted);
  border-top: 1px solid var(--hairline); padding-top: var(--space-3);
}
footer.site-footer a { color: var(--text); text-decoration: none; }
footer.site-footer a:hover { color: var(--accent); }

/* ============================================================
   Password gate — shared by admin.html and gated case studies
   ============================================================ */
html.gate-locked, html.gate-locked body { overflow: hidden; height: 100%; }
html:not(.gate-locked) .gate-overlay { display: none; }
.gate-overlay {
  position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  padding: 28px;
  background:
    radial-gradient(1100px 520px at 88% -10%, rgba(15,163,177,.30), transparent 62%),
    radial-gradient(760px 420px at 4% 108%, rgba(139,197,63,.13), transparent 60%),
    linear-gradient(168deg, var(--navy) 0%, var(--navy-900) 100%);
}
.gate-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 40px 32px; text-align: center; box-shadow: 0 24px 60px -20px rgba(0,0,0,.5); }
.gate-card .gate-icon { width: 42px; height: 42px; margin: 0 auto 18px; color: var(--accent); }
.gate-card h2 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: var(--text); margin: 0 0 8px; line-height: 1.3; }
.gate-card p { font-size: 14.5px; color: var(--text-muted); margin: 0 0 22px; line-height: 1.5; }
.gate-signin { display: flex; justify-content: center; min-height: 44px; }
.gate-card .gate-error { font-size: 13.5px; color: var(--accent-warm); margin: 14px 0 0; min-height: 1.2em; }
.gate-back { display: inline-block; margin-top: 18px; font-size: 13px; color: var(--text-muted); text-decoration: none; }
.gate-back:hover { color: var(--text); }

.admin-signout-row { text-align: center; margin-top: var(--space-4); }
.admin-signout { font: inherit; font-size: 0.85rem; color: var(--text-muted); background: none; border: none; text-decoration: underline; cursor: pointer; }
.admin-signout:hover { color: var(--text); }

/* ============================================================
   Admin — media library
   ============================================================ */
.admin-header { padding: var(--space-5) 0 var(--space-3); }
.admin-header h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: var(--space-1); }
.admin-header .stat-line { color: var(--text-muted); font-size: 0.95rem; }
.admin-main { padding-bottom: var(--space-6); }
.admin-folder { margin-bottom: var(--space-5); }
.admin-folder h2 { font-size: 1.4rem; margin-bottom: var(--space-1); }
.admin-folder .folder-meta { color: var(--text-muted); font-size: 0.88rem; margin-bottom: var(--space-2); }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-2); }
.admin-item { background: var(--panel-bg-solid); border: 1px solid var(--panel-border); border-radius: var(--radius-sm); overflow: hidden; }
.admin-item .thumb-wrap { aspect-ratio: 4/3; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.admin-item img, .admin-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-item .meta { padding: 0.6em 0.8em; font-size: 0.78rem; color: var(--text-muted); }
.admin-item .meta .name { color: var(--text); font-weight: 600; word-break: break-all; display: block; margin-bottom: 2px; }
.admin-loading, .admin-error { color: var(--text-muted); padding: var(--space-4) 0; text-align: center; }

.admin-tabs { display: flex; gap: var(--space-1); margin-top: var(--space-3); border-bottom: 1px solid var(--hairline); }
.admin-tab {
  font: inherit; font-family: var(--font-display); font-size: 0.95rem; font-weight: 600;
  color: var(--text-muted); background: none; border: none; cursor: pointer;
  padding: 0.7em 0.2em; margin-right: var(--space-3); border-bottom: 2px solid transparent; transition: color 0.15s ease;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

.content-editor { max-width: 640px; }
.content-page-picker {
  display: block; font-family: var(--font-display); font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: var(--space-3);
}
.content-page-picker select {
  display: block; width: 100%; margin-top: 0.4em; font: inherit; font-size: 0.98rem;
  padding: 0.6em 0.8em; border: 1px solid var(--panel-border); border-radius: var(--radius-sm); background: #fff;
}
.content-field { margin-bottom: var(--space-3); }
.content-field label { display: block; font-family: var(--font-display); font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.4em; }
.content-field input[type="text"], .content-field textarea {
  display: block; width: 100%; font: inherit; font-size: 0.98rem; line-height: 1.5;
  padding: 0.65em 0.85em; border: 1px solid var(--panel-border); border-radius: var(--radius-sm);
  outline: none; resize: vertical; transition: border-color 0.15s ease;
}
.content-field input[type="text"]:focus, .content-field textarea:focus { border-color: var(--accent); }
.content-save-row { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-4); }
.content-save-row button {
  font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; color: #fff; background: var(--btn-bg);
  border: none; border-radius: var(--radius-sm); padding: 0.75em 1.5em; cursor: pointer; transition: background 0.15s ease;
}
.content-save-row button:hover { background: var(--accent); }
.content-save-status { font-size: 0.88rem; color: var(--text-muted); }

.upload-box { background: var(--panel-bg-solid); border: 1px solid var(--panel-border); border-radius: var(--radius); padding: var(--space-3); margin-bottom: var(--space-5); }
.upload-box h2 { font-size: 1.15rem; margin-bottom: 0.3em; }
.upload-hint { font-size: 0.85rem; color: var(--text-muted); margin-bottom: var(--space-2); }
#upload-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; }
#upload-form label { display: flex; flex-direction: column; gap: 0.4em; font-family: var(--font-display); font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
#upload-form select, #upload-form input[type="text"], #upload-form input[type="file"] {
  font: inherit; font-size: 0.92rem; padding: 0.55em 0.7em; border: 1px solid var(--panel-border); border-radius: var(--radius-sm); background: #fff;
}
#upload-form input[type="text"] { width: 200px; }
#upload-submit {
  font-family: var(--font-display); font-weight: 600; font-size: 0.92rem; color: #fff; background: var(--btn-bg);
  border: none; border-radius: var(--radius-sm); padding: 0.6em 1.3em; cursor: pointer; height: fit-content; transition: background 0.15s ease;
}
#upload-submit:hover { background: var(--accent); }
.upload-status { font-size: 0.85rem; color: var(--text-muted); margin-top: var(--space-2); margin-bottom: 0; }

