/*
=================================================================
SAFEIFY RESPONSIVE LAYOUT
=================================================================
Load this stylesheet LAST on every HTML page.

Breakpoints:
- Large desktop: > 1200px
- Laptop / tablet landscape: 901px - 1200px
- Tablet: 651px - 900px
- Mobile: <= 650px
- Small mobile: <= 420px
=================================================================
*/

/* ---------- UNIVERSAL FLUID SAFETY ---------- */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  overflow-x: hidden;
}

main,
section,
header,
footer,
.container,
.card,
form {
  min-width: 0;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

h1,
h2,
h3,
p,
li,
a,
span {
  overflow-wrap: anywhere;
}

.container {
  width: min(calc(100% - clamp(30px, 5vw, 64px)), var(--container));
}

.section {
  padding-block: clamp(68px, 8vw, 100px);
}

.page-hero {
  min-height: clamp(390px, 50vw, 520px);
  padding-top: clamp(125px, 14vw, 155px);
  padding-bottom: clamp(74px, 10vw, 110px);
}

.page-hero h1 {
  font-size: clamp(38px, 6.6vw, 82px);
}

.section-title {
  font-size: clamp(30px, 4.4vw, 58px);
}

.card {
  min-width: 0;
}

/* Prevent wide items from forcing horizontal scrolling. */
.service-detail,
.research-feature,
.contact-layout,
.about-story,
.home-hero-inner,
.home-intro-grid {
  min-width: 0;
}

.service-detail > *,
.research-feature > *,
.contact-layout > *,
.about-story > *,
.home-hero-inner > *,
.home-intro-grid > * {
  min-width: 0;
}

/* ---------- LARGE / NORMAL DESKTOP ---------- */

@media (min-width: 1201px) {
  .container {
    width: min(calc(100% - 72px), var(--container));
  }

  .home-visual img,
  .research-feature img,
  .service-detail img,
  .about-story img {
    max-height: 620px;
    object-fit: contain;
  }
}

/* ---------- LAPTOP / SMALL DESKTOP ---------- */

@media (max-width: 1200px) {
  .navbar {
    gap: 24px;
  }

  .nav-links {
    gap: 20px;
  }

  .home-hero-inner {
    gap: 42px;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  }

  .home-hero h1 {
    font-size: clamp(46px, 6vw, 68px);
  }

  .service-detail,
  .research-feature,
  .contact-layout {
    gap: 44px;
  }

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

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

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

  .footer-grid {
    gap: 38px;
  }
}

/* ---------- TABLET / NARROW LAPTOP ---------- */

@media (max-width: 900px) {
  .navbar {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 70px;
  }

  .brand {
    min-width: 0;
  }

  .brand span {
    white-space: nowrap;
  }

  .menu-toggle {
    display: block;
    position: relative;
    z-index: 1002;
  }

  .header-cta {
    display: none;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 70px;
    left: 18px;
    right: 18px;
    width: auto;
    padding: 20px;
    border-radius: 16px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    box-shadow: 0 18px 50px rgba(10, 36, 78, 0.16);
    z-index: 1001;
  }

  .navbar.menu-open .nav-links {
    display: flex;
  }

  .nav-links a {
    display: block;
    width: 100%;
    padding: 11px 12px;
    border-radius: 9px;
  }

  .nav-links a.active::after {
    display: none;
  }

  /* Subpage mobile/tablet menu: no green background. */
  .subpage .nav-links {
    background: rgba(248, 252, 255, 0.98) !important;
    border: 1px solid rgba(22, 80, 146, 0.12);
    backdrop-filter: blur(14px);
  }

  .subpage .nav-links a {
    color: #071a34 !important;
  }

  /* Home menu stays readable over its hero. */
  html[data-page="home"] .nav-links {
    background: rgba(7, 26, 52, 0.97);
  }

  html[data-page="home"] .nav-links a {
    color: rgba(255,255,255,0.88);
  }

  .home-hero-inner,
  .home-intro-grid,
  .research-feature,
  .contact-layout,
  .about-story {
    grid-template-columns: 1fr !important;
  }

  .home-hero-inner {
    gap: 34px;
  }

  .home-visual,
  .research-feature img,
  .about-story img {
    width: min(100%, 720px);
    margin-inline: auto;
  }

  .services-grid,
  .process-grid,
  .values-grid,
  .team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

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

  .service-detail {
    grid-template-columns: 1fr !important;
    gap: 28px;
    padding-block: 44px;
  }

  /* Preserve visual order on the AI service row on smaller screens. */
  .service-detail img {
    width: min(100%, 680px);
    margin-inline: auto;
  }

  .workflow-row {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .contact-form {
    width: 100%;
  }

  .footer-grid {
    grid-template-columns: 1.2fr 0.8fr 0.8fr;
    gap: 26px;
  }
}

/* ---------- MOBILE ---------- */

@media (max-width: 650px) {
  .container {
    width: min(calc(100% - 28px), var(--container));
  }

  .navbar {
    min-height: 64px;
    gap: 12px;
  }

  .brand-logo {
    width: 30px;
    height: 30px;
  }

  .brand {
    font-size: 13px;
  }

  .nav-links {
    top: 64px;
    left: 12px;
    right: 12px;
  }

  .page-hero {
    min-height: auto;
    padding-top: 108px;
    padding-bottom: 62px;
  }

  .page-hero h1 {
    font-size: clamp(36px, 11vw, 52px);
    line-height: 1.02;
  }

  .page-hero p {
    font-size: 15px;
  }

  .section {
    padding-block: 64px;
  }

  .section-title {
    font-size: clamp(30px, 9vw, 44px);
  }

  .section-intro,
  .home-intro-grid .lead {
    font-size: 16px;
  }

  .home-hero,
  .home-hero-inner {
    min-height: auto;
  }

  .home-hero-inner {
    padding: 104px 0 56px;
    gap: 30px;
  }

  .home-hero h1 {
    font-size: clamp(40px, 12vw, 58px);
  }

  .home-hero-copy > p:not(.eyebrow) {
    font-size: 15px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .hero-actions .btn,
  .cta-band .btn {
    width: 100%;
  }

  .services-grid,
  .process-grid,
  .project-grid,
  .metric-grid,
  .topic-grid,
  .values-grid,
  .team-grid,
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .service-card-body,
  .project-card-body,
  .topic-card,
  .process-step,
  .metric-card,
  .home-service-card,
  .value-card {
    padding: 22px;
  }

  .service-detail {
    gap: 22px;
    padding-block: 36px;
  }

  .service-detail ul {
    padding-left: 20px;
  }

  .research-feature {
    gap: 28px;
  }

  .workflow {
    gap: 10px;
  }

  .workflow-row {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 18px;
  }

  .workflow-row span {
    width: 40px;
    height: 40px;
  }

  .contact-layout {
    gap: 32px;
  }

  .contact-form {
    padding: 24px;
  }

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

  .form-field.full {
    grid-column: auto !important;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  .team-card {
    min-height: 0 !important;
  }

  .team-card-body {
    min-height: 0 !important;
    padding: 24px;
  }

  .team-photo,
  .team-photo-placeholder {
    width: min(150px, 42vw);
    height: min(150px, 42vw);
  }

  .team-title {
    font-size: clamp(32px, 10vw, 44px);
  }

  .timeline-item {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }

  .cta-band {
    margin-top: 48px;
    padding: 26px;
    flex-direction: column;
    align-items: stretch;
  }

  .cta-band h3 {
    font-size: clamp(25px, 8vw, 36px);
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 30px;
    padding-bottom: 38px;
  }

  .footer-grid > div:first-child {
    grid-column: auto !important;
  }

  .footer-bottom {
    min-height: auto;
    padding: 20px 0 8px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ---------- SMALL MOBILE ---------- */

@media (max-width: 420px) {
  .container {
    width: calc(100% - 24px);
  }

  .brand span {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-hero {
    padding-top: 96px;
    padding-bottom: 52px;
  }

  .page-hero h1 {
    font-size: clamp(33px, 11vw, 44px);
  }

  .section {
    padding-block: 54px;
  }

  .card {
    border-radius: 16px;
  }

  .contact-form {
    padding: 18px;
  }

  .form-field input,
  .form-field select,
  .form-field textarea {
    padding: 12px;
  }

  .team-photo,
  .team-photo-placeholder {
    width: 132px;
    height: 132px;
  }

  .team-card-body {
    padding: 20px;
  }

  .footer-copy {
    font-size: 13px;
  }
}

/* ---------- SHORT LANDSCAPE SCREENS ---------- */

@media (max-height: 540px) and (orientation: landscape) {
  .home-hero-inner {
    min-height: auto;
    padding-top: 92px;
    padding-bottom: 40px;
  }

  .page-hero {
    min-height: auto;
    padding-top: 100px;
    padding-bottom: 48px;
  }
}
/* =========================================================
   SAFEIFY HOME — MOBILE HERO REFINEMENT
   iPhone / Android / small tablet
========================================================= */

@media (max-width: 650px) {

  /* Keep the important right-hand part of the hero background visible
     and move the large Safeify.AI artwork away from the text. */
  html[data-page="home"] .home-top-background {
    background-size: auto 100%;
    background-position: 86% center !important;
  }

  /* Slightly reduce vertical space in the hero. */
  html[data-page="home"] .home-hero-inner {
    padding-top: 88px;
    padding-bottom: 52px;
  }

  /* More suitable heading size for phones such as iPhone Pro Max. */
  html[data-page="home"] .home-hero h1 {
    font-size: clamp(38px, 10vw, 46px);
    line-height: 1.01;
    letter-spacing: -0.045em;
  }

  /* Keep the description comfortably readable. */
  html[data-page="home"] .home-hero-copy > p:not(.eyebrow) {
    width: 100%;
    max-width: 100%;
    font-size: 16px;
    line-height: 1.55;
  }

  /* Slightly smaller eyebrow so it stays on the screen cleanly. */
  html[data-page="home"] .home-hero-copy .eyebrow {
    font-size: 11px;
    line-height: 1.45;
    letter-spacing: 0.12em;
  }

  /* Make hamburger visible on the light hero background. */
  html[data-page="home"] .menu-toggle span {
    background: #071a34 !important;
  }

  /* Buttons remain full width but with a comfortable mobile height. */
  html[data-page="home"] .hero-actions .btn {
    width: 100%;
    min-height: 52px;
  }
}
/* ================================================================
   SAFEIFY — FINAL MOBILE RESPONSIVE OVERRIDES
   Phones / iPhone / Android
   ================================================================ */

@media (max-width: 650px) {

    /* =========================================================
       GENERAL MOBILE SCALE
       ========================================================= */

    html {
        font-size: 14px;
    }

    body {
        overflow-x: hidden;
    }

    .container {
        width: calc(100% - 32px);
        max-width: 100%;
    }


    /* =========================================================
       HEADER
       ========================================================= */

    .navbar {
        min-height: 62px;
        gap: 10px;
    }

    .brand-logo {
        width: 27px !important;
        height: 27px !important;
    }

    .brand {
        font-size: 13px !important;
    }

    .menu-toggle {
        width: 38px;
        height: 38px;
    }

    /* Hamburger must be dark because the hero is light */
    html[data-page="home"] .menu-toggle span {
        background: #071a34 !important;
        width: 21px;
    }


    /* =========================================================
       MOBILE NAVIGATION
       ========================================================= */

    html[data-page="home"] .nav-links {
        top: 64px;

        left: 14px;
        right: 14px;

        width: auto;

        padding: 12px;

        gap: 2px;

        border-radius: 14px;

        background: rgba(7, 26, 52, 0.97) !important;

        box-shadow:
            0 16px 40px rgba(7, 26, 52, 0.20);
    }

    /* IMPORTANT:
       home.css currently has a dark !important link colour.
       This forces white links inside the dark mobile menu.
    */

    html[data-page="home"] .nav-links a {
        color: #ffffff !important;

        font-size: 14px !important;

        padding: 9px 10px !important;

        line-height: 1.3;
    }


    /* =========================================================
       HERO BACKGROUND

       Desktop image contains Safeify.AI artwork on the left.
       On mobile crop strongly toward the right side so that
       artwork does not sit behind the text.
       ========================================================= */

    html[data-page="home"] .home-top-background {
        background-size: cover !important;

        background-position:
            88% center !important;

        background-repeat: no-repeat !important;
    }


    /* =========================================================
       HERO
       ========================================================= */

    html[data-page="home"] .home-hero,
    html[data-page="home"] .home-hero-inner {
        min-height: auto !important;
    }

    html[data-page="home"] .home-hero-inner {

        padding-top: 85px !important;

        padding-bottom: 45px !important;

        gap: 20px !important;

        grid-template-columns: 1fr !important;
    }

    html[data-page="home"] .home-hero-copy {

        width: 100% !important;

        max-width: 100% !important;

        transform: none !important;
    }


    /* =========================================================
       HERO EYEBROW
       ========================================================= */

    html[data-page="home"] .home-hero-copy .eyebrow {

        margin-bottom: 10px;

        font-size: 9px !important;

        line-height: 1.4;

        letter-spacing: 0.09em !important;
    }


    /* =========================================================
       MAIN HERO TITLE
       ========================================================= */

    html[data-page="home"] .home-hero h1 {

        width: 100% !important;

        max-width: 100% !important;

        font-size:
            clamp(29px, 8.2vw, 37px) !important;

        line-height: 1.04 !important;

        letter-spacing: -0.035em !important;

        overflow-wrap: normal;
        word-break: normal;
    }


    /* =========================================================
       HERO DESCRIPTION
       ========================================================= */

    html[data-page="home"]
    .home-hero-copy > p:not(.eyebrow) {

        width: 100% !important;

        max-width: 100% !important;

        margin-top: 17px !important;

        font-size: 14px !important;

        line-height: 1.55 !important;
    }


    /* =========================================================
       HERO BUTTONS
       ========================================================= */

    html[data-page="home"] .hero-actions {

        margin-top: 22px;

        gap: 10px;

        flex-direction: column;

        align-items: stretch;
    }

    html[data-page="home"] .hero-actions .btn {

        width: 100%;

        min-height: 46px !important;

        padding: 0 16px;

        font-size: 13px !important;
    }


    /* =========================================================
       SECTIONS
       ========================================================= */

    .section {

        padding-top: 48px !important;

        padding-bottom: 48px !important;
    }


    /* =========================================================
       SECTION HEADINGS
       ========================================================= */

    .section-title {

        font-size:
            clamp(27px, 7.5vw, 35px) !important;

        line-height: 1.08 !important;

        letter-spacing: -0.035em;
    }

    .section-intro,
    .home-intro-grid .lead {

        font-size: 14px !important;

        line-height: 1.6;
    }

    .eyebrow {

        font-size: 10px;

        letter-spacing: 0.11em;
    }


    /* =========================================================
       SOLUTION SECTION
       ========================================================= */

    .home-intro-grid {

        gap: 22px !important;

        grid-template-columns: 1fr !important;
    }

    .home-services {

        margin-top: 30px;

        gap: 14px;

        grid-template-columns: 1fr !important;
    }


    /* =========================================================
       SERVICE CARDS
       ========================================================= */

    .home-service-card {

        padding: 20px !important;
    }

    .home-service-card h3 {

        margin-top: 24px;

        margin-bottom: 8px;

        font-size: 18px !important;
    }

    .home-service-card p {

        font-size: 13px !important;

        line-height: 1.55;
    }


    /* =========================================================
       STATISTICS SECTION
       ========================================================= */

    .stats-band {

        height: auto !important;

        min-height: 0 !important;

        padding-top: 42px !important;

        padding-bottom: 42px !important;

        border-radius: 20px;
    }

    .stats-grid {

        grid-template-columns: 1fr !important;

        gap: 20px;
    }

    .stat {

        padding: 8px 0;
    }

    .stat strong {

        font-size:
            clamp(30px, 9vw, 40px) !important;
    }

    .stat span {

        font-size: 12px !important;
    }


    /* =========================================================
       FINAL CTA
       ========================================================= */

    .cta-band {

        width: 100% !important;

        margin-top: 30px !important;

        padding: 22px !important;

        transform: none !important;

        flex-direction: column;

        align-items: stretch;
    }

    .cta-band h3 {

        font-size:
            clamp(23px, 6.5vw, 30px) !important;

        line-height: 1.1;
    }

    .cta-band .btn {

        width: 100%;

        min-height: 46px;

        font-size: 13px;
    }


    /* =========================================================
       FOOTER
       ========================================================= */

    .site-footer {

        padding-top: 42px !important;

        padding-bottom: 18px !important;
    }

    .footer-grid {

        grid-template-columns: 1fr !important;

        gap: 25px;
    }

    .footer-copy {

        font-size: 13px;
    }

    .footer-links {

        font-size: 13px;
    }

    .footer-bottom {

        font-size: 10px;
    }
}


/* ================================================================
   SMALL PHONES
   ================================================================ */

@media (max-width: 420px) {

    .container {
        width: calc(100% - 26px);
    }

    html[data-page="home"] .home-hero h1 {

        font-size:
            clamp(28px, 8vw, 34px) !important;
    }

    html[data-page="home"]
    .home-hero-copy > p:not(.eyebrow) {

        font-size: 13.5px !important;
    }

    .section-title {

        font-size:
            clamp(25px, 7.5vw, 32px) !important;
    }
}