
  :root {
    --night: #0B1320;
    --dusk: #1F2A44;
    --coral: #E8633A;
    --gold: #F2A93B;
    --green: #1F8A4C;
    --cream: #FAF6EF;
    --ink: #14201C;
    --rule: rgba(255,255,255,0.08);
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }
  html { scroll-behavior: smooth; }

  body {
    font-family: inherit;
    color: #ECEAE3;
    line-height: 1.65;
    overflow-x: hidden;
    background-color: var(--night);
  }

  /* Header */
  header {
    position: fixed;
    top: 0; right: 0; left: 0;
    z-index: 100;
    padding: 20px clamp(48px, 6vw, 120px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(12px);
    background: rgba(11,19,32,0.55);
    border-bottom: 1px solid var(--rule);
  }
  .logo {
    font-family: inherit;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 1px;
    color: var(--gold);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .logo-mark {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #FFE4A8, var(--gold) 60%, var(--coral) 100%);
    box-shadow: 0 0 15px rgba(242,169,59,0.5);
  }
  nav ul { list-style: none; display: flex; gap: 32px; }
  nav a {
    color: #DAD6CB;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
  }
  nav a:hover { color: var(--gold); }
  nav .nav-inactive {
    color: rgba(218,214,203,0.4);
    font-size: 14px;
    font-weight: 500;
    cursor: default;
  }
  .lang-switch { display: flex; gap: 4px; font-family: inherit; font-size: 13px; }

  .mobile-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    border: 1px solid var(--rule);
    background: transparent;
    color: #fff;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
  }
  .mobile-menu-toggle span {
    width: 21px;
    height: 2px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .mobile-menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .mobile-menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .mobile-menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  @media (max-width: 900px) {
    header { padding: 14px 20px; gap: 10px; }
    .mobile-menu-toggle { display: inline-flex; order: 2; }
    .lang-switch { order: 3; }
    header nav {
      display: none;
      position: absolute;
      top: 100%;
      inset-inline: 0;
      padding: 16px 20px 22px;
      background: rgba(11,19,32,0.98);
      border-bottom: 1px solid var(--rule);
      box-shadow: 0 16px 30px rgba(0,0,0,0.28);
    }
    header nav.is-open { display: block; }
    header nav ul { flex-direction: column; gap: 0; }
    header nav li { border-bottom: 1px solid var(--rule); }
    header nav li:last-child { border-bottom: 0; }
    header nav a, header nav .nav-inactive { display: block; padding: 13px 4px; font-size: 15px; }
  }

  /* Hero — two-column grid. In RTL, column 1 is visually right, column 2 is visually left. */
  .hero {
    min-height: 100vh;
    padding: 140px clamp(48px, 6vw, 120px) 80px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(40px, 5vw, 120px);
    align-items: center;
    position: relative;
    width: 100%;
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
  }
  .hero-text {
    grid-column: 1;  /* RTL column 1 = visual right */
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  @media (max-width: 1100px) {
    .hero { grid-template-columns: 1fr; padding-top: 100px; }
    .hero-text { grid-column: 1; grid-row: 2; text-align: center; align-items: center; }
    .hero-text .hero-cta { justify-content: center; }
    .hero-text .hero-eyebrow { justify-content: center; }
  }
  .hero-eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--gold);
    letter-spacing: 2px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .hero-eyebrow::before { content: ''; width: 40px; height: 1px; background: var(--gold); }
  .hero h1 {
    font-weight: 900;
    font-size: clamp(40px, 6.5vw, 96px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: #fff;
    max-width: 900px;
    margin-bottom: 28px;
  }
  .hero h1 .accent { color: var(--gold); font-style: italic; font-weight: 700; }
  .hero-sub {
    font-size: 19px;
    color: #B8B2A4;
    max-width: 620px;
    line-height: 1.7;
    margin-bottom: 48px;
  }
  .hero-cta { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    font-family: inherit;
    font-weight: 500;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
  }
  .btn-primary { background: var(--green); color: #fff; }
  .btn-primary:hover { background: #1a7340; transform: translateY(-1px); }
  .btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.25); }
  .btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

  .hero-meta {
    position: absolute;
    bottom: 60px;
    right: clamp(48px, 6vw, 120px);
    left: clamp(48px, 6vw, 120px);
    transform: translateY(30px);
    display: flex;
    justify-content: space-between;
    align-items: end;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    letter-spacing: 1px;
  }
  .hero-meta .scroll-hint { display: flex; align-items: center; gap: 10px; }
  .scroll-hint::after { content: '↓'; font-size: 18px; animation: nudge 2s ease-in-out infinite; }
  @keyframes nudge {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
  }

  /* LTR-safe runs (phone numbers, emails) inside RTL flow */
  .ltr {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
    text-align: left;
  }

  /* Sections */
  section {
    padding: clamp(120px, 15vw, 200px) clamp(48px, 6vw, 120px);
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
    position: relative;
  }
  .section-head {
    margin-bottom: clamp(40px, 5vw, 64px);
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: wrap;
  }
  .section-eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: 2px;
    color: var(--gold);
    margin-bottom: 16px;
    display: block;
  }
  .section-head h2 {
    font-weight: 900;
    font-size: clamp(32px, 4.5vw, 56px);
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: inherit;
    max-width: 700px;
  }
  .section-head p { max-width: 420px; color: rgba(255,255,255,0.6); font-size: 16px; }

  /* Why Keysun */
  .why { color: #fff; }
  .stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
  }
  .stat { padding: 40px 24px; border-right: 1px solid var(--rule); }
  .stat:last-child { border-right: none; }
  .stat-num {
    font-family: inherit;
    font-weight: 700;
    font-size: 56px;
    line-height: 1;
    color: var(--gold);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
  }
  .stat-label { font-size: 14px; color: rgba(255,255,255,0.7); line-height: 1.5; }
  @media (max-width: 900px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stat { border-right: none; border-bottom: 1px solid var(--rule); }
    .stat:nth-child(odd) { border-left: 1px solid var(--rule); }
  }

  /* Products grid */
  .products-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }
  .product-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--rule);
    overflow: hidden;
    transition: transform 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
  }
  .product-card:hover { transform: translateY(-4px); border-color: var(--gold); }
  
  .product-card .img-wrap {
    aspect-ratio: 4/3;
    background: transparent;
    display: block;
    overflow: hidden;
    position: relative;
  }
  .product-card .img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .product-card .body { padding: 24px; flex: 1; display: flex; flex-direction: column; }
  .product-card .cat-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 1.5px;
    color: var(--gold);
    margin-bottom: 12px;
  }
  .product-card h3 { font-size: 22px; font-weight: 700; margin-bottom: 10px; line-height: 1.3; }
  .product-card p { font-size: 14px; color: rgba(255,255,255,0.65); line-height: 1.6; margin-bottom: 18px; flex: 1; }
  .product-card .specs {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    border-top: 1px solid var(--rule);
    padding-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }
  .product-card .specs span::before { content: '· '; color: var(--gold); }
  .product-card .specs span:first-child::before { content: ''; }
  .product-card.wide { grid-column: span 8; }
  .product-card.medium { grid-column: span 4; }
  .product-card.normal { grid-column: span 4; }
  .product-card.wide .img-wrap { aspect-ratio: 16/9; }
  @media (max-width: 900px) {
    .product-card.wide, .product-card.medium, .product-card.normal { grid-column: span 12; }
  }


  .cert-clickable {
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, border-color 0.2s;
  }
  .cert-clickable:hover {
    transform: translateY(-3px);
    border-color: var(--gold);
  }
  .cert-clickable::after {
    content: '↗';
    position: absolute;
    top: 2px;
    left: 2px;
    color: var(--gold);
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.2s;
  }
  .cert-clickable:hover::after { opacity: 1; }

  /* PDF viewer modal */
  .pdf-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    backdrop-filter: blur(4px);
    animation: pdfFadeIn 0.2s ease-out;
  }
  .pdf-modal.open { display: flex; }
  @keyframes pdfFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  .pdf-modal-inner {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 100%;
    max-height: 92vh;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
  }
  .pdf-modal-header {
    background: var(--night);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.5px;
  }
  .pdf-modal-title { color: var(--gold); }
  .pdf-modal-actions { display: flex; gap: 8px; }
  .pdf-modal-btn {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, border-color 0.15s;
  }
  .pdf-modal-btn:hover { background: rgba(255,255,255,0.15); border-color: var(--gold); }
  .pdf-modal-close {
    background: transparent;
    color: #fff;
    border: 0;
    width: 32px;
    height: 32px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: background 0.15s;
  }
  .pdf-modal-close:hover { background: rgba(255,255,255,0.15); }
  .pdf-modal-body {
    flex: 1;
    background: #333;
    overflow: hidden;
  }
  .pdf-modal-body iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
  }
  @media (max-width: 700px) {
    .pdf-modal { padding: 0; }
    .pdf-modal-inner { max-height: 100vh; border-radius: 0; }
  }


  .certs { color: #fff; --cert-bleed: clamp(48px, 6vw, 120px); }
  .certs-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    justify-items: center;
    gap: 30px 24px;
    box-sizing: border-box;
  }
  .certs-grid > .cert { grid-column: auto; }
  .certs-grid--logos {
    width: calc(100% + (2 * var(--cert-bleed)));
    margin-inline: calc(-1 * var(--cert-bleed));
    padding: 48px var(--cert-bleed);
    background: rgba(255,255,255,0.04);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
  }
  .cert {
    border: 0;
    padding: 0;
    background: transparent;
    width: 100%;
    min-width: 0;
    min-height: 118px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .cert:hover { transform: translateY(-2px); }
  .cert-logo img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(100%, 230px);
    max-height: 94px;
    object-fit: contain;
    opacity: 0.86;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .cert-logo:hover img,
  .cert-logo:focus-within img {
    opacity: 1;
    transform: translateY(-2px);
  }
  .cert-logo:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 5px;
  }
  .cert-pending {
    cursor: default;
  }
  .cert-pending::after { display: none; }
  .cert-pending img { opacity: 0.86; }
  @media (max-width: 900px) {
    .certs { --cert-bleed: 24px; }
    .certs-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 26px 28px;
    }
    .certs-grid > .cert { grid-column: auto; }
    .certs-grid--logos { padding-block: 40px; }
    .cert { min-height: 102px; }
    .cert-logo img {
      max-width: min(100%, 190px);
      max-height: 82px;
    }
  }
  @media (max-width: 520px) {
    .certs-grid { gap: 22px 18px; }
    .certs-grid--logos { padding-block: 34px; }
    .cert { min-height: 88px; }
    .cert-logo img {
      max-width: min(100%, 150px);
      max-height: 68px;
    }
  }

  /* Clients — real client logos, presented as a quiet monochrome strip */
  .clients-band {
    background: rgba(255,255,255,0.04);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding: 60px 0;
    margin: 0 calc(clamp(48px, 6vw, 120px) * -1);
  }
  .clients-strip {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
    justify-items: center;
    gap: 32px 28px;
    padding: 0 clamp(48px, 6vw, 120px);
    width: 100%;
    margin: 0;
  }
  .client-logo {
    width: clamp(112px, 12vw, 174px);
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .client-logo--wide { width: clamp(150px, 17vw, 230px); }
  .client-logo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 58px;
    object-fit: contain;
    opacity: 0.55;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .client-logo--tall img { max-height: 70px; }
  .client-logo:hover img,
  .client-logo:focus-within img {
    opacity: 1;
    transform: translateY(-2px);
  }
  @media (max-width: 900px) {
    .clients-strip {
      gap: 28px 30px;
      padding: 0 24px;
    }
    .client-logo {
      width: 118px;
      min-height: 62px;
    }
    .client-logo--wide { width: 158px; }
    .client-logo img { max-height: 50px; }
    .client-logo--tall img { max-height: 60px; }
  }
  @media (max-width: 520px) {
    .clients-band { padding: 44px 0; }
    .clients-strip { gap: 24px 20px; }
    .client-logo { width: 105px; }
    .client-logo--wide { width: 140px; }
  }

  /* Contact CTA */
  .contact-cta { color: #fff; padding-bottom: 60px; }
  .contact-cta .section-head h2 {
    color: #fff;
    text-shadow: 0 2px 20px rgba(20, 10, 0, 0.35);
  }
  .contact-cta .section-head p {
    color: rgba(255,255,255,0.92);
    text-shadow: 0 1px 12px rgba(20, 10, 0, 0.4);
  }
  .contact-cta .section-eyebrow {
    color: #FFF1C8;
    text-shadow: 0 1px 8px rgba(20, 10, 0, 0.5);
  }
  .contact-card {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(20,32,28,0.1);
    padding: 48px 40px;
    display: grid;
    grid-template-columns: 1.2fr 0.9fr 1.1fr;
    gap: 40px;
    align-items: stretch;
    color: var(--ink);
  }
  .contact-card h3 { font-size: 28px; font-weight: 900; line-height: 1.2; margin-bottom: 18px; color: var(--ink); }
  .contact-card p { color: rgba(20,32,28,0.7); font-size: 15px; margin-bottom: 24px; }
  .contact-map {
    position: relative;
    min-height: 320px;
    border: 1px solid rgba(20,32,28,0.15);
    overflow: hidden;
    background: #eef1f5;
  }
  .contact-map iframe { width: 100%; height: 100%; border: 0; display: block; position: absolute; inset: 0; }
  .contact-map-caption {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(11,19,32,0.9);
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 1.2px;
    padding: 6px 10px;
    text-transform: uppercase;
    z-index: 2;
  }
  .contact-map-fullscreen {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(11,19,32,0.9);
    color: var(--gold);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 1.2px;
    padding: 6px 10px;
    text-decoration: none;
    z-index: 2;
    transition: background 0.2s;
  }
  .contact-map-fullscreen:hover { background: rgba(11,19,32,1); color: #fff; }
  .contact-details {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 2;
    color: var(--ink);
  }
  .contact-details strong { color: var(--coral); font-weight: 500; }
  .contact-inline-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed rgba(20,32,28,0.25);
    transition: color 0.15s, border-color 0.15s;
  }
  .contact-inline-link:hover {
    color: var(--coral);
    border-bottom-color: var(--coral);
  }
  .contact-channels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
  }
  .contact-channels a {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid rgba(20,32,28,0.18);
    border-radius: 999px;
    color: var(--ink);
    text-decoration: none;
    line-height: 1.4;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
  }
  .contact-channels a:hover {
    color: #fff;
    border-color: var(--coral);
    background: var(--coral);
  }
  .map-link {
    display: inline-flex;
    align-items: center;
    color: var(--coral);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    padding: 6px 12px;
    border: 1px solid var(--coral);
    border-radius: 3px;
    margin-top: 4px;
    transition: background 0.2s, color 0.2s;
  }
  .map-link:hover { background: var(--coral); color: #fff; }
  .contact-card .btn-primary { align-self: start; background: var(--ink); }
  .contact-card .btn-primary:hover { background: #000; }
  @media (max-width: 1100px) {
    .contact-card { grid-template-columns: 1fr 1fr; }
    .contact-map { grid-column: span 2; min-height: 280px; }
  }
  @media (max-width: 900px) {
    .contact-card { grid-template-columns: minmax(0, 1fr); padding: 32px 24px; }
    .contact-map { grid-column: auto; min-width: 0; }
  }

  /* Footer */
  footer {
    background: var(--ink);
    color: rgba(255,255,255,0.65);
    padding: 80px clamp(48px, 6vw, 120px) 32px;
  }
  .footer-inner {
    max-width: 1800px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  footer h5 {
    color: var(--gold);
    font-family: inherit;
    font-size: 13px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
  }
  footer ul { list-style: none; }
  footer ul li { margin-bottom: 10px; font-size: 14px; }
  footer a { color: rgba(255,255,255,0.7); text-decoration: none; transition: color 0.2s; }
  footer a:hover { color: var(--gold); }
  .footer-brand p { font-size: 14px; max-width: 360px; line-height: 1.7; margin-top: 16px; }
  .footer-bottom {
    max-width: 1800px;
    margin: 0 auto;
    padding-top: 32px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 1px;
  }
  @media (max-width: 900px) {
    .footer-inner { grid-template-columns: 1fr 1fr; gap: 32px; }
    footer { padding: 60px 24px 24px; }
    section { padding: 80px 24px; }
    .hero { padding: 120px 24px 60px; }
    .hero-meta { right: 24px; left: 24px; bottom: 30px; }
    .clients-band { margin: 0 -24px; }
  }

  /* Reveal on scroll — progressive enhancement.
     Content is visible by default. It is hidden only after the early JS marker
     runs, so disabled, blocked, unsupported, or failed JavaScript never leaves
     page content inaccessible. */
  .reveal {
    opacity: 1;
    transform: none;
  }
  .js .reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s ease, transform 0.7s ease;
  }
  .js .reveal.visible { opacity: 1; transform: translateY(0); }


  /* Hero sun — optimized layered architecture.
     The outer track owns scroll movement only. The visual layers own glow/breathing only. */
  .hero { position: relative; overflow: visible; }

  .hero-sun {
    --sun-x: 0px;
    --sun-y: 0px;
    --sun-scale: 1;
    --sun-opacity: 1;
    --sun-responsive-opacity: 1;

    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: center;
    margin-top: -80px;
    width: clamp(270px, 33vw, 540px);
    height: clamp(270px, 33vw, 540px);
    position: relative;
    pointer-events: none;
    z-index: 1;
    transform-origin: center center;
    transform: translate3d(var(--sun-x), var(--sun-y), 0) scale(var(--sun-scale));
    opacity: var(--sun-opacity);
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  .hero > *:not(.hero-sun) { position: relative; z-index: 2; }

  .hero-sun-visual {
    position: relative;
    width: 100%;
    height: 100%;
    isolation: isolate;
    opacity: var(--sun-responsive-opacity);
    transform: translateZ(0);
    animation: sun-visual-breathe 6s ease-in-out infinite;
  }

  .hero-sun-core,
  .hero-sun-halo,
  .hero-sun-hotspot {
    position: absolute;
    top: 50%;
    left: 50%;
    pointer-events: none;
    user-select: none;
    border-radius: 50%;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
  }

  .hero-sun-core {
    z-index: 3;
    width: 100%;
    height: 100%;
    transform: translate3d(-50%, -50%, 0);
    background-image: url("../images/sun.webp");
    background-image: -webkit-image-set(url("../images/sun.webp") type("image/webp"), url("../images/sun.png") type("image/png"));
    background-image: image-set(url("../images/sun.webp") type("image/webp"), url("../images/sun.png") type("image/png"));
  }

  .hero-sun-halo--inner {
    z-index: 2;
    width: 152%;
    height: 152%;
    opacity: 0.92;
    transform: translate3d(-50%, -50%, 0) scale(0.98);
    background-image: url("../images/sun-halo-inner.webp");
    background-image: -webkit-image-set(url("../images/sun-halo-inner.webp") type("image/webp"), url("../images/sun-halo-inner.png") type("image/png"));
    background-image: image-set(url("../images/sun-halo-inner.webp") type("image/webp"), url("../images/sun-halo-inner.png") type("image/png"));
    animation: sun-halo-inner-breathe 5.5s ease-in-out infinite;
  }

  .hero-sun-halo--outer {
    z-index: 1;
    /* 10% smaller composite surface; the original HQ halo asset and opacity stay unchanged. */
    width: 194%;
    height: 194%;
    opacity: 0.68;
    transform: translate3d(-50%, -50%, 0) scale(0.97);
    background-image: url("../images/sun-halo-outer.webp");
    background-image: -webkit-image-set(url("../images/sun-halo-outer.webp") type("image/webp"), url("../images/sun-halo-outer.png") type("image/png"));
    background-image: image-set(url("../images/sun-halo-outer.webp") type("image/webp"), url("../images/sun-halo-outer.png") type("image/png"));
    animation: sun-halo-outer-breathe 7s ease-in-out infinite;
  }

  .hero-sun-hotspot {
    z-index: 4;
    width: 100%;
    height: 100%;
    transform: translate3d(-50%, -50%, 0);
    background: radial-gradient(circle at 40% 40%, rgba(255,245,215,0.20) 0%, rgba(255,220,160,0.08) 13%, transparent 31%);
    mix-blend-mode: screen;
    animation: sun-hotspot 4.5s ease-in-out infinite;
  }

  @keyframes sun-visual-breathe {
    0%, 100% { transform: translateZ(0) scale(1); }
    50% { transform: translateZ(0) scale(1.015); }
  }

  @keyframes sun-halo-inner-breathe {
    0%, 100% { opacity: 0.82; transform: translate3d(-50%, -50%, 0) scale(0.97); }
    50% { opacity: 1; transform: translate3d(-50%, -50%, 0) scale(1.035); }
  }

  @keyframes sun-halo-outer-breathe {
    0%, 100% { opacity: 0.52; transform: translate3d(-50%, -50%, 0) scale(0.96); }
    50% { opacity: 0.74; transform: translate3d(-50%, -50%, 0) scale(1.04); }
    100% { opacity: 0.52; transform: translate3d(-50%, -50%, 0) scale(0.96); }
  }

  @keyframes sun-hotspot {
    0%, 100% { opacity: 0.60; transform: translate3d(-50%, -50%, 0) scale(1); }
    50% { opacity: 1; transform: translate3d(-50%, -50%, 0) scale(1.08); }
  }

  /* During active scrolling, freeze only the decorative breathing layers.
     The sun keeps its exact appearance while the moving track gets the full frame budget. */
  html.sun-scroll-active .hero-sun-visual,
  html.sun-scroll-active .hero-sun-halo,
  html.sun-scroll-active .hero-sun-hotspot {
    animation-play-state: paused !important;
  }

  @media (max-width: 1100px) {
    .hero-sun {
      grid-column: 1;
      grid-row: 1;
      margin-top: 0;
      width: clamp(240px, 60vw, 390px);
      height: clamp(240px, 60vw, 390px);
    }
  }

  @media (max-width: 900px) {
    .hero-sun { --sun-responsive-opacity: 0.72; }
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .hero-sun-visual,
    .hero-sun-halo,
    .hero-sun-hotspot,
    .scroll-hint::after,
    .pdf-modal,
    .product-card,
    .cert-clickable,
    .client-logo img {
      animation: none !important;
      transition: none !important;
    }

    .reveal {
      opacity: 1 !important;
      transform: none !important;
      transition: none !important;
    }
  }


  /* Language-specific font stacks */
  html[lang="en"] body { font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif; }
  html[lang="en"] h1, html[lang="en"] h2, html[lang="en"] h3, html[lang="en"] h4 {
    font-family: inherit;
  }
  html[lang="ar"] body { font-family: inherit; }


  /* Accessibility: skip-to-content link (visible on keyboard focus) */
  .skip-to-content {
    position: absolute;
    top: -40px;
    inset-inline-start: 8px;
    background: var(--gold);
    color: var(--night);
    padding: 10px 16px;
    z-index: 10000;
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    border-radius: 3px;
    transition: top 0.15s;
  }
  .skip-to-content:focus {
    top: 8px;
    outline: 2px solid var(--night);
    outline-offset: 2px;
  }

  /* ============================================================
     Keyboard focus indicators (WCAG 2.4.7 Focus Visible)
     Only shown for keyboard navigation, not mouse clicks.
     ============================================================ */
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible,
  [tabindex]:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 4px;
    border-radius: 4px;
  }

  /* Contact card sits on a light background — gold outline lacks contrast there.
     Use the coral accent instead for stronger visibility on cream/white. */
  .contact-card a:focus-visible,
  .contact-card button:focus-visible {
    outline-color: var(--coral);
  }

  /* PDF modal buttons are dark-on-dark — keep the gold outline (default) which
     contrasts well against the modal header. No override needed here. */



/* ============================================================
   Language switcher — <a> mirror of the original <button> rules.
   (Same visual contract; <a> replaces <button> after refactor.)
   ============================================================ */
.lang-switch a {
  background: transparent;
  border: 1px solid var(--rule);
  color: #DAD6CB;
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-block;
  line-height: 1.4;
}
.lang-switch a.active {
  background: var(--gold);
  color: var(--night);
  border-color: var(--gold);
}
.lang-switch a:hover:not(.active) {
  border-color: var(--gold);
  color: var(--gold);
}


/* ============================================================
   Brand logo (header + footer image logo)
   -------------------------------------------------------------
   The <a class="logo"> anchor now wraps a <picture> element that
   loads the KEYSUN wordmark. Height is fixed; width auto-scales
   to preserve the logo's aspect ratio. Old .logo-mark rules are
   inert but preserved for compatibility.
   ============================================================ */
.logo { line-height: 0; }
.logo picture,
.logo img {
  display: block;
}
.logo img {
  height: 46px;
  width: auto;
  max-width: 100%;
}
.footer-brand .logo img {
  height: 62px;
}
@media (max-width: 900px) {
  .logo img { height: 36px; }
  .footer-brand .logo img { height: 52px; }
}
@media (max-width: 480px) {
  .logo img { height: 32px; }
}


/* ============================================================
   Product multi-angle galleries
   ============================================================ */
.product-card {
  position: relative;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.product-card:hover {
  box-shadow: 0 18px 42px rgba(0,0,0,0.18);
}
.product-card-hit-area {
  position: absolute;
  inset: 0;
  z-index: 2;
  text-decoration: none;
}
.product-card-hit-area:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -5px;
  border-radius: 2px;
}
.product-card .body {
  position: relative;
  z-index: 1;
}
.product-card .img-wrap {
  background: var(--night);
}
.product-gallery-slides,
.product-gallery-slide {
  width: 100%;
  height: 100%;
}
.product-gallery-slide {
  display: block;
  opacity: 0;
  transform: scale(0.992);
  transition: opacity 0.24s ease, transform 0.3s ease;
}
.product-gallery-slide.is-active {
  opacity: 1;
  transform: scale(1);
}
.product-gallery-slide[hidden] { display: none; }
.product-gallery-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.product-gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(11,19,32,0.78);
  color: #fff;
  display: inline-grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transform: translateY(-50%);
  opacity: 0.82;
  backdrop-filter: blur(8px);
  transition: opacity 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
}
.product-gallery-nav span {
  font-family: Arial, sans-serif;
  font-size: 30px;
  line-height: 1;
  margin-top: -2px;
}
.product-gallery-prev { left: 14px; }
.product-gallery-next { right: 14px; }
.product-gallery-nav:hover {
  opacity: 1;
  background: var(--gold);
  border-color: var(--gold);
  color: var(--night);
}
.product-gallery-status {
  position: absolute;
  z-index: 4;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 54px;
  padding: 5px 10px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  background: rgba(11,19,32,0.72);
  color: rgba(255,255,255,0.86);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  direction: ltr;
  backdrop-filter: blur(7px);
}
@media (max-width: 900px) {
  .product-gallery-nav {
    width: 40px;
    height: 40px;
    opacity: 0.96;
  }
}
@media (max-width: 520px) {
  .product-gallery-prev { left: 9px; }
  .product-gallery-next { right: 9px; }
  .product-gallery-status { bottom: 9px; }
}


/* Gallery click-layer fix — v2 */
.product-card-hit-area {
  z-index: 2;
}
.product-gallery {
  position: relative;
  z-index: 3;
  pointer-events: none;
}
.product-gallery-slides,
.product-gallery-slide,
.product-gallery-status {
  pointer-events: none;
}
.product-gallery-nav {
  z-index: 6;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}


  /* Knowledge-based company certificate */
  .cert-knowledge-based img {
    max-height: 108px;
  }
  @media (max-width: 900px) {
    .cert-knowledge-based img { max-height: 90px; }
  }
  @media (max-width: 520px) {
    .cert-knowledge-based img { max-height: 74px; }
  }


  /* Selected clients: exactly 5 columns x 2 rows on desktop */
  @media (min-width: 1101px) {
    .clients-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  }
  @media (max-width: 1100px) and (min-width: 901px) {
    .clients-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  }
  @media (max-width: 900px) and (min-width: 521px) {
    .clients-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }
  @media (max-width: 520px) {
    .clients-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }


  /* Localized brand name highlight */
  .brand-name {
    color: var(--gold);
    font-weight: 700;
  }


/* ============================================================
   Product image gallery (All-in-One card)
   -------------------------------------------------------------
   Three stacked <picture> slides; only .active is visible.
   Arrow buttons cycle slides. Clicks on the arrows are stopped
   in JS so the card's catalog link doesn't fire.
   ============================================================ */
.product-gallery { position: relative; }
.product-gallery picture {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.product-gallery picture.active {
  position: relative;
  opacity: 1;
  /* Keep the visible product image click-through so the card PDF link below
     receives pointer input. Gallery arrows explicitly opt back in below. */
  pointer-events: none;
}
.product-gallery .pg-arrow {
  pointer-events: auto;   /* overrides inherited none from the legacy .product-gallery rule */
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(11, 19, 32, 0.55);
  color: #FAF6EF;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s, background 0.25s, border-color 0.25s;
  padding: 0 0 3px 0;
}
.product-gallery .pg-prev { left: 12px; }
.product-gallery .pg-next { right: 12px; }
.product-card:hover .pg-arrow,
.product-gallery .pg-arrow:focus-visible {
  opacity: 1;
}
.product-gallery .pg-arrow:hover {
  background: rgba(242, 169, 59, 0.9);
  border-color: #F2A93B;
  color: #0B1320;
}
.product-gallery .pg-arrow:focus-visible {
  outline: 2px solid #F2A93B;
  outline-offset: 2px;
}
/* Touch devices: arrows always visible (no hover) */
@media (hover: none) {
  .product-gallery .pg-arrow { opacity: 1; }
}

/* Compact project gallery inside footer */
.footer-projects {
  min-width: 0;
}
.footer-projects h5 {
  margin-bottom: 16px;
}
.footer-project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.footer-project-item {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
}
.footer-project-item picture,
.footer-project-item img {
  display: block;
  width: 100%;
  height: 100%;
}
.footer-project-item img {
  object-fit: cover;
  filter: saturate(0.9) contrast(1.02);
  transform: scale(1.002);
  transition: transform 0.35s ease, filter 0.35s ease;
}
.footer-project-item:hover img {
  filter: saturate(1) contrast(1.04);
  transform: scale(1.045);
}
@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .footer-project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
}



/* KEYSUN social channel icon links */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.contact-channels--icons {
  align-items: center;
  gap: 10px;
}
.contact-channels--icons .contact-social-link {
  --social-color: var(--coral);
  inline-size: 40px;
  block-size: 40px;
  min-block-size: 40px;
  flex: 0 0 40px;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border-color: var(--social-color);
  color: var(--social-color);
  background: rgba(255,255,255,.74);
  box-shadow: 0 2px 10px rgba(11,19,32,.04);
  transition: transform .2s ease, color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.contact-channels--icons .contact-social-link svg {
  display: block;
  inline-size: 21px;
  block-size: 21px;
  flex: none;
}
.contact-channels--icons .contact-social-link:hover {
  color: #fff;
  background: var(--social-color);
  border-color: var(--social-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(11,19,32,.14);
}
.contact-channels--icons .contact-social-link:focus-visible {
  outline: 3px solid rgba(242,169,59,.34);
  outline-offset: 3px;
}
.contact-channels--icons .social-instagram { --social-color: #e4405f; }
.contact-channels--icons .social-telegram { --social-color: #229ed9; }
.contact-channels--icons .social-whatsapp { --social-color: #25a85a; }
.contact-channels--icons .social-bale { --social-color: #0bae83; }
.contact-channels--icons .contact-email-link {
  min-block-size: 40px;
  padding-inline: 13px;
  border-radius: 999px;
  background: rgba(255,255,255,.74);
}
@media (max-width: 520px) {
  .contact-channels--icons { gap: 8px; }
  .contact-channels--icons .contact-social-link {
    inline-size: 38px;
    block-size: 38px;
    min-block-size: 38px;
    flex-basis: 38px;
  }
  .contact-channels--icons .contact-email-link {
    flex-basis: 100%;
    justify-content: center;
    inline-size: max-content;
  }
}

/* ============================================================
   Compact premium footer refinement
   Keeps the existing content and two-part structure while
   improving balance, spacing and visual hierarchy.
   ============================================================ */
.footer-inner {
  width: 100%;
  max-width: none;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(52px, 7vw, 132px);
  padding-bottom: clamp(34px, 3.8vw, 52px);
}

.footer-brand,
.footer-projects {
  width: min(100%, 650px);
  justify-self: center;
}

.footer-brand .logo {
  display: inline-flex;
}

.footer-brand .logo img {
  height: clamp(72px, 5.2vw, 94px);
}

.footer-brand p {
  max-width: 540px;
  margin-top: 22px;
  font-size: clamp(15px, 1.05vw, 17px);
  line-height: 2;
  color: rgba(255, 255, 255, 0.76);
  text-wrap: pretty;
}

.footer-projects h5 {
  margin-bottom: 18px;
  font-size: clamp(16px, 1.15vw, 19px);
  color: var(--gold);
}

.footer-projects h5::after {
  content: "";
  display: block;
  width: 34px;
  height: 2px;
  margin-top: 10px;
  background: var(--gold);
  border-radius: 999px;
  opacity: 0.9;
}

.footer-project-grid {
  gap: 12px;
}

.footer-project-item {
  border-radius: 9px;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
}

.footer-bottom {
  width: 100%;
  max-width: none;
  padding-top: 24px;
  align-items: center;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.48);
}

@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 42px;
  }

  .footer-brand,
  .footer-projects {
    width: min(100%, 680px);
  }

  .footer-brand .logo img {
    height: 70px;
  }
}

@media (max-width: 560px) {
  .footer-inner {
    gap: 36px;
    padding-bottom: 32px;
  }

  .footer-brand .logo img {
    height: 58px;
  }

  .footer-brand p {
    margin-top: 18px;
    font-size: 14px;
    line-height: 1.9;
  }

  .footer-project-grid {
    gap: 9px;
  }

  .footer-project-item {
    border-radius: 7px;
  }

  .footer-bottom {
    padding-top: 20px;
    align-items: flex-start;
    gap: 8px;
  }
}


/* CSP-safe replacement for former inline contact spacing. */
.contact-subheading { margin-top: 14px; }


/* ============================================================
   Touch target accessibility hardening — v1
   ------------------------------------------------------------
   Keeps the existing visual scale where possible while ensuring
   primary interactive controls have a practical 44px hit area.
   ============================================================ */

/* Header/navigation targets */
.logo {
  min-block-size: 44px;
  min-height: 44px;
  align-items: center;
}
nav a {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  min-height: 44px;
}
.lang-switch a {
  min-block-size: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Product gallery: 44x44 hit area, original 36px visual circle */
.product-gallery .pg-arrow {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: transparent;
  padding: 0;
  isolation: isolate;
  transition: opacity 0.25s;
}
.product-gallery .pg-arrow::before {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(11, 19, 32, 0.55);
  transition: background 0.25s, border-color 0.25s;
}
.product-gallery .pg-arrow::after {
  position: relative;
  z-index: 1;
  color: #FAF6EF;
  font-size: 22px;
  line-height: 1;
  transform: translateY(-1px);
  transition: color 0.25s;
}
.product-gallery .pg-prev::after { content: "‹"; }
.product-gallery .pg-next::after { content: "›"; }
.product-gallery .pg-arrow:hover {
  background: transparent;
  border-color: transparent;
  color: transparent;
}
.product-gallery .pg-arrow:hover::before {
  background: rgba(242, 169, 59, 0.9);
  border-color: #F2A93B;
}
.product-gallery .pg-arrow:hover::after { color: #0B1320; }
.product-gallery .pg-arrow:focus-visible {
  outline: 2px solid #F2A93B;
  outline-offset: 1px;
}

/* PDF modal controls */
.pdf-modal-btn {
  min-block-size: 44px;
  min-height: 44px;
  justify-content: center;
  padding-block: 8px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.pdf-modal-close {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

/* Contact and map targets */
.contact-channels a,
.contact-map-fullscreen,
.map-link,
.contact-inline-link {
  min-block-size: 44px;
  min-height: 44px;
  align-items: center;
}
.contact-map-fullscreen,
.map-link,
.contact-inline-link {
  display: inline-flex;
}
.contact-channels--icons .contact-social-link {
  inline-size: 44px;
  block-size: 44px;
  width: 44px;
  height: 44px;
  min-block-size: 44px;
  min-height: 44px;
  flex: 0 0 44px;
}
.contact-channels--icons .contact-email-link {
  min-block-size: 44px;
  min-height: 44px;
}
@media (max-width: 520px) {
  .contact-channels--icons .contact-social-link {
    inline-size: 44px;
    block-size: 44px;
    width: 44px;
    height: 44px;
    min-block-size: 44px;
    min-height: 44px;
    flex: 0 0 44px;
  }
}


@media (max-width: 520px) {
  .pdf-modal-header {
    padding: 8px 10px;
    gap: 8px;
  }
  .pdf-modal-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .pdf-modal-actions {
    flex: 0 0 auto;
    gap: 4px;
  }
  .pdf-modal-btn {
    width: 44px;
    min-width: 44px;
    padding: 0;
  }
  .pdf-modal-btn span { display: none; }
  .pdf-modal-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* --------------------------------------------------------------------------
   iOS Safari viewport + safe-area hardening
   - 100vh remains as a legacy fallback.
   - svh prevents the hero from being hidden behind Safari browser chrome.
   - dvh lets the open PDF dialog follow the live visual viewport.
   - constant() supports iOS 11.0-11.2; env() supports current Safari.
   -------------------------------------------------------------------------- */

/* Fixed header: keep controls clear of the notch / rounded display corners. */
header {
  padding-top: calc(20px + constant(safe-area-inset-top));
  padding-top: calc(20px + env(safe-area-inset-top));
  padding-right: calc(clamp(48px, 6vw, 120px) + constant(safe-area-inset-right));
  padding-right: calc(clamp(48px, 6vw, 120px) + env(safe-area-inset-right));
  padding-left: calc(clamp(48px, 6vw, 120px) + constant(safe-area-inset-left));
  padding-left: calc(clamp(48px, 6vw, 120px) + env(safe-area-inset-left));
}

/* Hero: stable small viewport height avoids initial clipping under Safari UI. */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  padding-top: calc(140px + constant(safe-area-inset-top));
  padding-top: calc(140px + env(safe-area-inset-top));
  padding-right: calc(clamp(48px, 6vw, 120px) + constant(safe-area-inset-right));
  padding-right: calc(clamp(48px, 6vw, 120px) + env(safe-area-inset-right));
  padding-bottom: calc(80px + constant(safe-area-inset-bottom));
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  padding-left: calc(clamp(48px, 6vw, 120px) + constant(safe-area-inset-left));
  padding-left: calc(clamp(48px, 6vw, 120px) + env(safe-area-inset-left));
}

.hero-meta {
  right: calc(clamp(48px, 6vw, 120px) + constant(safe-area-inset-right));
  right: calc(clamp(48px, 6vw, 120px) + env(safe-area-inset-right));
  left: calc(clamp(48px, 6vw, 120px) + constant(safe-area-inset-left));
  left: calc(clamp(48px, 6vw, 120px) + env(safe-area-inset-left));
  bottom: calc(60px + constant(safe-area-inset-bottom));
  bottom: calc(60px + env(safe-area-inset-bottom));
}

/* PDF dialog: follow the live viewport as Safari bars / keyboard change size. */
.pdf-modal {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  padding-top: calc(40px + constant(safe-area-inset-top));
  padding-top: calc(40px + env(safe-area-inset-top));
  padding-right: calc(20px + constant(safe-area-inset-right));
  padding-right: calc(20px + env(safe-area-inset-right));
  padding-bottom: calc(40px + constant(safe-area-inset-bottom));
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
  padding-left: calc(20px + constant(safe-area-inset-left));
  padding-left: calc(20px + env(safe-area-inset-left));
}

.pdf-modal-inner {
  height: 100%;
  max-height: 92vh;
  max-height: min(92dvh, calc(100dvh - 80px - constant(safe-area-inset-top) - constant(safe-area-inset-bottom)));
  max-height: min(92dvh, calc(100dvh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  min-height: 0;
}

.pdf-modal-header,
.pdf-modal-body {
  min-width: 0;
}

.pdf-modal-body {
  min-height: 0;
}

@media (max-width: 1100px) {
  .hero {
    padding-top: calc(100px + constant(safe-area-inset-top));
    padding-top: calc(100px + env(safe-area-inset-top));
  }
}

@media (max-width: 900px) {
  header {
    padding-top: calc(14px + constant(safe-area-inset-top));
    padding-top: calc(14px + env(safe-area-inset-top));
    padding-right: calc(20px + constant(safe-area-inset-right));
    padding-right: calc(20px + env(safe-area-inset-right));
    padding-bottom: 14px;
    padding-left: calc(20px + constant(safe-area-inset-left));
    padding-left: calc(20px + env(safe-area-inset-left));
  }

  header nav {
    padding-right: calc(20px + constant(safe-area-inset-right));
    padding-right: calc(20px + env(safe-area-inset-right));
    padding-bottom: calc(22px + constant(safe-area-inset-bottom));
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
    padding-left: calc(20px + constant(safe-area-inset-left));
    padding-left: calc(20px + env(safe-area-inset-left));
    max-height: calc(100vh - 72px);
    max-height: calc(100dvh - 72px - env(safe-area-inset-top));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .hero {
    padding-top: calc(120px + constant(safe-area-inset-top));
    padding-top: calc(120px + env(safe-area-inset-top));
    padding-right: calc(24px + constant(safe-area-inset-right));
    padding-right: calc(24px + env(safe-area-inset-right));
    padding-bottom: calc(60px + constant(safe-area-inset-bottom));
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
    padding-left: calc(24px + constant(safe-area-inset-left));
    padding-left: calc(24px + env(safe-area-inset-left));
  }

  .hero-meta {
    right: calc(24px + constant(safe-area-inset-right));
    right: calc(24px + env(safe-area-inset-right));
    left: calc(24px + constant(safe-area-inset-left));
    left: calc(24px + env(safe-area-inset-left));
    bottom: calc(30px + constant(safe-area-inset-bottom));
    bottom: calc(30px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 700px) {
  .pdf-modal {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
  }

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

  .pdf-modal-header {
    padding-top: calc(8px + constant(safe-area-inset-top));
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-right: calc(10px + constant(safe-area-inset-right));
    padding-right: calc(10px + env(safe-area-inset-right));
    padding-left: calc(10px + constant(safe-area-inset-left));
    padding-left: calc(10px + env(safe-area-inset-left));
  }

  .pdf-modal-body {
    padding-right: constant(safe-area-inset-right);
    padding-right: env(safe-area-inset-right);
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: constant(safe-area-inset-left);
    padding-left: env(safe-area-inset-left);
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .hero {
    min-height: 100svh;
    padding-top: calc(92px + constant(safe-area-inset-top));
    padding-top: calc(92px + env(safe-area-inset-top));
    padding-bottom: calc(48px + constant(safe-area-inset-bottom));
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
  }

  .pdf-modal-header {
    padding-top: calc(6px + constant(safe-area-inset-top));
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-bottom: 6px;
  }
}


/* Compact iPhone landscape can be wider than the phone breakpoint. Use the
   live viewport height as the deciding signal and keep the dialog full-screen. */
@media (orientation: landscape) and (max-height: 500px) {
  .pdf-modal {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
  }

  .pdf-modal-inner {
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .pdf-modal-header {
    padding-top: calc(6px + constant(safe-area-inset-top));
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-right: calc(10px + constant(safe-area-inset-right));
    padding-right: calc(10px + env(safe-area-inset-right));
    padding-bottom: 6px;
    padding-left: calc(10px + constant(safe-area-inset-left));
    padding-left: calc(10px + env(safe-area-inset-left));
  }

  .pdf-modal-body {
    padding-right: constant(safe-area-inset-right);
    padding-right: env(safe-area-inset-right);
    padding-bottom: constant(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: constant(safe-area-inset-left);
    padding-left: env(safe-area-inset-left);
  }
}
