/* Responsive refinements loaded after the original site styles. */
.header .brand,
.header .studio-header-actions,
.studio-hero > *,
.solution-grid > *,
.related-grid > *,
.work-grid > *,
.process-grid > *,
.studio-bento > *,
.journey-steps > *,
.product-body > *,
.contact-page > *,
.erp-section > *,
.faq > *,
.footer-directory > * { min-inline-size: 0; }

.contact-links a,
.footer-top a[href^="mailto:"],
.footer-directory a { overflow-wrap: anywhere; }

.contact-page :is(input, select, textarea) { min-inline-size: 0; max-inline-size: 100%; }
.erp-tabs, .scene-tabs { flex-wrap: wrap; }
[hidden].solution-card, [hidden]#brief-link { display: none; }
.product-hero h1, .contact-page h1, .cta h2 { overflow-wrap: anywhere; }

/* The sticky header switches before its desktop links become crowded. */
@media (max-width: 900px) {
  .header {
    display: flex;
    justify-content: space-between;
    gap: clamp(.375rem, 1.5vw, .75rem);
    padding-inline: clamp(.625rem, 4vw, 2rem);
    height: clamp(4.25rem, 10vw, 5.125rem);
  }
  .header .studio-header-actions { margin-inline-start: auto; order: 2; flex: none; }
  .header .studio-header-actions .theme-toggle {
    position: static;
    inline-size: 2.75rem;
    block-size: 2.75rem;
  }
  .header .studio-header-actions > .nav-cta { display: none; }
  .header .menu-toggle {
    display: flex;
    order: 3;
    align-items: center;
    gap: .5rem;
    min-block-size: 2.75rem;
    flex: none;
    padding-inline: .7rem;
    border: 1px solid var(--line);
    border-radius: 2rem;
    background: var(--panel);
  }
  .header #nav {
    display: none;
    position: absolute;
    top: calc(100% + .35rem);
    inset-inline: clamp(.625rem, 4vw, 2rem);
    flex-direction: column;
    align-items: stretch;
    gap: .2rem;
    padding: .5rem;
    max-block-size: calc(100vh - 6rem);
    max-block-size: calc(100dvh - 6rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .85rem;
  }
  .header #nav.open { display: flex; }
  .header #nav > a { display: flex; align-items: center; min-block-size: 2.75rem; }
  .studio-hero { grid-template-columns: minmax(0, 1fr); }
  .studio-hero .scene-viewport { height: auto; aspect-ratio: 1920 / 1560; max-block-size: 33rem; }
  .scene-tabs button { min-block-size: 2.75rem; justify-content: center; }
  .studio-hero .scene-top button { min-block-size: 2.75rem; }
  .solution-finder .finder-choices button, .erp-tabs button { min-block-size: 2.75rem; }
}

@media (min-width: 721px) and (max-width: 900px) {
  .contact-page { grid-template-columns: minmax(0, 1fr); gap: 2rem; max-width: 48rem; }
  .cta { flex-wrap: wrap; gap: 1.25rem; }
  .journey-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .process-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-bottom { flex-wrap: wrap; }
}

@media (max-width: 720px) {
  .work-grid, .process-grid { grid-template-columns: minmax(0, 1fr); }
  .product-hero .actions { gap: .65rem; }
  .contact-page .contact-links { margin-top: 1.5rem; }
  .cta { display: flex; gap: 1.25rem; flex-direction: column; align-items: flex-start; }
  .cta > .button { margin-top: 0; white-space: normal; }
  .footer-bottom { flex-wrap: wrap; }
  .footer-bottom > div { row-gap: .5rem; }
}

@media (max-width: 420px) {
  .header .brand { gap: .4rem; }
  .header .brand-wordmark { font-size: clamp(1rem, 5.2vw, 1.28rem); }
  .header .brand-wordmark small { letter-spacing: .17em; }
  .header .menu-toggle { padding-inline: .6rem; }
  .header .studio-header-actions { margin-inline-end: 0; }
  .studio-hero h1 { font-size: clamp(1.85rem, 9.2vw, 2.5rem); overflow-wrap: anywhere; }
  .contact-page h1 { font-size: clamp(1.9rem, 9vw, 2.5rem); }
  .product-hero h1 { font-size: clamp(1.9rem, 8.9vw, 2.5rem); }
  .product-body h2, .cta h2 { font-size: clamp(1.6rem, 7.7vw, 2.125rem); }
  .studio-hero .scene-tabs { padding-inline: 0; }
  .studio-hero .scene-tabs button { padding-inline: .55rem; }
  .studio-hero .scene-tabs button > span { display: none; }
  .contact-page #brief-form { padding-inline: clamp(.8rem, 5vw, 1.4rem); }
  .contact-page #brief-form .button { max-inline-size: 100%; gap: .6rem; text-align: left; }
  .product-hero .actions .button, .cta > .button { gap: .75rem; max-inline-size: 100%; }
  .workflow-preview :is(.preview-bar, .preview-title, .preview-bottom, .flow) { padding-inline: 1rem; }
  .workflow-preview .flow > div { gap: .6rem; }
  .work-poster strong { font-size: clamp(2rem, 11vw, 3.25rem); overflow-wrap: anywhere; }
  .footer-directory { gap: 1.1rem; }
}

@media (max-width: 319px) {
  .header .brand-wordmark small { display: none; }
  .header .menu-toggle > span { display: none; }
  .footer-directory { grid-template-columns: minmax(0, 1fr); }
}

/* Give the theme switch a visible, comfortably sized target. */
.header .studio-header-actions .theme-toggle {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  flex: none;
  inline-size: 2.875rem;
  block-size: 2.875rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--panel);
  line-height: 1;
}
.header .theme-toggle:hover {
  border-color: var(--blue);
  background: var(--soft-blue);
}
.header .theme-toggle:focus-visible, #scene-pause:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.header .theme-toggle .theme-icon {
  inline-size: 1.5rem;
  block-size: 1.5rem;
}
.header .theme-toggle .theme-icon-moon { display: none; }
html[data-theme="light"] .header .theme-toggle .theme-icon-sun { display: none; }
html[data-theme="light"] .header .theme-toggle .theme-icon-moon { display: block; }

/* Keep the animation controls in normal flow, before the artwork viewport. */
.studio-hero .code-scene > .scene-top {
  position: static;
  inset: auto;
  justify-content: flex-end;
  padding: 0 0 .65rem;
}
.studio-hero .code-scene #scene-pause {
  min-block-size: 2.75rem;
  padding: .5rem .9rem;
  font-size: .8125rem;
  line-height: 1.3;
  color: var(--ink);
  white-space: normal;
}
.studio-hero .code-scene #scene-pause:disabled { opacity: .75; }

@media (max-width: 900px) {
  .header .studio-header-actions .theme-toggle {
    inline-size: 3rem;
    block-size: 3rem;
  }
  .header .theme-toggle .theme-icon { inline-size: 1.625rem; block-size: 1.625rem; }
}

/* Treat the logo and two-line wordmark as one centered header lockup. */
.header .brand {
  align-items: center;
  gap: clamp(.5rem, 1vw, .8125rem);
}
.header .brand .brand-symbol {
  flex: none;
  align-self: center;
}
.header .brand .brand-wordmark {
  display: grid;
  align-content: center;
  justify-items: start;
  row-gap: .2rem;
  line-height: 1.06;
}
.header .brand .brand-wordmark small {
  display: block;
  margin: 0;
  font-size: .625rem;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: .16em;
}
@media (max-width: 720px) {
  .header .brand .brand-wordmark small {
    font-size: .5625rem;
    letter-spacing: .12em;
  }
}
@media (max-width: 359px) {
  .header .brand { gap: .4rem; }
  .header .brand .brand-wordmark { row-gap: .15rem; }
  .header .brand .brand-wordmark small { letter-spacing: .09em; }
}
