/* Mobile-first responsive layer for the live Code Design pages. */
:root {
  --gk-page-gutter: clamp(20px, 5vw, 80px);
  --gk-content-max: 1480px;
  --gk-touch-target: 46px;
}

html {
  min-width: 320px;
  overflow-x: hidden;
  scroll-padding-top: 104px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
}

img,
svg,
video {
  max-width: 100%;
}

.gk-page,
.gk-floating-ui {
  min-width: 0;
}

.gk-page [data-r="pad"],
.gk-page [data-r="hero"] {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--gk-content-max) !important;
  padding-left: var(--gk-page-gutter) !important;
  padding-right: var(--gk-page-gutter) !important;
}

.gk-page h1,
.gk-page h2,
.gk-page h3 {
  text-wrap: balance;
}

.gk-page p {
  text-wrap: pretty;
}

.gk-page a,
.gk-page button,
.gk-floating-ui a,
.gk-floating-ui button {
  touch-action: manipulation;
}

.gk-page button,
.gk-floating-ui button,
.gk-primary-action,
.gk-inline-action,
.gk-back-link,
.gk-contact-actions a,
.gk-footer a {
  min-height: var(--gk-touch-target);
  box-sizing: border-box;
}

.gk-primary-action,
.gk-inline-action,
.gk-back-link,
.gk-contact-actions a,
.gk-footer a {
  display: inline-flex !important;
  align-items: center;
}

.gk-primary-action {
  min-height: 52px;
}

.gk-contact-actions a {
  min-height: 50px;
  overflow-wrap: anywhere;
}

/* Keep the desktop hero portrait anchored to the hero itself. */
@media (min-width: 1025px) and (max-width: 1919px) {
  .gk-page-home [data-hero="6"] {
    left: auto !important;
    right: var(--gk-page-gutter) !important;
    width: clamp(400px, 34vw, 460px) !important;
    margin-left: 0 !important;
    align-items: flex-end;
  }
}

@media (hover: none) {
  .gk-shot .gk-cap {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Navigation stays touch-oriented through tablet and phone-landscape widths. */
@media (max-width: 1024px) {
  .gk-nav-desktop {
    display: none !important;
  }

  .gk-burger {
    display: flex !important;
    min-height: 44px !important;
  }

  .gk-trust {
    display: none !important;
  }

  .gk-navbar {
    min-height: 60px;
    gap: 12px !important;
    padding: 8px 10px 8px 18px !important;
  }

  .gk-brand {
    display: flex !important;
    align-items: center;
    min-height: 44px;
  }

  .gk-footer a {
    min-width: 44px;
    justify-content: center;
  }
}

/* Phones and narrow browser windows. */
@media (max-width: 699px) {
  :root {
    --gk-page-gutter: clamp(18px, 5.5vw, 24px);
  }

  html {
    scroll-padding-top: 92px;
  }

  .gk-page [data-r="hero"] {
    min-height: 0 !important;
    padding-top: 112px !important;
  }

  .gk-page [data-r="col"],
  .gk-page [data-r="col3"],
  .gk-page [data-r="meta"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .gk-page [data-r="ghost"] {
    max-width: 100%;
    font-size: clamp(96px, 34vw, 138px) !important;
    opacity: 0.065 !important;
  }

  .gk-page h1 {
    overflow-wrap: normal;
    word-break: normal;
  }

  .gk-page-home [data-r="hero"] h1 {
    font-size: clamp(44px, 13vw, 54px) !important;
  }

  .gk-page-home [data-hero="3"] {
    gap: 8px 9px !important;
    font-size: 13px !important;
    line-height: 1.5;
  }

  .gk-page-home [data-hero="4"] {
    font-size: 18px !important;
    line-height: 1.55 !important;
  }

  .gk-page-home [data-hero="5"] {
    align-items: flex-start !important;
    gap: 10px 20px !important;
  }

  .gk-page-home [data-r="photo"] {
    justify-content: center !important;
  }

  .gk-page-home .gk-hero-frame {
    width: min(100%, 608px) !important;
    margin-inline: auto;
    aspect-ratio: 4 / 5 !important;
  }

  .gk-page-home .gk-section-why {
    padding-top: 72px !important;
  }

  .gk-page-home .gk-section-about {
    padding-top: 80px !important;
    padding-bottom: 82px !important;
  }

  .gk-page-home .gk-section-about p[style*="text-align: justify"] {
    text-align: left !important;
  }

  .gk-page-home .gk-section-cases {
    padding-top: 76px !important;
    padding-bottom: 92px !important;
  }

  .gk-page-home .gk-section-testimonials,
  .gk-page-home .gk-section-cta,
  .gk-page-home .gk-section-contact {
    padding-bottom: 92px !important;
  }

  .gk-page-home .gk-cta-card {
    padding: 46px 24px !important;
  }

  .gk-page-home .gk-case-res,
  .gk-page-portfolio .gk-res {
    padding: 11px 12px !important;
    font-size: 12.5px !important;
    line-height: 1.4 !important;
  }

  .gk-page-portfolio > [data-r="pad"]:first-of-type,
  .gk-page-price > [data-r="pad"]:first-of-type,
  .gk-page-work > [data-r="pad"]:first-of-type {
    padding-top: 124px !important;
  }

  .gk-page-portfolio .gk-filter-bar {
    top: 88px !important;
  }

  .gk-page-portfolio .gk-filters {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
  }

  .gk-page-portfolio .gk-filters button {
    min-height: 44px;
    padding: 10px 17px !important;
  }

  .gk-page-portfolio .gk-wall {
    gap: 34px !important;
  }

  .gk-page-price p[style*="padding-left: 80px"],
  .gk-page-work p[style*="padding-left: 70px"] {
    padding-left: 0 !important;
  }

  .gk-page-price .gk-price-toggle > span:nth-child(2) {
    font-size: 21px !important;
    line-height: 1.2;
  }

  .gk-page-work .gk-step-title {
    font-size: 21px !important;
    line-height: 1.2;
  }

  .gk-page-case [data-r="pad"][style*="padding: 56px"] {
    padding-top: 42px !important;
  }

  .gk-page-case [data-r="pad"][style*="padding: 90px"] {
    padding-top: 72px !important;
  }

  .gk-page-case [data-r="pad"][style*="padding: 120px"] {
    padding-top: 84px !important;
  }

  .gk-page-case [data-r="pad"][style*="padding: 120px 80px 140px"] {
    padding-bottom: 96px !important;
  }

  .gk-page-case .gk-cap {
    max-width: calc(100% - 28px);
    white-space: normal;
  }

  .gk-page-case [data-r="pad"] > .gk-shot[style*="aspect-ratio: 21/9"] {
    aspect-ratio: 4 / 3 !important;
  }

  .gk-footer {
    padding-top: 36px !important;
    padding-bottom: calc(42px + env(safe-area-inset-bottom)) !important;
    flex-direction: column;
    align-items: flex-start !important;
    gap: 16px !important;
  }

  .gk-footer a {
    min-width: 44px;
    padding: 10px 0;
    justify-content: center;
  }

  /* The contact control becomes a compact thumb-friendly button on phones. */
  .gk-chat-dock {
    right: max(12px, env(safe-area-inset-right)) !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;
  }

  .gk-chat-toggle {
    width: 52px;
    height: 52px;
    min-height: 52px !important;
    padding: 8px !important;
    border-radius: 50% !important;
    justify-content: center;
  }

  .gk-chat-toggle[aria-expanded="true"] {
    display: none !important;
  }

  .gk-chat-toggle > span:first-child {
    width: 34px !important;
    height: 34px !important;
    pointer-events: none;
  }

  .gk-chat-toggle image-slot {
    pointer-events: none;
  }

  .gk-chat-label {
    display: none !important;
  }

  .gk-chat-card {
    box-sizing: border-box;
    width: min(300px, calc(100vw - 32px)) !important;
    max-height: min(520px, calc(100dvh - 92px));
    overflow-y: auto;
  }

  .gk-chat-card a {
    min-height: 44px;
  }

  .gk-nav-shell {
    top: max(10px, env(safe-area-inset-top)) !important;
    padding: 0 var(--gk-page-gutter) !important;
  }

  .gk-navbar {
    min-height: 62px;
    gap: 8px !important;
    padding: 8px 8px 8px 14px !important;
  }

  .gk-brand {
    min-width: 0;
    min-height: 44px;
    flex: 1 1 auto;
  }

  .gk-brand-label {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 14px !important;
  }

  .gk-burger,
  .gk-menu-close {
    min-height: 44px !important;
  }

  .gk-burger {
    flex: 0 0 auto;
    padding: 10px 15px !important;
  }

  .gk-menu-panel {
    box-sizing: border-box;
    min-height: 100dvh;
    padding: max(18px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)) !important;
  }

  .gk-menu-links {
    gap: 2px !important;
    padding: 38px 0 30px !important;
  }

  .gk-menu-link {
    display: flex;
    align-items: center;
    min-height: 44px;
    font-size: clamp(36px, 10.5vw, 48px) !important;
  }

  .gk-menu-socials a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    box-sizing: border-box;
    padding: 10px 17px !important;
  }
}

/* Portrait tablets keep useful density instead of becoming long phone pages. */
@media (min-width: 700px) and (max-width: 1024px) {
  :root {
    --gk-page-gutter: clamp(30px, 4.7vw, 48px);
  }

  .gk-page-portfolio .gk-wall {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 38px 24px !important;
  }

  .gk-page-portfolio .gk-item[data-w] {
    grid-column: auto !important;
  }

  .gk-page-portfolio .gk-item[data-w="12"] {
    grid-column: span 2 !important;
  }

  .gk-page-portfolio .gk-item[data-a] .gk-frame {
    aspect-ratio: 4 / 3 !important;
  }

  .gk-page-portfolio .gk-item[data-a="pano"] .gk-frame {
    aspect-ratio: 16 / 8 !important;
  }

  .gk-page-case [data-r="col3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .gk-page-case [data-r="meta"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .gk-page-home .gk-selected-grid {
    grid-template-columns: 1.18fr 1fr !important;
    gap: 24px !important;
  }

  .gk-chat-dock {
    right: 18px !important;
    bottom: 18px !important;
  }
}

/* Short landscape phones: keep the first screen useful and the menu compact. */
@media (max-height: 500px) and (min-width: 568px) and (max-width: 1024px) {
  .gk-nav-shell {
    top: 8px !important;
  }

  .gk-navbar {
    min-height: 54px;
    padding-top: 5px !important;
    padding-bottom: 5px !important;
  }

  .gk-page [data-r="hero"] {
    padding-top: 86px !important;
  }

  .gk-chat-dock {
    right: 10px !important;
    bottom: 10px !important;
  }

  .gk-chat-toggle {
    width: 50px;
    height: 50px;
    min-height: 50px !important;
    padding: 8px !important;
    border-radius: 50% !important;
    justify-content: center;
  }

  .gk-chat-toggle > span:first-child {
    width: 32px !important;
    height: 32px !important;
    pointer-events: none;
  }

  .gk-chat-toggle image-slot {
    pointer-events: none;
  }

  .gk-chat-label {
    display: none !important;
  }

  .gk-chat-card {
    box-sizing: border-box;
    width: min(300px, calc(100vw - 28px)) !important;
    max-height: calc(100dvh - 72px);
    overflow-y: auto;
  }

  .gk-menu-panel {
    padding: 14px 22px 18px !important;
  }

  .gk-menu-links {
    padding: 14px 0 10px !important;
  }

  .gk-menu-link {
    min-height: 44px;
    font-size: clamp(30px, 7vw, 38px) !important;
  }

  .gk-menu-foot {
    gap: 10px !important;
  }

  .gk-menu-foot p {
    display: none;
  }
}

/* Wider canvases expand visual grids while text columns retain readable measure. */
@media (min-width: 1920px) {
  :root {
    --gk-content-max: 1760px;
  }

  .gk-navbar {
    max-width: 1480px !important;
  }

  .gk-page-home [data-hero="6"] {
    left: auto !important;
    right: 0 !important;
    width: 500px !important;
    margin-left: 0 !important;
  }
}

@media (min-width: 2560px) {
  :root {
    --gk-content-max: 1880px;
  }

  .gk-navbar {
    max-width: 1600px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gk-marquee-track {
    animation: none !important;
  }
}

/* Legal pages and consent banner — mobile first interaction sizing. */
@media (max-width: 700px) {
  .gk-footer-legal-wrap {
    margin-top: 10px;
    padding-top: 10px;
  }

  .gk-legal-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .gk-legal-links a,
  .gk-legal-links button {
    width: 100%;
    min-height: var(--gk-touch-target);
    padding: 9px 0;
  }

  .gk-cookie-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: calc(100dvh - 24px);
    padding: 19px;
    border-radius: 18px;
  }

  .gk-cookie-banner h2 {
    font-size: 23px;
  }

  .gk-cookie-actions {
    gap: 8px;
  }

  .gk-cookie-button {
    min-width: 0;
    min-height: var(--gk-touch-target);
    padding: 0 12px;
  }

  .gk-legal-main {
    min-height: calc(100svh - 210px);
    padding: 126px 20px 76px;
  }

  .gk-legal-main h1 {
    margin-bottom: 24px;
    font-size: clamp(36px, 11vw, 54px);
    overflow-wrap: anywhere;
  }

  .gk-legal-placeholder {
    padding-top: 22px;
    font-size: 16px;
  }
}

@media (max-width: 340px) {
  .gk-cookie-banner {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 16px;
  }

  .gk-cookie-actions {
    grid-template-columns: 1fr;
  }
}
