/*
  Page + content styles — gary.design (Kirby)

  Ported from the per-page and per-component <style> blocks in the Astro build.

  ⚠️ SPECIFICITY NOTE — read before editing.
  Astro scoped every component's CSS, compiling `.foo` to `.foo[data-astro-cid-…]`
  (0,2,0). That silently out-ranked global.css's `ul[role="list"] { padding: 0 }` (0,1,1).
  Without scoping, a bare class (0,1,0) LOSES to that rule. So any list that needs its own
  padding is written as a descendant selector here. Don't "simplify" those back to a single
  class — it will silently flatten the padding.
*/

/* ============================================================
   SHARED
   ============================================================ */

.eyebrow {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--step--1);
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  text-decoration: none;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
}
.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}
.section-head h2 {
  font-size: var(--step-3);
}
.section-link {
  text-decoration: none;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.section-link:hover {
  color: var(--accent-hover);
}

/* Card grid, shared by home / portfolio index / tailored portfolios.

   The track minimum sets how many fit per row. At 22rem only two fit inside the 940px
   container; 17rem lets three sit comfortably and still collapses to 2-up and then 1-up
   on its own as the viewport narrows — no media queries needed. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: var(--space-md);
}

/* ============================================================
   HOME
   ============================================================ */

.hero {
  padding-block: var(--space-2xl) var(--space-xl);
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: var(--space-xl);
  align-items: center;
}
.hero h1 {
  font-size: var(--step-5);
  max-width: 14ch;
}
.hero-lede {
  margin-top: var(--space-md);
  font-size: var(--step-1);
  color: var(--text-soft);
  max-width: 54ch;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}
.hero-portrait {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
@media (max-width: 46rem) {
  .hero {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  .hero-portrait {
    max-width: 16rem;
    order: -1;
  }
}

.featured {
  padding-block: var(--space-xl) var(--space-2xl);
}

/* NOTE ON TRAILING SPACE BEFORE THE FOOTER
   .site-footer owns the gap above itself (margin-top: var(--space-2xl)). These page
   wrappers used to ALSO carry padding-bottom: var(--space-2xl), so the two stacked into
   192px of dead space — inherited from the Astro build, where Footer.astro and each page
   both set it. The footer's margin is now the single source of truth.
   .testimonials is deliberately NOT in this list: it's a full-bleed band with its own
   background, so its bottom padding is internal to the coloured area, not space before
   the footer. */

/* ============================================================
   PORTFOLIO INDEX
   ============================================================ */

.portfolio-intro {
  padding-block: var(--space-2xl) var(--space-lg);
}
/* In the Astro build this padding lived on the <ul> itself, which also carried
   .container — and BOTH lost to ul[role="list"]{padding:0}, so the cards ran to the
   screen edge on mobile. Fixed structurally: the wrapper owns the padding, the list
   only does layout. */
.portfolio-grid {
  /* Wider than the 940px reading container. That width is tuned for prose measure; a
     3-column card grid inside it squeezes cards to ~287px, which wraps summaries to
     eight lines. --maxw-wide gives ~340px cards and much calmer wrapping. The intro
     heading above stays at the normal container width so the page still reads as one
     column of content. */
  max-width: var(--maxw-wide);
}
.portfolio-empty {
  color: var(--text-soft);
}

/* ============================================================
   CASE STUDY CARD
   ============================================================ */

.cs-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.cs-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.cs-card-media {
  aspect-ratio: 16 / 9;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
.cs-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cs-card-ph {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--surface-alt), var(--accent-soft));
}
.cs-card-body {
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  flex: 1;
}
.cs-card-title {
  font-size: var(--step-2);
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.cs-card-badge {
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent-2);
  background: var(--accent-2-soft);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
}
.cs-card-client {
  margin-top: var(--space-xs);
  color: var(--accent);
  font-weight: 600;
  font-size: var(--step--1);
}
.cs-card-summary {
  margin-top: var(--space-sm);
  color: var(--text-soft);
}
/* Descendant selector required — see the specificity note at the top. */
.cs-card .cs-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  padding: var(--space-md) 0 0;
}
.cs-card-tags li {
  font-size: var(--step--1);
  color: var(--text-soft);
  background: var(--surface-alt);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* ============================================================
   CASE STUDY PAGE
   ============================================================ */

/* Hero video — wider than the text column so it lands as the hook. */
.cs-hero {
  width: 100%;
  max-width: var(--maxw-wide);
  margin-inline: auto;
  padding-inline: var(--space-md);
  margin-top: var(--space-lg);
}

.cs-header {
  margin-top: var(--space-xl);
}
.cs-client {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--step--1);
  color: var(--accent);
  margin-bottom: var(--space-xs);
}
.cs-header h1 {
  font-size: var(--step-4);
}
.cs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  margin-top: var(--space-md);
}
.cs-meta dt {
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
.cs-meta dd {
  font-weight: 600;
  color: var(--text);
}
.cs-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}
.cs-tags li {
  font-size: var(--step--1);
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
}

.cs-summary {
  margin-top: var(--space-lg);
}
.cs-summary p {
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.5;
  color: var(--text);
  max-width: 60ch;
}

/* Draft / unlisted notice — only ever shown to a logged-in editor. */
.cs-status-note {
  margin-top: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--accent-2-soft);
  color: var(--accent-2);
  font-weight: 600;
  font-size: var(--step--1);
  max-width: none;
}

/* ---- Narrative body (blocks) ---- */
.cs-body {
  margin-top: var(--space-xl);
}
.cs-body > * + * {
  margin-top: var(--space-md);
}
.cs-body h2 {
  margin-top: var(--space-2xl);
  font-size: var(--step-2);
}
.cs-body h3 {
  margin-top: var(--space-xl);
  font-size: var(--step-1);
}
.cs-body p,
.cs-body li {
  max-width: 68ch;
}
.cs-body ul,
.cs-body ol {
  padding-left: 1.4em;
  display: grid;
  gap: var(--space-xs);
}
.cs-body li {
  list-style: disc;
}
.cs-body ol li {
  list-style: decimal;
}

/* Inline code. Neither the Astro build nor Kirby styled this, so `/Applications`
   and friends fell back to the browser default — monospace at ~0.85em, which reads as
   shrunken and accidental next to the body face. `1em` on the font-size keeps the
   monospace glyphs optically level with surrounding text. */
.cs-body code,
.callout-body code,
.about-body code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text);
  word-break: break-word;
}

/* Code blocks (the Code block type) — scroll rather than break the layout. */
.cs-body pre {
  overflow-x: auto;
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  max-width: 100%;
}
.cs-body pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--step--1);
}

/* Prev / next — never dead-end. */
.cs-nav {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-md);
  align-items: center;
}
.cs-nav a {
  text-decoration: none;
  color: var(--text);
  display: inline-flex;
  flex-direction: column;
  font-weight: 600;
}
.cs-nav a:hover {
  color: var(--accent);
}
.cs-nav-next {
  text-align: right;
}
.cs-nav span {
  font-size: var(--step--1);
  font-weight: 400;
  color: var(--text-faint);
}
.cs-nav-all {
  text-decoration: none;
  font-weight: 600;
  color: var(--text-soft);
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}
.cs-nav-all:hover {
  color: var(--accent);
  border-color: var(--accent);
}
@media (max-width: 34rem) {
  .cs-nav {
    grid-template-columns: 1fr;
    justify-items: start;
  }
  .cs-nav-next {
    text-align: left;
  }
}

/* ============================================================
   CASE STUDY VIDEO
   ============================================================ */

.cs-video {
  margin: 0;
}
.cs-video-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-alt);
}
.cs-video-media,
.cs-video-frame .cs-video-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}

/* Placeholder ("coming soon") */
.cs-video-ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--surface-alt), var(--accent-soft));
}
.cs-video-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--text-soft);
  font-weight: 600;
  font-size: var(--step--1);
}
.cs-video-badge .cs-video-badge-icon {
  inline-size: 1.1rem;
  block-size: 1.1rem;
  color: var(--accent);
}

/* Click-to-load facade — no third-party JS until the user presses play. */
.cs-video-facade {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
  background: var(--surface-alt);
}
.cs-video-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  inline-size: 4.5rem;
  block-size: 4.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 92%, transparent);
  color: #fff;
  transition: transform 0.15s ease, background 0.15s ease;
}
.cs-video-play .cs-video-play-icon {
  inline-size: 1.8rem;
  block-size: 1.8rem;
  margin-inline-start: 0.15rem; /* optically center the triangle */
}
.cs-video-facade:hover .cs-video-play {
  background: var(--accent);
  transform: translate(-50%, -50%) scale(1.06);
}
.cs-video-cap {
  margin-top: var(--space-sm);
  font-size: var(--step--1);
  color: var(--text-soft);
  text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .cs-video-facade:hover .cs-video-play {
    transform: translate(-50%, -50%);
  }
}

/* ============================================================
   NARRATIVE BLOCKS  (figure / gallery / callout / metrics)
   ============================================================ */

.figure {
  margin-block: var(--space-lg);
}
.figure-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.figure-ph {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-xs);
  width: 100%;
  background: var(--surface-alt);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-faint);
}
.figure-ph .figure-ph-icon {
  inline-size: 2rem;
  block-size: 2rem;
  opacity: 0.75;
}
.figure-ph-label {
  font-size: var(--step--1);
}
.figure-cap {
  margin-top: var(--space-sm);
  font-size: var(--step--1);
  color: var(--text-soft);
  line-height: 1.4;
}

.gallery {
  margin-block: var(--space-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-md);
}
/* Figures inside a gallery shouldn't carry their own vertical margins. */
.gallery .figure {
  margin-block: 0;
}

.callout {
  margin-block: var(--space-xl);
  background: var(--surface-alt);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-md) var(--space-lg);
}
.callout-body {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-1);
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text);
  max-width: 46ch;
}
.callout-body p {
  max-width: 46ch;
}
/* Space Grotesk has NO italic, and global.css sets `font-synthesis: none` (deliberately —
   we never want a faked slant). Net effect: <em> inside a callout rendered *identically*
   to the surrounding text, so emphasis was silently lost. Fall back to the body face,
   which has a true italic, for emphasis only.
   Judgment call: mixing faces mid-sentence is a trade for keeping the meaning visible. */
.callout-body em,
.callout-body i {
  font-family: var(--font-body);
  font-style: italic;
}
.callout-attr {
  margin-top: var(--space-sm);
  color: var(--text-soft);
  font-size: var(--step--1);
}

/* Descendant selector required — see the specificity note at the top. */
.cs-body .metrics,
.metrics {
  margin-block: var(--space-xl);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--space-md);
}
.metric {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  list-style: none;
}
.metric-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-3);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent);
}
.metric-label {
  font-size: var(--step--1);
  color: var(--text-soft);
  line-height: 1.3;
}

/* ============================================================
   TESTIMONIALS
   ============================================================ */

.testimonials {
  padding-block: var(--space-2xl);
  background: var(--surface-alt);
  border-block: 1px solid var(--border);
}
/* When the band is the last thing on the page, the footer's border-top sits directly
   against the band's border-bottom (the footer has no top margin), and the two 1px rules
   read as a single 2px line. Drop the band's own bottom border in that case and let the
   footer's border close it. */
main > .testimonials:last-child {
  border-bottom: 0;
}
.testimonials h2 {
  font-size: var(--step-3);
  max-width: 20ch;
}
.t-grid {
  margin-top: var(--space-xl);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: var(--space-md);
}
.t-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
}
.t-quote {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}
.t-quote::before,
.t-quote::after {
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
}
.t-quote::before { content: '\201C'; }
.t-quote::after  { content: '\201D'; }
.t-person {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.t-avatar {
  inline-size: 3rem;
  block-size: 3rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.t-person-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.t-name {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text);
}
.t-role {
  font-size: var(--step--1);
  color: var(--text-soft);
}

/* ============================================================
   ABOUT
   ============================================================ */

.about-hero {
  padding-block: var(--space-2xl) var(--space-xl);
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-xl);
  align-items: center;
}
.about-hero h1 {
  font-size: var(--step-4);
}
.about-lede {
  margin-top: var(--space-md);
  font-size: var(--step-1);
  color: var(--text-soft);
}
.portrait {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.about-body {
  display: grid;
  gap: var(--space-2xl);
}
.about-body .block h2 {
  font-size: var(--step-2);
  margin-bottom: var(--space-md);
}
.about-body .block > * + * {
  margin-top: var(--space-md);
}
.about-body .block p,
.about-body .block li {
  max-width: 68ch;
}
.certs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: var(--space-lg);
}
.cert {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
}
.cert-badge {
  width: 4rem;
  height: auto;
  flex-shrink: 0;
}
.cert-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
}
.cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
@media (max-width: 46rem) {
  .about-hero {
    grid-template-columns: 1fr;
  }
  .portrait {
    max-width: 18rem;
    order: -1;
  }
}

/* ============================================================
   CONTACT FORM
   ============================================================ */

.contact-intro {
  padding-block: var(--space-2xl) var(--space-lg);
}
.contact-wrap {
}
.form {
  display: grid;
  gap: var(--space-md);
  max-width: 34rem;
}
/* Honeypot — off-screen, never shown to a real person. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.field {
  display: grid;
  gap: 0.4rem;
}
.form label {
  font-weight: 600;
  color: var(--text);
}
.form input,
.form textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
}
.form textarea {
  resize: vertical;
}
.form input[aria-invalid='true'],
.form textarea[aria-invalid='true'] {
  border-color: var(--accent-2);
}
.field-error {
  color: var(--accent-2);
  font-size: var(--step--1);
  font-weight: 600;
  margin: 0;
}
.submit {
  justify-self: start;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  padding: 0.7rem 1.5rem;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.submit:hover {
  background: var(--accent-hover);
}
.submit[disabled] {
  opacity: 0.6;
  cursor: progress;
}
.form-status {
  margin: 0;
  font-weight: 600;
}
.form-status[data-state='success'] {
  color: var(--accent);
}
.form-status[data-state='error'] {
  color: var(--accent-2);
}

/* ============================================================
   TAILORED PORTFOLIOS  (/p/*)
   ============================================================ */

.tailored-head {
  padding-block: var(--space-2xl) var(--space-lg);
}
.tailored-head h1 {
  font-size: var(--step-4);
}
.tailored-intro {
  margin-top: var(--space-md);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--text);
  max-width: 60ch;
}
.tailored-body {
  margin-top: var(--space-md);
  color: var(--text-soft);
  max-width: 68ch;
}
.tailored-body p {
  max-width: 68ch;
}
.tailored-body > * + * {
  margin-top: var(--space-md);
}
.tailored-work {
}
.tailored-foot {
  margin-top: var(--space-xl);
}
.tailored-foot a {
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
}
.tailored-foot a:hover {
  color: var(--accent-hover);
}

/* ============================================================
   404
   ============================================================ */

.error-page {
  padding-block: var(--space-2xl) 0;
  text-align: center;
}
.error-page p {
  margin-inline: auto;
}
