/* Silver Mobile 3.0
   Mobile-first composition loaded after the desktop styles. */

/* The course photos have intrinsic HTML dimensions. Explicit auto height keeps
   their 3:2 frame instead of turning a responsive image into a 1067px crop. */
.home-course-media img {
  display: block;
  width: 100%;
  height: auto !important;
  aspect-ratio: auto !important;
  object-fit: contain;
  object-position: center;
}

@media (max-width: 740px) {
  :root {
    --mobile-gutter: clamp(0.75rem, 4vw, 1.1rem);
    --mobile-gap: 0.8rem;
    --mobile-photo-height: clamp(15.5rem, 68vw, 19.25rem);
  }

  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  main,
  section,
  .container,
  .topbar-content,
  .hero-layout,
  .page-hero-layout,
  .page-layout,
  .page-block,
  .home-course-card,
  .page-card,
  .page-link,
  .page-hero-copy,
  .page-hero-tool,
  .footer-layout-rich,
  .footer-layout-rich > * {
    min-width: 0;
    max-width: 100%;
  }

  .container,
  .topbar-content {
    width: 100% !important;
    margin-inline: auto;
    padding-inline: var(--mobile-gutter);
  }

  .section-pad {
    padding-block: 3.3rem;
  }

  img {
    max-width: 100%;
  }

  /* Header and menu */
  .topbar-content {
    height: 64px;
    gap: 0.65rem;
  }

  .brand {
    width: clamp(8.65rem, 42vw, 10.25rem);
    max-width: calc(100% - 5.75rem);
  }

  .brand img {
    display: block;
    width: 100%;
    height: auto;
  }

  .nav-toggle {
    flex: 0 0 auto;
    min-width: 4.75rem;
    min-height: 46px;
    margin-left: auto;
    padding: 0.6rem 0.72rem;
  }

  .topbar nav {
    top: 64px;
    left: 0.5rem;
    right: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-height: calc(100svh - 72px);
    padding: 0.65rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid rgba(119, 147, 181, 0.48);
    background: rgba(5, 13, 25, 0.985);
    box-shadow: 0 24px 54px rgba(0, 0, 0, 0.52);
  }

  .nav-links {
    gap: 0.3rem;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-links a {
    min-height: 48px;
    padding: 0.78rem 0.85rem;
  }

  .topbar .nav-mobile-actions {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.55rem;
  }

  .topbar .nav-mobile-actions .btn {
    min-width: 0;
    min-height: 48px;
    padding-inline: 0.55rem;
    font-size: 0.88rem;
    white-space: normal;
    text-align: center;
  }

  .topbar .nav-mobile-phone {
    display: grid;
    gap: 0.1rem;
  }

  .topbar .nav-mobile-phone strong {
    font-size: 0.86rem;
  }

  /* Home hero: one deliberate photo frame followed by readable content. */
  .main-home .hero,
  .main-home .hero.section-pad {
    min-height: 0;
    padding: 0 0 2.8rem;
    background: #071323;
  }

  .hero-bg-image {
    inset: 0 0 auto;
    width: 100%;
    height: var(--mobile-photo-height);
    object-position: 53% 56%;
  }

  .hero::after {
    inset: 0 0 auto;
    height: calc(var(--mobile-photo-height) + 5.5rem);
    background:
      linear-gradient(180deg, rgba(3, 8, 16, 0.06) 0%, rgba(3, 9, 18, 0.15) 45%, rgba(5, 13, 25, 0.9) 78%, #071323 100%),
      linear-gradient(90deg, rgba(3, 8, 16, 0.42), rgba(3, 8, 16, 0.05) 78%);
  }

  .hero-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.15rem;
    padding-top: calc(var(--mobile-photo-height) - 4.5rem);
  }

  .hero-copy {
    width: 100%;
    max-width: none;
    padding: 0;
    border: 0 !important;
    background: transparent;
    box-shadow: none !important;
    backdrop-filter: none;
  }

  .hero-copy h1 {
    max-width: 13ch;
    margin-top: 0.55rem;
    font-size: clamp(2.25rem, 10.8vw, 3.05rem);
    line-height: 0.98;
    letter-spacing: -0.045em;
    text-wrap: balance;
  }

  .hero .lead {
    margin: 1rem 0 1.25rem;
    font-size: 1rem;
    line-height: 1.58;
  }

  .eyebrow,
  .zone-eyebrow {
    max-width: 100%;
    white-space: normal;
    text-wrap: balance;
  }

  .hero-actions,
  .page-hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    width: 100%;
  }

  .hero-actions .btn,
  .page-hero-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding-inline: 0.65rem;
    text-align: center;
  }

  /* No off-screen carousel: every promise is visible in the reading flow. */
  .hero-metrics,
  .page-hero-highlights {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 0;
    width: 100%;
    margin-top: 1.45rem;
    padding: 0;
    overflow: visible;
    border-top: 1px solid rgba(155, 181, 214, 0.28);
    scroll-snap-type: none;
  }

  .hero-metrics article,
  .hero-metrics article + article,
  .page-hero-highlights article,
  .page-hero-highlights article + article {
    position: relative;
    min-height: 0;
    padding: 0.85rem 0 0.85rem 1rem;
    border: 0 !important;
    border-bottom: 1px solid rgba(155, 181, 214, 0.2) !important;
    background: transparent !important;
    box-shadow: none !important;
    scroll-snap-align: none;
  }

  .hero-metrics article::before,
  .page-hero-highlights article::before {
    content: "";
    position: absolute;
    top: 0.95rem;
    bottom: 0.95rem;
    left: 0;
    width: 3px;
    background: var(--brand);
    transform: skewX(-12deg);
  }

  .hero-metrics strong,
  .page-hero-highlights strong {
    font-size: 1rem;
    line-height: 1.25;
  }

  .hero-metrics span,
  .page-hero-highlights span {
    margin-top: 0.2rem;
    font-size: 0.9rem;
    line-height: 1.42;
  }

  .main-home .hero-step {
    width: 100%;
    max-width: none;
    padding: 1.15rem;
    border-radius: 0.8rem;
    background: #0a1a2e;
    backdrop-filter: none;
  }

  .hero-step h2 {
    font-size: 1.55rem;
  }

  .hero-course-form select,
  .hero-course-form .btn,
  .hero-step > .btn {
    min-height: 50px;
  }

  /* Home content */
  .home-section-heading h2,
  .home-gallery-head h2,
  .home-story-copy h2,
  .footer-heading h2 {
    max-width: 16ch;
    font-size: clamp(2rem, 9.6vw, 2.65rem);
    line-height: 1.02;
  }

  .home-section-heading .section-lead,
  .home-story-copy > p:not(.eyebrow) {
    font-size: 1rem;
    line-height: 1.62;
  }

  .home-course-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    margin-top: 1.65rem;
  }

  .home-course-card {
    grid-template-rows: auto 1fr;
    border-radius: 0.8rem;
  }

  .home-course-media {
    display: block;
    width: 100%;
    background: #0b1728;
  }

  .home-course-media img {
    width: 100%;
    height: auto !important;
    min-height: 0;
    aspect-ratio: auto !important;
    object-fit: contain;
    object-position: center;
  }

  .home-course-copy {
    padding: 1.15rem;
  }

  .home-course-copy h3 {
    font-size: 1.65rem;
  }

  .home-course-copy .btn {
    width: 100%;
  }

  .home-service-strip {
    align-items: stretch;
    flex-direction: column;
    padding: 1.1rem;
    border-radius: 0.75rem;
  }

  .home-service-strip .btn {
    width: 100%;
  }

  .home-story-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.75rem;
  }

  .home-story-photos {
    display: block;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .home-story-photo-main {
    display: block;
    width: 100%;
    transform: none;
  }

  .home-story-photo-detail {
    display: none;
  }

  .home-story-photo img {
    display: block;
    width: 100%;
    height: auto !important;
    min-height: 0;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: center;
  }

  .home-story-list {
    margin: 1.25rem 0 1.5rem;
  }

  .home-gallery-head {
    align-items: stretch;
    flex-direction: column;
  }

  .home-gallery-head > .btn {
    width: 100%;
  }

  .home-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 0.55rem;
    margin: 1.45rem 0 0;
    padding: 0;
    overflow: visible;
    scroll-snap-type: none;
  }

  .home-gallery-item,
  .home-gallery-item-wide {
    grid-column: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
    border-radius: 0.55rem;
    scroll-snap-align: none;
  }

  .home-gallery-item-wide:first-child,
  .home-gallery-item-wide:last-child {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 9;
  }

  .home-gallery-item img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
  }

  .home-gallery-item span {
    left: 0.65rem;
    right: 0.65rem;
    bottom: 0.55rem;
    font-size: 0.88rem;
    line-height: 1.25;
  }

  /* Subpage hero: a bounded photo, then content. */
  body[data-page] main {
    background: #06101f;
  }

  .page-hero,
  body.page-hero-only .page-hero,
  body[data-page="kategoria-b-manual"].page-hero-only .page-hero,
  body[data-page="kategoria-b-automat"].page-hero-only .page-hero,
  body.page-hero-only .page-hero.section-pad {
    min-height: 0;
    padding: 0 0 2.75rem;
    overflow: hidden;
    background: #071323;
  }

  .page-hero::before {
    inset: 0 0 auto;
    height: var(--mobile-photo-height);
    transform: none;
    background-image: var(--mobile-hero-bg, var(--page-hero-bg));
    background-position: var(--hero-focus-mobile, center);
    background-size: cover;
    background-repeat: no-repeat;
    filter: saturate(0.94) contrast(1.03);
  }

  .page-hero::after {
    inset: 0 0 auto;
    height: calc(var(--mobile-photo-height) + 5.25rem);
    background:
      linear-gradient(180deg, rgba(3, 8, 16, 0.04) 0%, rgba(4, 10, 20, 0.16) 45%, rgba(5, 13, 25, 0.9) 78%, #071323 100%),
      linear-gradient(90deg, rgba(3, 8, 16, 0.34), rgba(3, 8, 16, 0.04) 78%);
  }

  .page-hero-layout,
  .page-hero-layout.has-hero-tool,
  body[data-page="auta"] .page-hero-layout,
  body[data-page="kontakt"].page-hero-only .page-hero-layout,
  body[data-page="kategoria-b-manual"].page-hero-only .page-hero-layout,
  body[data-page="kategoria-b-automat"].page-hero-only .page-hero-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "copy"
      "tool";
    gap: 1.15rem;
    padding-top: calc(var(--mobile-photo-height) - 4rem);
  }

  .page-hero-layout:not(.has-hero-tool) {
    grid-template-areas: "copy";
  }

  .page-hero-copy,
  body[data-page="kontakt"] .page-hero-copy {
    width: 100%;
    max-width: none;
    padding: 0;
    border: 0 !important;
    background: transparent;
    box-shadow: none !important;
    backdrop-filter: none;
  }

  .page-hero-copy h1 {
    max-width: 14ch;
    margin-top: 0.55rem;
    font-size: clamp(2.15rem, 10.4vw, 2.85rem);
    line-height: 0.99;
    letter-spacing: -0.04em;
    text-wrap: balance;
  }

  .page-hero-copy .lead {
    margin-top: 0.95rem;
    font-size: 1rem;
    line-height: 1.58;
  }

  .page-hero-tool,
  body[data-page="kontakt"] .page-hero-tool,
  body[data-page="kategoria-b-manual"] .page-hero-tool,
  body[data-page="kategoria-b-automat"] .page-hero-tool {
    width: 100%;
    max-width: none;
    padding: 1.1rem;
    border-radius: 0.8rem;
    background: #0a1a2e;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.26) !important;
    backdrop-filter: none;
  }

  .hero-tool-title {
    font-size: clamp(1.7rem, 8vw, 2.1rem);
  }

  .hero-tool-text {
    margin: 0.65rem 0 1rem;
    font-size: 0.95rem;
    line-height: 1.52;
  }

  .hero-tool-links,
  body[data-page="strefa-kursanta"] .hero-tool-links,
  .hero-pricing-columns {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.55rem;
  }

  .hero-tool-links a,
  .hero-contact-link,
  .hero-checklist-item,
  .hero-faq-mini details {
    min-width: 0;
    min-height: 50px;
    padding: 0.82rem;
  }

  .hero-tool-links strong {
    font-size: 0.98rem;
  }

  .hero-tool-links span {
    font-size: 0.86rem;
    line-height: 1.38;
  }

  .hero-pricing-features {
    min-height: 0;
  }

  .hero-pricing-spec,
  .hero-pricing-prices {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-pricing-plan,
  .hero-pricing-addon {
    min-width: 0;
  }

  .page-hero-tool select,
  .page-hero-tool input[type="search"],
  .page-hero-tool input[type="text"],
  .page-hero-tool input[type="tel"],
  .page-hero-tool input[type="email"],
  .page-hero-tool textarea,
  .page-hero-tool .btn {
    min-height: 50px;
    font-size: 1rem;
  }

  /* Subpage content: static one-column cards, compact two-column galleries. */
  body[data-page] main > section:not(.page-hero).section-pad {
    padding: 3.25rem 0;
  }

  .page-layout {
    gap: 0.85rem;
  }

  .page-block {
    padding: 1.15rem;
    border-radius: 0.8rem;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.16) !important;
  }

  .page-block h2 {
    max-width: 18ch;
    font-size: clamp(1.8rem, 8.8vw, 2.4rem);
    line-height: 1.04;
  }

  .page-block-intro,
  .page-block p,
  .page-list {
    max-width: 100%;
    font-size: 0.98rem;
    line-height: 1.6;
  }

  .page-cards,
  .page-links,
  .page-pricing-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.7rem;
    margin-top: 1.25rem;
  }

  .page-card,
  .page-link {
    min-height: 0;
    border-radius: 0.7rem;
  }

  .page-card {
    padding: 1.05rem;
  }

  .page-card:not(.has-media)::before {
    margin-bottom: 0.85rem;
  }

  .page-card.has-media {
    padding: 0 0 1.1rem;
  }

  .page-card.has-media .page-card-media img {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    object-position: center 42%;
  }

  body[data-page="auta"] .page-card.has-media .page-card-media img {
    aspect-ratio: 16 / 10;
    object-fit: contain;
    background: #0a1728;
  }

  .page-link {
    padding: 1.05rem 3.1rem 1.05rem 1.05rem;
  }

  .page-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 0.55rem;
    margin: 1.25rem 0 0;
    padding: 0;
    overflow: visible;
    scroll-snap-type: none;
  }

  .page-gallery figure {
    min-width: 0;
    border-radius: 0.55rem;
    scroll-snap-align: none;
  }

  .page-gallery figure:first-child {
    grid-column: 1 / -1;
  }

  .page-gallery img {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1 / 1;
    object-fit: cover;
  }

  .page-gallery figure:first-child img {
    aspect-ratio: 16 / 10;
  }

  .page-gallery figcaption {
    padding: 0.65rem;
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .page-faq {
    margin-top: 1.25rem;
  }

  .page-faq details {
    padding: 0.95rem;
  }

  .price-card,
  .hero-pricing-column {
    min-width: 0;
  }

  .price-card-body,
  .price-spec,
  .price-card-head {
    min-width: 0;
  }

  .price-options,
  .price-main {
    max-width: 100%;
  }

  /* Conversion and footer */
  .page-cta-inner {
    align-items: stretch;
    flex-direction: column;
    gap: 1.35rem;
  }

  .page-cta-copy h2 {
    max-width: 14ch;
    font-size: clamp(2.1rem, 10vw, 2.85rem);
  }

  .page-cta-copy p:not(.eyebrow) {
    font-size: 1rem;
    line-height: 1.58;
  }

  .page-cta-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }

  .page-cta-actions .btn {
    width: 100%;
    min-height: 50px;
  }

  .footer.section-pad {
    padding: 3.5rem 0 1.5rem;
  }

  .footer-reviews {
    margin-bottom: 1.6rem;
  }

  .footer-testimonials,
  .footer-layout-rich {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .footer-quote,
  .footer-cta-column {
    padding: 1.05rem;
    border-radius: 0.75rem;
  }

  .footer-layout-rich {
    gap: 1.75rem;
  }

  .footer-layout-rich .footer-brand-column,
  .footer-layout-rich .footer-cta-column {
    grid-column: auto;
  }

  .footer-logo {
    width: 10rem;
  }

  .footer-brand-column h2 {
    font-size: 1.9rem;
  }

  .footer-company-row {
    align-items: start;
    flex-wrap: wrap;
  }

  .footer-bottom {
    margin-top: 2rem;
  }

  /* A compact, reachable consent panel on small screens. */
  .cookie-consent {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.2rem 0.65rem;
    width: calc(100vw - 1rem);
    left: 0.5rem;
    right: 0.5rem;
    bottom: max(0.5rem, env(safe-area-inset-bottom));
    padding: 0.75rem;
    border-radius: 0.7rem;
  }

  .cookie-consent-title {
    font-size: 0.94rem;
  }

  .cookie-consent-text {
    margin-top: 0.1rem;
    font-size: 0.77rem;
    line-height: 1.38;
  }

  .cookie-consent-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
  }

  .cookie-consent-actions .btn {
    min-height: 46px;
    padding-inline: 0.9rem;
  }
}

@media (max-width: 390px) {
  :root {
    --mobile-gutter: 0.75rem;
    --mobile-photo-height: clamp(15rem, 72vw, 17.25rem);
  }

  .hero-actions,
  .page-hero-actions,
  .topbar .nav-mobile-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-copy h1,
  .page-hero-copy h1 {
    font-size: clamp(2.05rem, 11vw, 2.45rem);
  }

  .home-gallery-grid,
  .page-gallery {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-gallery-item,
  .home-gallery-item-wide,
  .home-gallery-item-wide:first-child,
  .home-gallery-item-wide:last-child,
  .page-gallery figure,
  .page-gallery figure:first-child {
    grid-column: auto;
    aspect-ratio: 16 / 10;
  }

  .page-gallery img,
  .page-gallery figure:first-child img {
    aspect-ratio: 16 / 10;
  }

  .cookie-consent {
    grid-template-columns: minmax(0, 1fr);
  }

  .cookie-consent-actions {
    grid-column: 1;
    grid-row: auto;
    margin-top: 0.45rem;
  }

  .cookie-consent-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-course-media img,
  .home-gallery-item img,
  .page-gallery img {
    transition: none !important;
  }
}
