/* ============================================================
   MyFonts.lk - Responsive Override (Simplified)
   Only handles extreme screen sizes - 4K, 2K, Ultra-wide
   Normal desktop/laptop uses original CSS
   ============================================================ */

/* ---- 4K Screens (3840px+) ---- */
@media (min-width: 3200px) {
  .shell {
    width: min(2400px, calc(100vw - 80px));
  }
  body.basic-home {
    font-size: 17px;
  }
  .hero h1 {
    font-size: 68px;
  }
  .hero p {
    font-size: 24px;
  }
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 700px;
    gap: 72px;
  }
  .hero-visual {
    min-height: 420px;
  }
  .mock-window {
    width: 480px;
  }
  .letter-badge {
    width: 150px;
    height: 150px;
    font-size: 86px;
  }
  .hero-rings {
    width: 600px;
    height: 460px;
  }
  .converter-grid {
    gap: 20px;
  }
  .converter-card {
    padding: 22px;
  }
  textarea {
    min-height: 450px;
    font-size: 20px;
  }
  .sinkey-banner {
    gap: 36px;
    padding: 36px 32px;
  }
  .sinkey-icon {
    width: 140px;
    height: 140px;
  }
  .sinkey-copy h2 {
    font-size: 38px;
  }
  .sinkey-copy p {
    font-size: 20px;
  }
  .why-grid {
    gap: 24px;
  }
  .why-card {
    padding: 26px;
  }
  .why-card strong {
    font-size: 18px;
  }
  .why-card p {
    font-size: 17px;
  }
  .footer-grid {
    gap: 40px;
  }
  .footer h3 {
    font-size: 17px;
  }
  .footer a, .footer span {
    font-size: 15px;
  }
  .nav-links a {
    font-size: 20px;
  }
  .brand-logo-image {
    width: min(100%, 320px);
  }
  .reviews-head h2 {
    font-size: 44px;
  }
  .feature-strip {
    gap: 22px;
  }
  .info-card {
    padding: 26px;
    min-height: 170px;
  }
  .font-grid {
    gap: 22px;
  }
  .font-card {
    padding: 22px;
  }
  .font-card h3 {
    font-size: 28px;
  }
}

/* ---- 2K / QHD Screens (2560px - 3199px) ---- */
@media (min-width: 2200px) and (max-width: 3199px) {
  .shell {
    width: min(2000px, calc(100vw - 64px));
  }
  body.basic-home {
    font-size: 16px;
  }
  .hero h1 {
    font-size: 60px;
  }
  .hero p {
    font-size: 22px;
  }
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 620px;
    gap: 60px;
  }
  .hero-visual {
    min-height: 380px;
  }
  .mock-window {
    width: 420px;
  }
  .letter-badge {
    width: 130px;
    height: 130px;
    font-size: 74px;
  }
  .hero-rings {
    width: 520px;
    height: 400px;
  }
  .converter-grid {
    gap: 18px;
  }
  .converter-card {
    padding: 20px;
  }
  textarea {
    min-height: 420px;
    font-size: 19px;
  }
  .sinkey-banner {
    gap: 32px;
    padding: 32px 28px;
  }
  .sinkey-icon {
    width: 120px;
    height: 120px;
  }
  .sinkey-copy h2 {
    font-size: 34px;
  }
  .sinkey-copy p {
    font-size: 18px;
  }
  .why-grid {
    gap: 22px;
  }
  .why-card {
    padding: 24px;
  }
  .why-card strong {
    font-size: 17px;
  }
  .why-card p {
    font-size: 16px;
  }
  .footer-grid {
    gap: 36px;
  }
  .footer h3 {
    font-size: 16px;
  }
  .nav-links a {
    font-size: 19px;
  }
  .brand-logo-image {
    width: min(100%, 290px);
  }
  .reviews-head h2 {
    font-size: 40px;
  }
  .feature-strip {
    gap: 20px;
  }
  .info-card {
    padding: 24px;
    min-height: 160px;
  }
  .font-grid {
    gap: 20px;
  }
  .font-card {
    padding: 20px;
  }
  .font-card h3 {
    font-size: 26px;
  }
}

/* ---- Ultra-wide Screens (21:9 / 32:9) ---- */
@media (min-width: 2560px) and (min-aspect-ratio: 21/9) {
  .shell {
    width: min(2200px, calc(100vw - 80px));
  }
  .hero-grid {
    grid-template-columns: 1fr 1fr;
    gap: 72px;
  }
  .converter-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
  .why-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
  }
  .footer-grid {
    grid-template-columns: 1.5fr repeat(4, 1fr);
    gap: 44px;
  }
}

  .sinkey-copy h1 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin: 0 0 9px;
    color: var(--ink);
    font-size: 28px;
    font-weight: 700;
    line-height: normal;
  }
  .sinkey-copy h1 span {
    display: flex;
    min-height: 25px;
    align-items: center;
    padding: 0 12px;
    border-radius: 999px;
    background: #eaf3ff;
    color: var(--blue);
    font-size: 13px;
    font-weight: 600;
  }

/* ---- Touch device optimizations ---- */
@media (hover: none) and (pointer: coarse) {
  .actions .ghost-action, .ghost-action, .primary-action, .keymap-toggle, .download-btn {
    min-height: 44px;
    min-width: 44px;
  }
  .vk-action-key, .vk-map-key, .vk-static-key {
    min-height: 52px;
    min-width: 52px;
  }
  .nav-links a {
    min-height: 44px;
  }
  .rating-star {
    min-width: 44px;
    min-height: 44px;
  }
  .social-link,
  #coffeeBtn {
    min-width: 44px;
    min-height: 44px;
  }
  .footer-grid > div:not(.footer-brand) > a {
    display: flex;
    align-items: center;
    min-height: 44px;
  }
}

/* ---- Authentication portal: tablet and mobile ---- */
@media (max-width: 900px) {
  body.auth-portal-page .auth-portal-shell {
    width: min(100%, calc(100vw - 32px));
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 24px;
    min-height: auto;
    overflow: visible;
    transform: none;
  }
  body.auth-portal-page .auth-card-shell {
    order: 1;
    width: 100%;
    justify-content: center;
  }
  body.auth-portal-page .auth-showcase {
    order: 2;
    width: 100%;
  }
  body.auth-portal-page .auth-portal-card {
    width: min(100%, 500px);
    max-width: 100%;
    margin-inline: auto;
  }
}

@media (max-width: 760px) {
  body.auth-portal-page {
    min-width: 0;
    min-height: 100dvh;
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-padding-block: 88px max(24px, env(safe-area-inset-bottom));
  }
  body.auth-portal-page .auth-topbar {
    width: 100%;
  }
  body.auth-portal-page .auth-topbar-inner {
    width: calc(100% - 24px) !important;
    min-height: 72px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0;
  }
  body.auth-portal-page .auth-brand {
    min-width: 0;
  }
  body.auth-portal-page .auth-brand .brand-logo-image {
    width: clamp(170px, 60vw, 210px);
    max-width: 100%;
    height: auto;
  }
  body.auth-portal-page .auth-back-link {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    gap: 0;
  }
  body.auth-portal-page .auth-back-link::after {
    content: none !important;
  }
  body.auth-portal-page .auth-back-link > span:last-child {
    display: none;
  }
  body.auth-portal-page .auth-back-link-icon {
    width: 24px;
    height: 24px;
  }
  body.auth-portal-page .auth-portal-shell {
    width: calc(100% - 24px);
    min-height: auto;
    display: block;
    padding-top: 16px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
    overflow: visible;
  }
  body.auth-portal-page .auth-showcase {
    display: none;
  }
  body.auth-portal-page .auth-card-shell {
    width: 100%;
    display: block;
  }
  body.auth-portal-page .auth-portal-card,
  body.auth-portal-page[data-auth-mode="register"] .auth-portal-card {
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 22px 16px 24px;
    border-radius: 20px;
    overflow: visible;
  }
  body.auth-portal-page .auth-card-icon {
    display: none;
  }
  body.auth-portal-page .auth-portal-head {
    text-align: left;
  }
  body.auth-portal-page .auth-portal-head h2 {
    margin-bottom: 6px;
    font-size: clamp(26px, 8vw, 30px);
    line-height: 1.15;
  }
  body.auth-portal-page .auth-portal-head p {
    max-width: none;
    margin: 0;
    font-size: 14px;
    line-height: 1.45;
  }
  body.auth-portal-page .auth-status {
    margin-bottom: 10px;
  }
  body.auth-portal-page .auth-form-grid,
  body.auth-portal-page[data-auth-mode="register"] .auth-form-grid {
    gap: 14px;
    margin-top: 18px;
  }
  body.auth-portal-page .auth-field {
    min-width: 0;
    gap: 6px;
  }
  body.auth-portal-page .auth-field > span:first-child {
    font-size: 14px;
  }
  body.auth-portal-page .auth-field input {
    min-width: 0;
    min-height: 52px;
    padding-right: 46px;
    padding-left: 46px;
    border-radius: 12px;
    font-size: 16px;
    scroll-margin-block: 88px 180px;
  }
  body.auth-portal-page .auth-input-icon {
    left: 14px;
  }
  body.auth-portal-page .auth-input-eye {
    right: 2px;
  }
  body.auth-portal-page .auth-row-actions {
    min-width: 0;
    margin: 0 0 4px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }
  body.auth-portal-page .auth-checkbox {
    min-height: 44px;
    gap: 8px;
  }
  body.auth-portal-page .auth-checkbox input {
    width: 20px;
    height: 20px;
  }
  body.auth-portal-page .auth-checkbox-terms {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    margin-top: 0;
    line-height: 1.45;
  }
  body.auth-portal-page .auth-inline-link-tight {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    margin: 0;
  }
  body.auth-portal-page .auth-inline-link-inline,
  body.auth-portal-page .auth-note .auth-inline-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    margin: 0;
    vertical-align: middle;
  }
  body.auth-portal-page .auth-submit-strong {
    min-height: 54px;
    border-radius: 12px;
    font-size: 16px;
  }
  body.auth-portal-page .auth-provider-block {
    gap: 10px;
    margin-top: 12px;
  }
  body.auth-portal-page .auth-provider-divider {
    min-height: 32px;
  }
  body.auth-portal-page .auth-provider-divider span {
    width: 32px;
    height: 32px;
  }
  body.auth-portal-page .auth-provider-btn {
    min-height: 52px;
    border-radius: 12px;
    font-size: 16px;
  }
  body.auth-portal-page .auth-bottom-copy {
    margin-top: 16px;
    font-size: 14px;
    line-height: 1.5;
  }
  body.auth-portal-page .auth-note {
    margin-top: 12px;
    padding: 12px 14px;
    font-size: 14px;
  }
  body.auth-portal-page .auth-verify-block {
    margin-top: 14px;
    padding-top: 14px;
  }
  body.auth-portal-page .auth-footer {
    display: none;
  }
}

@media (max-width: 360px) {
  body.auth-portal-page .auth-topbar-inner,
  body.auth-portal-page .auth-portal-shell {
    width: calc(100% - 16px) !important;
  }
  body.auth-portal-page .auth-brand .brand-logo-image {
    width: clamp(158px, 58vw, 190px);
  }
  body.auth-portal-page .auth-portal-card,
  body.auth-portal-page[data-auth-mode="register"] .auth-portal-card {
    padding-right: 12px;
    padding-left: 12px;
  }
}

@media (max-width: 760px) and (max-height: 700px) {
  body.auth-portal-page .auth-portal-head p {
    display: none;
  }
  body.auth-portal-page .auth-form-grid,
  body.auth-portal-page[data-auth-mode="register"] .auth-form-grid {
    margin-top: 14px;
  }
}

.footer h3 {
  margin: 0;
  font-size: 15px;
}

.status-pill {
  color: #17752b;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .hero-rings, .dot-mesh, .hero-pin, .mock-window, .letter-badge {
    animation: none !important;
    transform: none !important;
  }
}

/* ---- Print styles ---- */
@media print {
  .topbar, .footer, .hero-visual, .sinkey-banner, .keymap-switcher {
    display: none !important;
  }
  .shell {
    width: 100% !important;
    max-width: 100% !important;
  }
  body {
    font-size: 12pt !important;
    background: #fff !important;
  }
}

/* ---- Hero → Converter spacing ---- */
.hero {
  padding-bottom: 36px;
}
.converter-surface {
  margin-top: 0;
}
/* Skip layout and paint work for content well below the initial mobile viewport. */
.keymap-switcher,
.feature-strip,
.fonts-section,
.sinkey-section,
.reviews-section,
.faq-section,
.footer {
  content-visibility: auto;
  contain-intrinsic-size: auto 700px;
}

@media (max-width: 720px) {
  /* Auth controls are hydrated after first paint; reserve their row to prevent CLS. */
  .header-auth { min-height: 44px; }
}
