/* ==========================================================================
   Thomas Hondo Chacha — Responsive rules
   Mobile-first adjustments, navigation, layout and touch targets
   ========================================================================== */

/* ---------- Large desktop ---------- */
@media (max-width: 1240px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(350px, 0.78fr);
    gap: 3.5rem;
  }

  .hero__stage-wrap {
    max-width: 460px;
  }

  .hero-stage {
    min-height: 510px;
  }
}

/* ---------- Small desktop / tablet landscape ---------- */
@media (max-width: 1080px) {
  .brand__text {
    display: none;
  }

  .primary-nav {
    gap: 1.3rem;
  }

  .nav-list {
    gap: 1.1rem;
  }

  .hero__grid {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.72fr);
    gap: 2.5rem;
  }

  .hero__title {
    font-size: clamp(3.05rem, 6.2vw, 5.4rem);
  }

  .hero-stage {
    min-height: 470px;
    padding: 1.25rem;
  }

  .hero-float {
    right: -0.4rem;
    bottom: 1.5rem;
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 0.8rem;
  }

  .tool-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Tablet portrait / mobile navigation ---------- */
@media (max-width: 980px) {
  :root {
    --header-height: 74px;
  }

  .header__inner {
    gap: 0.8rem;
  }

  .brand__text {
    display: grid;
  }

  .nav-toggle {
    display: inline-flex;
  }

  /* A backdrop filter creates a containing block for fixed-position children.
     Disable it at this breakpoint so the mobile navigation can cover the
     viewport rather than being clipped to the header. */
  .site-header {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .site-header.is-scrolled {
    background: var(--bg);
  }

  .primary-nav {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    overflow-y: auto;
    padding: 1.25rem var(--gutter) 2.5rem;
    border-top: 1px solid var(--line);
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition:
      opacity var(--speed) ease,
      visibility var(--speed) ease,
      transform var(--speed) var(--ease-out);
  }

  .nav-open .primary-nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .nav-list {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .nav-list li {
    border-bottom: 1px solid var(--line);
  }

  .nav-link {
    width: 100%;
    min-height: 62px;
    justify-content: space-between;
    font-size: clamp(1.25rem, 4vw, 1.7rem);
    font-weight: 600;
    letter-spacing: -0.03em;
  }

  .nav-link::after {
    display: none;
  }

  .nav-link::before {
    position: absolute;
    right: 0;
    content: "↗";
    color: var(--ink-muted);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 400;
    transition: transform var(--speed), color var(--speed);
  }

  .nav-link:hover::before,
  .nav-link[aria-current="page"]::before {
    color: var(--highlight);
    transform: translate(2px, -2px);
  }

  .nav-cta {
    display: inline-flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin-top: 1.5rem;
    padding: 0.85rem 1.3rem;
    border-radius: 999px;
    background: var(--btn-bg);
    color: var(--btn-ink);
    font-size: 0.8rem;
    font-weight: 700;
  }

  .nav-cta .icon {
    width: 0.95rem;
    height: 0.95rem;
  }

  .hero {
    min-height: 0;
    padding-top: clamp(2.5rem, 6vw, 4rem);
  }

  .hero__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(2.5rem, 6vw, 4rem);
    padding-bottom: 3.5rem;
  }

  .hero__copy {
    max-width: 760px;
  }

  .hero__title {
    max-width: 12ch;
    font-size: clamp(3.2rem, 9.2vw, 6.2rem);
  }

  .hero__lede {
    max-width: 58ch;
  }

  .hero__stage-wrap {
    width: min(100%, 580px);
    max-width: 580px;
    justify-self: start;
  }

  .hero-stage {
    min-height: 500px;
  }

  .hero__stage-wrap .hero-float {
    right: 1rem;
    bottom: 1.4rem;
  }

  .hero__meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero__meta-item {
    padding: 1rem 1.1rem;
  }

  .hero__meta-item:nth-child(odd) {
    padding-left: 0;
  }

  .hero__meta-item:nth-child(3) {
    padding-left: 0;
  }

  .hero__meta-item:nth-child(3),
  .hero__meta-item:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .hero__meta-item:nth-child(4) {
    border-left: 1px solid var(--line);
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .section-heading h2 {
    max-width: 18ch;
  }

  .section-heading--row {
    align-items: flex-start;
  }

  .section-heading--row .section-kicker {
    padding-top: 0;
  }

  .section-heading--row h2 {
    max-width: 18ch;
  }

  .intro__copy {
    grid-template-columns: 1fr;
    gap: 1.6rem;
  }

  .intro__statement {
    max-width: 18ch;
  }

  .process-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .process-intro {
    position: static;
  }

  .process-intro h2 {
    max-width: 15ch;
  }

  .about-teaser,
  .profile-layout,
  .approach-layout {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .profile-side,
  .contact-side {
    position: static;
  }

  .profile-side {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(200px, 1.1fr);
    gap: 1.5rem;
    align-items: start;
  }

  .profile-side .identity-card {
    min-height: 420px;
  }

  .profile-facts {
    margin-top: 0;
  }

  .capability-grid {
    grid-template-columns: 1fr;
    border-top: 1px solid var(--line);
  }

  .capability-card {
    padding: 1.35rem 0;
  }

  .capability-card + .capability-card {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .capability-card p {
    max-width: 56ch;
  }

  .exploring-panel {
    grid-template-columns: 1fr;
    gap: 1.8rem;
  }

  .exploring-panel h2 {
    max-width: 15ch;
  }

  .page-hero__grid {
    grid-template-columns: 1fr;
    gap: 1.8rem;
    align-items: start;
  }

  .page-hero h1 {
    max-width: 14ch;
  }

  .page-hero__side p {
    max-width: 58ch;
  }

  .page-hero::after {
    top: 8%;
    right: -12%;
    width: 58vw;
  }

  .contact-layout {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .contact-side__heading,
  .contact-side__text {
    max-width: 22ch;
  }

  .contact-side__text {
    max-width: 56ch;
  }

  .contact-direct-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }

  .contact-direct {
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
  }

  .next-steps {
    max-width: 680px;
  }

  .footer__top {
    grid-template-columns: 1.25fr 0.6fr 0.85fr;
    gap: 2rem;
  }

  .project-modal {
    width: calc(100% - 1.5rem);
  }

  .project-modal__shell {
    display: block;
    max-height: 92vh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .project-modal__media {
    min-height: 0;
    height: 280px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .project-modal__content {
    overflow: visible;
    padding: 1.7rem;
  }
}

/* ---------- Large phone ---------- */
@media (max-width: 760px) {
  :root {
    --section-space: clamp(4rem, 12vw, 6rem);
    --gutter: 1.2rem;
    --header-height: 70px;
  }

  .brand__mark {
    width: 38px;
    height: 38px;
  }

  .brand__name {
    font-size: 0.74rem;
  }

  .brand__role {
    font-size: 0.51rem;
  }

  .lang-switch,
  .theme-switch {
    min-height: 36px;
    padding: 2px;
  }

  .lang-switch__option,
  .theme-switch__option {
    min-width: 30px;
    min-height: 30px;
  }

  .nav-toggle {
    width: 40px;
    height: 40px;
  }

  .header__actions {
    gap: 0.35rem;
  }

  .hero__title {
    font-size: clamp(2.9rem, 11.4vw, 4.8rem);
    line-height: 0.96;
  }

  .hero__identity {
    gap: 0.45rem 0.8rem;
    font-size: 0.72rem;
  }

  .hero__identity span + span::before {
    width: 12px;
  }

  .hero__lede {
    font-size: 0.96rem;
  }

  .hero__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero__actions .button {
    width: 100%;
  }

  .hero__contacts {
    gap: 0.2rem 0.9rem;
  }

  .hero__stage-wrap {
    max-width: 100%;
  }

  .hero-stage {
    min-height: 460px;
  }

  .hero-stage__watermark {
    font-size: clamp(5.4rem, 22vw, 7.5rem);
  }

  .hero-float {
    max-width: 215px;
  }

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

  .hero__meta-item,
  .hero__meta-item:nth-child(odd) {
    padding: 0.8rem 0;
  }

  .hero__meta-item + .hero__meta-item {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .principle {
    padding: 1.2rem 0;
  }

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

  .principle + .principle {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .principle p {
    max-width: 48ch;
  }

  .project-grid,
  .project-grid--wide {
    grid-template-columns: 1fr;
  }

  .project-card__image-wrap {
    aspect-ratio: 16 / 10;
  }

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

  .service-card__actions .button {
    flex-basis: 60%;
  }

  .service-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    gap: 0.7rem;
    padding: 1.2rem 0;
  }

  .service-row:hover {
    padding-right: 0;
    padding-left: 0;
    background: transparent;
  }

  .service-row__arrow {
    width: 38px;
    height: 38px;
  }

  .service-row__body p {
    font-size: 0.76rem;
  }

  .about-teaser {
    gap: 2rem;
  }

  .identity-card {
    min-height: 380px;
  }

  .identity-card__mark {
    font-size: clamp(6rem, 27vw, 9rem);
  }

  .profile-side {
    display: block;
  }

  .profile-side .identity-card {
    min-height: 380px;
  }

  .profile-facts {
    margin-top: 1.1rem;
  }

  .tool-groups {
    grid-template-columns: 1fr;
  }

  .tool-group ul {
    margin-top: 0.7rem;
  }

  .status-legend {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .status-legend__item {
    align-items: center;
  }

  .project-toolbar {
    align-items: flex-start;
  }

  .project-count {
    padding-top: 0.55rem;
  }

  .contact-channels {
    grid-template-columns: 1fr;
  }

  .contact-channel {
    align-items: center;
  }

  .contact-direct-list {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .contact-direct {
    padding: 0.75rem 0.9rem;
  }

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

  .contact-methods {
    grid-template-columns: 1fr;
  }

  .contact-method {
    min-height: 48px;
  }

  .contact-form-wrap {
    padding: 1.15rem;
    border-radius: var(--radius-md);
  }

  .form-actions .button {
    flex-basis: 100%;
  }

  .review-actions .button {
    flex-basis: 100%;
  }

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

  .footer__brand {
    grid-column: 1 / -1;
  }

  .footer__contact {
    align-self: start;
  }

  .footer__bottom {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .back-to-top {
    justify-self: start;
  }

  .page-hero {
    padding-top: 2.8rem;
  }

  .page-hero h1 {
    font-size: clamp(2.85rem, 11vw, 4.6rem);
  }

  .page-hero::after {
    top: 15%;
    right: -28%;
    width: 72vw;
  }

  .cta-panel {
    border-radius: var(--radius-lg);
  }

  .cta-panel__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cta-panel__actions .button {
    width: 100%;
  }

  .project-modal__media {
    height: 230px;
  }

  .project-modal__content {
    padding: 1.35rem;
  }

  .project-modal h2 {
    padding-right: 1.8rem;
    font-size: clamp(1.9rem, 8vw, 2.8rem);
  }

  .project-modal__facts {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .project-modal__close {
    top: 0.7rem;
    right: 0.7rem;
    width: 38px;
    height: 38px;
  }

  .contact-panel {
    border-radius: var(--radius-lg);
  }

  .contact-panel__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .contact-panel__actions .button {
    width: 100%;
  }
}

/* ---------- Small phone ---------- */
@media (max-width: 560px) {
  .section-end {
    justify-content: flex-start;
  }

  .header__inner {
    gap: 0.4rem;
  }

  .brand {
    gap: 0.5rem;
  }

  .brand__text {
    display: none;
  }

  .lang-switch__option,
  .theme-switch__option {
    min-width: 27px;
    min-height: 29px;
    font-size: 0.55rem;
  }

  .lang-switch,
  .theme-switch {
    min-height: 33px;
  }

  .theme-switch__option .icon {
    width: 0.85rem;
    height: 0.85rem;
  }

  .header__actions {
    margin-left: auto;
  }

  .hero {
    padding-top: 2rem;
  }

  .hero__title {
    font-size: clamp(2.65rem, 13.2vw, 4rem);
  }

  .hero__identity {
    margin-top: 1.7rem;
  }

  .hero__identity span + span {
    gap: 0.55rem;
  }

  .hero__contact-label {
    width: 100%;
  }

  .hero-stage {
    min-height: 420px;
    border-radius: var(--radius-md);
  }

  .hero-stage__capabilities strong {
    font-size: 0.61rem;
  }

  .hero-stage__terminal {
    font-size: 0.57rem;
  }

  .hero-float {
    position: relative;
    right: auto;
    bottom: auto;
    max-width: none;
    margin: -1.8rem 0.8rem 0;
  }

  .hero__stage-wrap .hero-float {
    right: auto;
    bottom: auto;
  }

  .hero__meta {
    margin-top: 0;
  }

  .section-heading h2 {
    font-size: clamp(1.95rem, 8.5vw, 2.7rem);
  }

  .section-heading--row {
    flex-direction: column;
    gap: 1.2rem;
  }

  .section-action {
    padding-bottom: 0;
  }

  .intro__statement {
    font-size: clamp(1.8rem, 8vw, 2.5rem);
  }

  .process-step {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .identity-card {
    min-height: 330px;
    border-radius: var(--radius-md);
  }

  .identity-card__mark {
    font-size: clamp(5.5rem, 30vw, 7.5rem);
  }

  .identity-card__bottom {
    align-items: flex-start;
    flex-direction: column;
  }

  .cta-panel {
    padding: 1.6rem;
  }

  .cta-panel__note {
    flex-direction: column;
  }

  .project-card__visual-top {
    top: 0.7rem;
    right: 0.7rem;
    left: 0.7rem;
  }

  .project-card__visual-tag {
    display: none;
  }

  .project-card__image-note {
    left: 0.7rem;
    bottom: 0.6rem;
  }

  .filter-group {
    gap: 0.1rem;
  }

  .filter-button {
    padding-inline: 0.65rem;
  }

  .service-card {
    padding: 1.25rem;
  }

  .service-card__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .service-card__whatsapp {
    justify-self: start;
  }

  .contact-form-wrap__head h2 {
    font-size: 1.8rem;
  }

  .status {
    font-size: 0.49rem;
  }

  .footer__top {
    grid-template-columns: 1fr;
    gap: 1.8rem;
  }

  .footer__brand {
    grid-column: auto;
  }

  .footer__link,
  .footer__contact-link {
    min-height: 38px;
  }

  .page-hero__grid {
    gap: 1.4rem;
  }

  .page-hero__meta {
    gap: 0.45rem 0.9rem;
  }

  .project-modal {
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
    border: 0;
  }

  .project-modal__shell {
    max-height: 100dvh;
  }

  .project-modal__media {
    height: 200px;
  }

  .project-modal__content {
    padding: 1.15rem;
  }

  .project-modal__media-meta {
    top: 0.7rem;
    right: 0.7rem;
    left: 0.7rem;
  }

  .project-modal__visual-note {
    bottom: 0.7rem;
    left: 0.7rem;
  }

  .contact-channel__value {
    font-size: 0.78rem;
  }
}

/* ---------- Very small phone ---------- */
@media (max-width: 390px) {
  .lang-switch {
    padding: 1px;
  }

  .theme-switch {
    padding: 1px;
  }

  .lang-switch__option,
  .theme-switch__option {
    min-width: 24px;
    min-height: 27px;
  }

  .lang-switch__divider {
    display: none;
  }

  .hero__title {
    font-size: 2.55rem;
  }

  .hero-stage {
    min-height: 390px;
    padding: 1rem;
  }

  .hero-stage__capabilities > div {
    padding: 0.7rem 0.45rem;
  }

  .hero-stage__tag {
    display: none;
  }

  .hero__contact-link {
    min-height: 34px;
  }

  .hero__meta-value {
    font-size: 0.73rem;
  }

  .page-hero h1 {
    font-size: 2.55rem;
  }

  .project-card__footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ---------- Landscape phones ---------- */
@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
  .primary-nav {
    padding-top: 0.8rem;
  }

  .nav-link {
    min-height: 50px;
    font-size: 1.05rem;
  }

  .nav-cta {
    margin-top: 0.8rem;
    min-height: 46px;
  }

  .hero-stage {
    min-height: 390px;
  }
}

/* ---------- Pointer-specific hover ---------- */
@media (hover: none) {
  .project-card:hover {
    transform: none;
  }

  .button:hover {
    transform: none;
  }

  .service-card:hover {
    transform: none;
  }
}

/* ---------- Forced colors / high contrast ---------- */
@media (forced-colors: active) {
  .button,
  .status,
  .tag,
  .field__control,
  .project-card,
  .service-card {
    border: 1px solid ButtonText;
  }

  .eyebrow__dot,
  .hero-stage__status::before {
    background: ButtonText;
  }
}

/* ---------- Project status legend ---------- */
@media (max-width: 760px) {
  .status-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .status-legend {
    grid-template-columns: minmax(0, 1fr);
  }
}
