/* ==========================================================================
   Meldroch, LLC — Responsive
   Mobile-first refinements. Breakpoints: 480 / 720 / 960 / 1440
   ========================================================================== */


/* ---------- ≤ 1100px: narrow desktop / tablet landscape ----------
   The pricing charts are the widest thing on the site. Tightening the
   cells here lets them fit outright instead of handing the reader a
   sideways scroll inside the table. */
@media (max-width: 1100px) {
  .service-table { font-size: 0.9rem; }
  .service-table th,
  .service-table td { padding: 0.85rem 0.8rem; }
}

/* ---------- ≤ 960px: tablet ---------- */
@media (max-width: 960px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }

  /* Showcase: two cards visible */
  .project-card { width: min(44vw, 23rem); }

  /* Single column — and the form leads. Stacked the other way the
     "what happens next" panel pushed the form a full screen down. */
  .contact-layout { grid-template-columns: 1fr; }
  .contact-layout .contact-form { order: -1; }

  /* Reviews: stack the form above the status card */
  .review-intro-grid { grid-template-columns: 1fr; }

  /* Access: cover above the fields */
  .proj-grid { grid-template-columns: 1fr; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > .footer-about { grid-column: 1 / -1; }
}

/* ---------- ≤ 840px: mobile navigation ---------- */
@media (max-width: 840px) {
  .nav-toggle { display: inline-flex; }

  .nav-links {
    position: fixed;
    inset: 0;
    z-index: var(--z-menu);
    flex-direction: column;
    justify-content: center;
    gap: 0.6rem;
    background: rgba(8, 8, 11, 0.92);
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-2%);
    transition:
      opacity var(--dur) var(--ease-out),
      transform var(--dur) var(--ease-out),
      visibility var(--dur);
  }

  .nav-links.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-links li {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  }

  .nav-links.open li { opacity: 1; transform: translateY(0); }
  .nav-links.open li:nth-child(1) { transition-delay: 60ms; }
  .nav-links.open li:nth-child(2) { transition-delay: 110ms; }
  .nav-links.open li:nth-child(3) { transition-delay: 160ms; }
  .nav-links.open li:nth-child(4) { transition-delay: 210ms; }
  .nav-links.open li:nth-child(5) { transition-delay: 260ms; }
  .nav-links.open li:nth-child(6) { transition-delay: 310ms; }

  .nav-links a:not(.btn) {
    font-size: 1.4rem;
    font-family: var(--font-display);
    padding: 0.8rem 1.4rem;
  }

  .nav-links a:not(.btn)::after { left: 1.4rem; right: 1.4rem; bottom: 0.5rem; }

  .nav-cta-item { margin-left: 0; margin-top: 1rem; }
  .nav-cta-item .btn { min-height: 3.2rem; padding: 0.9rem 2.2rem; font-size: 1rem; }
}

/* ---------- ≤ 720px: small tablets / large phones ---------- */
@media (max-width: 720px) {
  /* ── Phone scale ──────────────────────────────────────────────────
     Everything compact lives here and nowhere else. Desktop keeps the
     full-size scale; a phone gets a tighter type ramp, tighter surface
     padding, and a shorter section rhythm, because the same
     proportions that read as generous on a 1440px screen read as bulky
     on a 390px one.
     NOTE: form inputs stay at 16px — anything smaller makes iOS Safari
     zoom the page on focus. */
  :root {
    --fs-hero: clamp(2.25rem, 2vw + 1.6rem, 3.4rem);
    --fs-h1: clamp(1.9rem, 1.6vw + 1.35rem, 2.75rem);
    --fs-h2: clamp(1.45rem, 1vw + 1.1rem, 2rem);
    --fs-h3: clamp(1.1rem, 0.35vw + 1rem, 1.3rem);
    --fs-body: clamp(0.975rem, 0.15vw + 0.94rem, 1rem);
    --fs-small: 0.85rem;

    --section-pad: 3.25rem;
    --pad-card: 1.15rem;
    --pad-compact: 0.9rem;
  }

  .eyebrow { letter-spacing: 0.18em; margin-bottom: 0.8rem; }
  .eyebrow::before { width: 1.4rem; }

  .section-head { margin-bottom: 1.5rem; }
  .section-title { margin-bottom: 0.5rem; }
  .section-sub { font-size: 1rem; }

  .card-icon { width: 2.25rem; height: 2.25rem; margin-bottom: 0.75rem; }
  .card-icon svg { width: 20px; height: 20px; }
  .card h3 { margin-bottom: 0.4rem; }
  .card p { font-size: 0.95rem; }

  /* A logo does not earn 288px of a phone screen */
  .brand-panel { min-height: clamp(8rem, 20vw, 14rem); }
  .brand-panel img { width: clamp(6.5rem, 38%, 11rem); }

  .grid-2, .grid-3, .value-list, .terms-list { gap: var(--space-sm); }

  /* 44px stays the floor for anything you tap */
  .btn { min-height: 2.875rem; padding: 0.7rem 1.5rem; }
  .btn-small { min-height: 2.5rem; }

  /* Hero */
  .hero-badge { margin-bottom: 1.1rem; }
  .hero h1 { margin-bottom: 1rem; }
  .hero-sub { margin-bottom: 1.75rem; }

  .page-hero { padding-top: clamp(4.75rem, 11vw, 5.75rem); padding-bottom: 1.5rem; }
  .page-hero h1 { margin-bottom: 0.6rem; }
  .page-hero p:not(.eyebrow) { font-size: 1rem; max-width: 40rem; }

  /* Contact leads with the form, so its heading takes a little less
     room than other pages — but at the same type size as everywhere
     else. Shrinking it further is what made this page read as cramped. */
  .page-hero.page-hero-tight { padding-top: 4.75rem; padding-bottom: 1.1rem; }
  .page-hero-tight h1 { margin-bottom: 0.5rem; }

  .cta-band { padding: 1.75rem 1.25rem; }
  .cta-band h2 { margin-bottom: 0.6rem; }
  .cta-band p { margin-bottom: 1.1rem; }

  /* A value is a heading and two lines — a list row, not a feature
     card, so it takes the compact padding. */
  .value-item { padding: var(--pad-compact) var(--pad-card); gap: 0.85rem; }

  /* Footer */
  .site-footer { padding-top: 2.5rem; }
  .footer-grid { margin-bottom: var(--space-lg); }

  /* Stars keep a full 44px tap target */
  .star-input button { width: 2.75rem; height: 2.75rem; }
  .star-input button svg { width: 1.6rem; height: 1.6rem; }

  .grid-2 { grid-template-columns: 1fr; }

  .stats-strip { grid-template-columns: 1fr; gap: 1rem; }

  .review-ghost-row { grid-template-columns: 1fr; }
  .review-ghost:nth-child(3) { display: none; }

  /* Services: swap table for stacked cards */
  .table-wrap.swap-mobile { display: none; }
  .service-cards { display: grid; }

  /* Scroll-reveal stages keep working on phones. Copy sits a step below
     body size so a chapter fits its stage without inner scrolling — and
     if it still cannot fit, js/journey.js drops to a static list.
     Each panel also gets less scroll travel than on desktop, so the
     section costs less of a phone's scrolling. */
  .journey-live { height: calc(100dvh + (var(--steps) - 1) * 32dvh); }
  .vstack-live { height: calc(100dvh + (var(--steps) - 1) * 28dvh); }
  .journey-live .journey-viewport { height: min(40rem, 88dvh); }
  .journey-text { padding: 1.4rem 1.25rem; }
  .journey-text .jr-date { font-size: 0.7rem; }
  .journey-text h3 { font-size: 1.15rem; margin: 0.4rem 0 0.6rem; }
  .journey-text p { font-size: 0.92rem; line-height: 1.62; }
  .journey-text p + p { margin-top: 0.7rem; }
  .journey-text-inner { max-width: none; }

  /* Support terms */
  .vstack-live .vstack-viewport { height: min(22rem, 50dvh); }
  .vstack-live .vstack-panel { padding: 1.4rem 1.25rem; }
  .vstack-live .vstack-panel h3 { font-size: 1.1rem; margin-bottom: 0.6rem; }
  .term-item p { font-size: 0.92rem; line-height: 1.58; }

  /* Showcase: one large card on the stage, compact copy */
  .project-card { width: min(86vw, 24rem); }
  .showcase-track { gap: 1.1rem; }
  .showcase-live { --stage-card-w: 90vw; }
  .showcase-live .pc-media { height: clamp(9rem, 27dvh, 15rem); }
  .pc-address { font-size: 0.68rem; }
  .pc-toolbar { padding: 0.6rem 0.85rem; }
  .pc-industry { font-size: 0.68rem; }
  .pc-name { font-size: 1.1rem; }
  .pc-desc { font-size: 0.9rem; -webkit-line-clamp: 3; }
  .pc-body { padding: 1.05rem 1.15rem 1.2rem; gap: 0.4rem; }
  .pc-visit { margin-top: 0.45rem; }

  .form-grid { grid-template-columns: 1fr; gap: 0.85rem; }

  .field-error { font-size: 0.8rem; line-height: 1.3; }

  /* Comfortable to fill in one-handed: a 44px control is the floor for
     a touch target, and the label needs enough room off the field that
     the two do not read as one block. */
  .form-field { gap: 0.35rem; }
  .form-field input,
  .form-field select,
  .form-field textarea { min-height: 2.75rem; padding: 0.5rem 0.85rem; }
  /* 4.2em = three whole lines plus padding, at any text size */
  .form-field textarea { min-height: 4.2em; padding-block: 0.45em; }
  .contact-form { padding: 1.5rem 1.35rem; }

  /* Content-driven rather than a forced full screen: a phone cannot
     spare a whole viewport to show the headline and two buttons. */
  .hero { min-height: auto; padding-top: 7rem; padding-bottom: 3rem; }
  .hero-scroll { display: none; }
  .hero-actions .btn { width: 100%; max-width: 22rem; }
}

/* ---------- ≤ 480px: phones ---------- */
@media (max-width: 480px) {
  :root { --gutter: 1.15rem; }

  .grid-3 { grid-template-columns: 1fr; }

  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }

  .footer-bottom { flex-direction: column; }

  .cta-band { padding-inline: 1.3rem; }

  .form-footer { flex-direction: column; align-items: stretch; }
  .form-footer .btn { width: 100%; }
  .form-status { justify-content: center; }
}

/* ---------- ≥ 1440px: large desktop / ultrawide ---------- */
@media (min-width: 1440px) {
  :root { --container: 84rem; }
}

/* Ultrawide: keep ambient art proportional, never stretch content */
@media (min-width: 2200px) {
  .ambient { background-size: cover; }
}

/* ---------- Short viewports (landscape phones, short windows) ---------- */
@media (max-height: 560px) and (orientation: landscape) {
  .hero { min-height: auto; padding-top: 8rem; padding-bottom: 5rem; }
  .hero-scroll { display: none; }
  .intro-logo { margin-bottom: 1rem; width: 3.4rem; }
  .intro-hint { margin: 1rem 0 1.1rem; }
  /* Tighten the gate so the button stays reachable without scrolling */
  .intro-lede { margin-top: 1rem; font-size: 0.92rem; line-height: 1.6; }
  .intro-note { margin-top: 1rem; }
}

/* ---------- Intro gate on phones ---------- */
@media (max-width: 640px) {
  .intro-inner { padding: 2.25rem 1.35rem; }
  .intro-lede { margin-top: 1.25rem; line-height: 1.7; }
  .intro-hint { margin: 1.6rem 0 1.25rem; letter-spacing: 0.22em; }
  /* Full-width gateway buttons read better than a narrow pill on mobile */
  .intro-actions .intro-enter { width: 100%; max-width: 20rem; padding-inline: 1.5rem; }
  .intro-note { margin-top: 1.2rem; font-size: 0.72rem; }
}

/* Short desktop windows (720px-tall laptops, or any browser that
   isn't full height): the contact heading gives back the margin the
   form needs, without touching the card padding. */
@media (min-width: 721px) and (max-height: 820px) {
  /* Matches the base rule's `.page-hero.page-hero-tight` specificity;
     a lone .page-hero-tight here silently loses and does nothing. */
  .page-hero.page-hero-tight { padding-top: 4.6rem; padding-bottom: 1rem; }
  .page-hero-tight h1 { margin-bottom: 0.4rem; }
}

/* ---------- Short phones (iPhone SE class) ----------
   Trims the contact heading so more of the form is visible on landing,
   without shrinking any control below a comfortable size. The form is
   allowed to run past the fold here — three tiers of ever-smaller type
   chasing a single screen is what made this page feel cramped. */
@media (max-width: 720px) and (max-height: 780px) {
  .page-hero.page-hero-tight { padding-top: 4.4rem; padding-bottom: 1rem; }
  .page-hero-tight h1 { margin-bottom: 0.5rem; }
  .page-hero-tight p { max-width: 32rem; }
}

/* Landscape phones and other very short windows. The stage copy tightens
   a step so a card can still fit; if it cannot, js/journey.js and
   js/stack.js drop the section to a plain stacked list rather than
   shrinking type past the point of comfortable reading. */
@media (max-height: 620px) {
  .journey-text { padding: 1.1rem 1.5rem; }
  .journey-text .jr-date { font-size: 0.68rem; }
  .journey-text h3 { font-size: 1.1rem; margin: 0.3rem 0 0.5rem; }
  .journey-text p { font-size: 0.9rem; line-height: 1.55; }
  .journey-text p + p { margin-top: 0.55rem; }

  .vstack-live .vstack-panel { padding: 1.1rem 1.5rem; }
  .vstack-live .vstack-panel h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
  .vstack-live .vstack-panel p { font-size: 0.9rem; line-height: 1.55; }

  .showcase-live .pc-media { height: min(34dvh, 12rem); }
  .showcase-live .pc-toolbar { padding: 0.45rem 0.8rem; }
  .showcase-live .pc-industry { font-size: 0.6rem; }
  .showcase-live .pc-name { font-size: 0.95rem; }
  .showcase-live .pc-desc { font-size: 0.76rem; -webkit-line-clamp: 2; }
  .showcase-live .pc-body { padding: 0.7rem 1rem 0.8rem; }
  .showcase-live .showcase-controls { margin-top: 0.7rem; }
  .showcase-nav { width: 2.5rem; height: 2.5rem; }
}

/* ---------- Touch devices: neutralize hover lifts ---------- */
@media (hover: none) {
  .card:hover { transform: none; }
  .btn:hover { transform: none; }

  /* The type got smaller, the tap target must not: 44px is the floor
     for anything you press with a thumb. Desktop keeps the compact
     36px small button since a cursor doesn't need the padding. */
  .btn-small { min-height: 2.75rem; }
  .star-input button { width: 2.75rem; height: 2.75rem; }
}

/* ==========================================================================
   Services dropdown + video editing portfolio
   ========================================================================== */

/* ---------- ≤ 960px: access editor stacks ---------- */
@media (max-width: 960px) {
  .vp-grid { grid-template-columns: 1fr; }
}

/* ---------- ≤ 840px: the dropdown inside the mobile menu ----------
   No hover to hang a flyout off, and the new page must not be buried, so
   the two destinations sit in the sheet as a group under Services rather
   than behind a second tap. The group starts open every time the menu
   opens (js/navigation.js). */
@media (max-width: 840px) {
  /* The menu now holds a group as well as its links, so it has to be able
     to scroll on a short phone. `safe center` keeps the block centred when
     it fits without clipping the top when it doesn't. */
  .nav-links {
    justify-content: center;
    justify-content: safe center;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-block: 5rem 2.5rem;
  }

  .nav-dropdown {
    position: static;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .nav-dropdown-toggle {
    font-family: var(--font-display);
    font-size: 1.4rem;
    padding: 0.8rem 1.4rem;
  }

  .nav-dropdown-toggle::after { left: 1.4rem; right: 1.4rem; bottom: 0.5rem; }
  .nav-caret { width: 0.9rem; height: 0.9rem; }

  /* In flow rather than floating. Height animates instead of the panel
     sliding, because a static box still takes its space either way. */
  .nav-menu {
    position: static;
    translate: none;
    transform: none;
    width: min(21rem, 100%);
    max-height: 0;
    padding: 0;
    gap: 0.3rem;
    overflow: hidden;
    border: 0;
    border-radius: var(--radius);
    background: none;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transition:
      max-height var(--dur) var(--ease-out),
      opacity var(--dur) var(--ease-out),
      visibility var(--dur);
  }

  .nav-dropdown.open .nav-menu {
    transform: none;
    max-height: 18rem;
    padding: 0.4rem 0 0.2rem;
  }

  .nav-links .nav-menu .nav-menu-item {
    padding: 0.7rem 0.9rem;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
  }

  .nav-links .nav-menu .nav-menu-item[aria-current="page"] {
    background: rgba(232, 184, 75, 0.13);
    border-color: rgba(232, 184, 75, 0.32);
  }

  .nav-menu-text strong { font-size: 1rem; }
  .nav-menu-text small { font-size: 0.8rem; }
}

/* ---------- ≤ 720px: portfolio on phones ----------
   One column with full-width cards. A 16:9 card at 390px is ~200px tall —
   large enough to read the frame and comfortably bigger than any tap
   target needs to be. */
@media (max-width: 720px) {
  .reel-grid {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }

  /* Nothing spans two tracks when there is only one */
  .reel-grid .reel-card.is-featured { grid-column: auto; }

  .reel-meta { padding: 0.95rem 1.05rem 1rem; }
  .reel-title { font-size: 1.05rem; }
  .reel-cat { font-size: 0.67rem; }
  .reel-play svg { width: 2.6rem; height: 2.6rem; }

  .reel-head-row { gap: 0.4rem; }
  .reel-count { font-size: 0.72rem; }

  .reel-modal { padding: 0.75rem; }
  .reel-modal-panel { padding: 0.55rem; }
  .reel-modal-close { top: 0.85rem; right: 0.85rem; width: 2.5rem; height: 2.5rem; }
  .reel-modal-info { padding: 0.95rem 0.55rem 0.35rem; }
  .reel-modal-desc { font-size: 0.93rem; }

  .vp-fields .form-row { grid-template-columns: 1fr; }
}

/* ---------- Touch: no hover to reveal the play badge ---------- */
@media (hover: none) {
  /* 0,3,0 — has to out-specify the hover rule it is cancelling */
  .reel-grid .reel-card:hover { transform: none; }
  .reel-grid .reel-card:hover .reel-thumb img { transform: none; }

  /* The affordance can't wait for a hover that never comes */
  .reel-play { opacity: 0.9; transform: none; }
  .reel-grid .reel-card:hover .reel-play { transform: none; }
}

/* ---------- Oversized CTA on phones ----------
   These live HERE, not beside .btn-xl in styles.css. The ≤720px `.btn` rule
   above is the same specificity (0,1,0) and this file loads second, so a
   .btn-xl override written in styles.css silently loses and the button
   collapses back to a normal one — measured at 46px instead of 53.6px. */
@media (max-width: 720px) {
  .btn-xl {
    width: 100%;
    max-width: 24rem;
    min-height: 3.35rem;
    padding: 0.9rem 1.4rem;
    font-size: 1rem;
  }

  .cta-note { font-size: 0.8rem; }
}

/* ---------- Creative pricing on phones ---------- */
@media (max-width: 720px) {
  .price-card .price-figure { margin: 0.9rem 0 1rem; padding-bottom: 1rem; }
  .price-list li { font-size: 0.92rem; }

  /* Stacked, and the button stops hugging the right edge */
  .price-note { gap: 0.7rem; }
  .price-note p:not(.price-note-label) { flex-basis: 100%; }
  .price-note .btn { margin-left: 0; width: 100%; }
}

/* ---------- Roomier CTA band on phones ----------
   The base `.cta-band` mobile padding above is (0,1,0); the roomy modifier
   in styles.css is (0,2,0) and would win on specificity no matter which
   file loads first — so its phone sizing has to be stated explicitly here
   or a phone inherits the full desktop padding. */
@media (max-width: 720px) {
  .cta-band.cta-band-roomy { padding: 2.4rem 1.35rem; }
  .cta-band.cta-band-roomy h2 { margin-bottom: 0.9rem; }
  .cta-band.cta-band-roomy > p:not(.cta-note) { margin-bottom: 1.6rem; }
  .cta-band.cta-band-roomy .cta-note { margin-top: 1.1rem; }
}
