/* ── UI ENHANCEMENTS - saimabbasi.com ── */

/* Scroll padding for sticky nav */
html { scroll-padding-top: 80px; }

/* View Transitions API */
@view-transition { navigation: auto; }
@keyframes ui-fade-in { from { opacity: 0; } to { opacity: 1; } }
::view-transition-old(root) { animation: none; }
::view-transition-new(root) { animation: ui-fade-in 0.18s ease; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}

/* Focus visible */
*:focus { outline: none; }
*:focus-visible { outline: 2px solid #C9A84C; outline-offset: 3px; border-radius: 2px; }

/* ── NAV DROPDOWN ── */
.nav-links > li { display: flex; align-items: center; }
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
  background: none; border: none; cursor: pointer;
  color: #A89F8C; font-family: 'Montserrat', sans-serif;
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  padding: 0; transition: color 0.3s; white-space: nowrap;
  display: flex; align-items: center; gap: 4px;
  line-height: normal; vertical-align: middle;
}
.nav-dropdown-toggle:hover, .nav-dropdown.open .nav-dropdown-toggle { color: #E8C97A; }
.nav-dropdown-menu {
  position: absolute; top: calc(100% + 14px); left: 0;
  background: rgba(8,8,8,0.98); border: 1px solid rgba(201,168,76,0.2);
  min-width: 160px; list-style: none;
  display: flex; flex-direction: column; padding: 0;
  z-index: 200; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  max-height: 0; overflow: hidden; opacity: 0; pointer-events: none;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
}
.nav-dropdown.open .nav-dropdown-menu {
  max-height: 320px; opacity: 1; pointer-events: auto; padding: 8px 0;
}
.nav-dropdown-menu li a {
  display: block; padding: 10px 20px;
  color: #A89F8C; text-decoration: none;
  font-size: 9px; letter-spacing: 2px; text-transform: uppercase;
  white-space: nowrap; transition: color 0.3s, background 0.2s;
}
.nav-dropdown-menu li a:hover { color: #E8C97A; background: rgba(201,168,76,0.06); }
@media (max-width: 768px) {
  .nav-dropdown-menu {
    position: static; border: none; border-left: 1px solid rgba(201,168,76,0.2);
    padding: 0; background: transparent; box-shadow: none; margin-left: 20px;
    /* on mobile keep max-height animation but start smaller */
    max-height: 0;
  }
  .nav-dropdown.open .nav-dropdown-menu {
    max-height: 240px; padding: 4px 0;
  }
  .nav-dropdown-menu li a { padding: 12px 20px; font-size: 10px; min-height: 44px; display: flex; align-items: center; }
  .nav-dropdown-toggle { font-size: 10px; padding: 14px 20px; min-height: 44px; width: 100%; }
}

/* ── READING PROGRESS BAR ── */
#ui-progress {
  position: fixed; top: 0; left: 0; z-index: 9998; height: 2px; width: 0%;
  background: linear-gradient(90deg, #8B6914, #C9A84C, #E8C97A);
  transition: width 0.08s linear; pointer-events: none;
}

/* ── BACK TO TOP ── */
#ui-btt {
  position: fixed; bottom: calc(32px + env(safe-area-inset-bottom, 0px)); right: 32px; z-index: 90;
  width: 44px; height: 44px; background: rgba(8,8,8,0.92);
  border: 1px solid rgba(201,168,76,0.2); color: #C9A84C;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity 0.3s, border-color 0.3s, background 0.3s;
  text-decoration: none; font-size: 18px; line-height: 1; font-family: inherit;
}
#ui-btt.visible { opacity: 1; pointer-events: auto; }
#ui-btt:hover { border-color: #C9A84C; background: rgba(201,168,76,0.12); }

/* ── SKIP NAV ── */
#ui-skip {
  position: absolute; top: -100px; left: 16px; z-index: 9999;
  padding: 10px 20px; background: #C9A84C; color: #080808;
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  font-family: 'Montserrat', sans-serif; font-weight: 600;
  text-decoration: none; transition: top 0.2s;
}
#ui-skip:focus { top: 16px; }

/* ── FLOATING SHARE BAR ── */
#ui-share {
  position: fixed; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); right: 32px; z-index: 89;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
#ui-share.visible { opacity: 1; pointer-events: auto; }
.ui-share-btn {
  width: 44px; height: 44px; background: rgba(8,8,8,0.92);
  border: 1px solid rgba(201,168,76,0.2); color: #C9A84C;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none;
  font-size: 11px; letter-spacing: 1px; font-weight: 500;
  font-family: 'Montserrat', sans-serif; transition: border-color 0.2s, background 0.2s;
}
.ui-share-btn:hover { border-color: #C9A84C; background: rgba(201,168,76,0.08); }

/* ── ACTIVE NAV ── */
.nav-active { color: #C9A84C !important; }

/* ── TABLE OF CONTENTS ── */
#ui-toc {
  position: fixed; top: 50%; left: 24px; transform: translateY(-50%);
  z-index: 80; max-width: 200px;
  opacity: 0; animation: ui-fade-in 0.4s ease 0.6s forwards;
}
@media (max-width: 1279px) { #ui-toc { display: none; } }
#ui-toc-label {
  font-size: 8px; letter-spacing: 3px; text-transform: uppercase;
  color: rgba(168,159,140,0.5); margin-bottom: 12px; font-family: 'Montserrat', sans-serif;
}
#ui-toc-list { list-style: none; margin: 0; padding: 0; }
#ui-toc-list li { margin-bottom: 6px; }
.ui-toc-link {
  font-size: 10px; color: rgba(168,159,140,0.55); text-decoration: none;
  font-family: 'Montserrat', sans-serif; line-height: 1.5;
  transition: color 0.2s; display: block;
  border-left: 1px solid rgba(201,168,76,0.12); padding-left: 10px;
}
.ui-toc-link:hover { color: #A89F8C; }
.ui-toc-link.active { color: #C9A84C; border-left-color: #C9A84C; }

/* ── NEWSLETTER POPUP ── */
#ui-popup {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(8,8,8,0.85); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; opacity: 0; transition: opacity 0.3s;
}
#ui-popup.visible { opacity: 1; }
#ui-popup-box {
  background: #111111; border: 1px solid rgba(201,168,76,0.25);
  padding: 52px 48px; max-width: 500px; width: 100%;
  text-align: center; position: relative;
  transform: translateY(12px); transition: transform 0.3s;
}
#ui-popup.visible #ui-popup-box { transform: translateY(0); }
#ui-popup-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: none; color: rgba(168,159,140,0.5);
  font-size: 22px; cursor: pointer; line-height: 1; padding: 4px;
  transition: color 0.2s; font-family: inherit;
}
#ui-popup-close:hover { color: #A89F8C; }
#ui-popup-eyebrow {
  font-size: 8px; letter-spacing: 4px; text-transform: uppercase;
  color: #C9A84C; margin-bottom: 20px; font-family: 'Montserrat', sans-serif;
}
#ui-popup-title {
  font-family: 'Cormorant Garamond', Georgia, serif; font-size: clamp(28px, 4vw, 40px);
  font-weight: 300; color: #F5F0E8; line-height: 1.15; margin-bottom: 16px;
}
#ui-popup-sub {
  font-size: 11px; color: #A89F8C; line-height: 1.9;
  font-family: 'Montserrat', sans-serif; margin-bottom: 28px;
}
#ui-popup-cta {
  display: inline-block; padding: 14px 36px;
  background: #C9A84C; color: #080808;
  font-size: 10px; letter-spacing: 3px; text-transform: uppercase;
  font-family: 'Montserrat', sans-serif; font-weight: 500;
  text-decoration: none; transition: background 0.2s; margin-bottom: 14px;
}
#ui-popup-cta:hover { background: #E8C97A; }
#ui-popup-note {
  font-size: 9px; color: rgba(168,159,140,0.45);
  font-family: 'Montserrat', sans-serif; letter-spacing: 1px;
}
@media (max-width: 480px) {
  #ui-popup-box { padding: 40px 28px; }
}

/* ── SCROLL REVEAL ── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ── FAQ ── */
.faq-section { padding: 80px 60px; border-top: 1px solid rgba(201,168,76,0.2); }
.faq-label { font-size: 10px; letter-spacing: 4px; text-transform: uppercase; color: #C9A84C; margin-bottom: 20px; font-family: 'Montserrat', sans-serif; }
.faq-title { font-family: 'Cormorant Garamond', Georgia, serif; font-size: clamp(32px, 4vw, 52px); font-weight: 300; margin-bottom: 48px; color: #F5F0E8; }
.faq-title em { font-style: italic; color: #E8C97A; }
.faq-item { border-bottom: 1px solid rgba(201,168,76,0.2); padding: 28px 0; }
.faq-q {
  font-size: 13px; letter-spacing: 1px; font-weight: 500; color: #F5F0E8;
  margin-bottom: 0; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  font-family: 'Montserrat', sans-serif; user-select: none;
  transition: color 0.2s;
}
.faq-q:hover { color: #E8C97A; }
.faq-q::after { content: '+'; font-size: 20px; color: #C9A84C; transition: transform 0.3s; flex-shrink: 0; }
.faq-item.open .faq-q::after { transform: rotate(45deg); }
.faq-a {
  font-size: 13px; line-height: 1.9; color: #A89F8C;
  display: none; padding-top: 16px;
  font-family: 'Montserrat', sans-serif; font-weight: 300;
}
.faq-a a { color: #C9A84C; text-decoration: none; }
.faq-a a:hover { color: #E8C97A; }
.faq-item.open .faq-a { display: block; }
@media (max-width: 768px) { .faq-section { padding: 60px 20px; } }

/* ── PRINT ── */
@media print {
  nav, footer, #sa-cb, #ui-btt, #ui-share, #ui-progress, #ui-skip,
  #ui-toc, #ui-popup, .back-to-top, .skip-nav, .nav-hamburger,
  .reading-progress, script { display: none !important; }
  body { background: #fff !important; color: #111 !important; font-size: 12pt; }
  h1, h2, h3 { color: #000 !important; page-break-after: avoid; }
  a { color: #333 !important; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
  a.nav-cta::after, a.btn-gold::after, a.btn-outline::after,
  a.article-cta::after { content: none; }
  p, li { orphans: 3; widows: 3; }
  .article-body, .section, main { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
  img { max-width: 100%; page-break-inside: avoid; }
}

/* article byline */
.article-byline{font-size:10px;letter-spacing:1.5px;color:var(--white-dim,#A89F8C);text-transform:uppercase;}
.article-byline a{color:var(--gold,#C9A84C);text-decoration:none;}


/* ═══════════════════════════════════════════════════════
   MOBILE & TABLET OPTIMISATIONS
   Breakpoints: 960px (tablet), 768px (portrait), 480px (mobile)
   ═══════════════════════════════════════════════════════ */

/* ── Prevent horizontal overflow site-wide ── */
html { overflow-x: hidden; }
body { overflow-x: hidden; max-width: 100vw; }

/* ── Word wrap safety ── */
@media (max-width: 768px) {
  h1, h2, h3, h4, p, li, td, th, blockquote {
    overflow-wrap: break-word;
    word-break: break-word;
  }
}

/* ══ NAV: Standardise hamburger at 960px for all pages ══ */
@media (max-width: 960px) {
  nav {
    position: relative !important;
    flex-wrap: wrap !important;
    padding: 18px 24px !important;
  }
  .nav-hamburger { display: flex !important; }
  .nav-links:not(.open) {
    display: none !important;
  }
  .nav-links.open {
    display: flex !important;
    flex-direction: column !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important; right: 0 !important;
    background: rgba(8,8,8,0.98) !important;
    border-bottom: 1px solid rgba(201,168,76,0.15) !important;
    padding: 8px 0 16px !important;
    gap: 0 !important;
    z-index: 199 !important;
    width: auto !important;
  }
  .nav-links li { width: 100% !important; }
  .nav-links a {
    display: flex !important;
    align-items: center !important;
    padding: 14px 24px !important;
    font-size: 10px !important;
    min-height: 44px !important;
    letter-spacing: 2px !important;
  }
  .nav-cta {
    margin: 8px 24px 4px !important;
    display: block !important;
    text-align: center !important;
    min-height: 44px !important;
    line-height: 44px !important;
    padding: 0 22px !important;
  }
}

/* ══ FOOTER: 4-col → 2-col on tablet ══ */
@media (max-width: 900px) {
  .foot-top { grid-template-columns: 1fr 1fr !important; gap: 32px !important; }
}

/* ══ FOOTER: mobile — brand full-width, 3 link cols in a row ══ */
@media (max-width: 540px) {
  .foot-top {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 24px 12px !important;
  }
  .foot-brand {
    grid-column: 1 / -1 !important;
    padding-bottom: 20px !important;
    border-bottom: 1px solid rgba(201,168,76,0.1) !important;
    margin-bottom: 4px !important;
  }
  .foot-col { gap: 8px !important; }
  .foot-col h4 { font-size: 9px !important; margin-bottom: 6px !important; }
  .foot-col a { font-size: 11px !important; }
  .foot-bottom { flex-direction: column !important; gap: 10px !important; text-align: center !important; }
}

/* ══ TOUCH: Minimum tap target size ══ */
@media (max-width: 960px) {
  button, [role="button"] { min-height: 44px; }
  .btn-gold, .btn-outline, .btn-primary, .btn-secondary,
  .nav-cta, .cta-btn { min-height: 44px; }
}

/* ══ iOS: Prevent input zoom (font-size must be ≥16px) ══ */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="search"],
  textarea,
  select {
    font-size: 16px !important;
    -webkit-text-size-adjust: 100%;
  }
}

/* ══ TESTIMONIALS CAROUSEL: better card width on mobile ══ */
@media (max-width: 600px) {
  .testi-card { width: 260px !important; padding: 24px 20px !important; }
  .testi-quote { font-size: 13px !important; }
}

/* ══ POPUP: better sizing on mobile ══ */
@media (max-width: 540px) {
  #ui-popup { padding: 16px !important; }
  #ui-popup-box { padding: 36px 24px 32px !important; }
  #ui-popup-title { font-size: clamp(24px, 7vw, 36px) !important; }
  #ui-popup-cta { padding: 14px 28px !important; }
}

/* ══ BTT + SHARE: tighter positioning on small screens ══ */
@media (max-width: 540px) {
  #ui-btt { bottom: 20px !important; right: 16px !important; }
  #ui-share { bottom: 76px !important; right: 16px !important; }
}

/* ══ FAQ: Better mobile spacing ══ */
@media (max-width: 540px) {
  .faq-section { padding: 48px 20px !important; }
  .faq-q { font-size: 12px !important; }
}

/* ══ SCROLL REVEAL: Reduce transform distance on mobile ══ */
@media (max-width: 768px) {
  .reveal { transform: translateY(16px); }
}

/* ═══════════════════════════════════════════════════════
   ADDITIONAL MOBILE & TABLET FIXES
   ═══════════════════════════════════════════════════════ */

/* ══ INDEX: 2-col grids on iPad (600–959px) ══
   ventures-grid, work-grid, press-grid collapse to 1-col at 960px
   Override to 2-col for tablet range instead.                    */
@media (min-width: 600px) and (max-width: 959px) {
  .ventures-grid { grid-template-columns: 1fr 1fr !important; }
  .work-grid     { grid-template-columns: 1fr 1fr !important; }
  .press-grid    { grid-template-columns: 1fr 1fr !important; }
}

/* ══ INDEX: press-grid 1-col on small phones ══ */
@media (max-width: 599px) {
  .press-grid { grid-template-columns: 1fr !important; }
}

/* ══ INDEX: Hero photo — less height on small phones ══ */
@media (max-width: 480px) {
  .hero-photo { min-height: 38vh !important; }
}

/* ══ INDEX: Stats bar — 3-col on tablet, 2-col on mobile ══ */
@media (min-width: 600px) and (max-width: 959px) {
  .stats { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ══ INDEX: Section padding — tighter on tablet ══ */
@media (min-width: 600px) and (max-width: 959px) {
  .section { padding: 80px 32px !important; }
}

/* ══ Logo bar / As Seen In: allow pills to scroll horizontally ══ */
@media (max-width: 768px) {
  .logo-bar-grid {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    justify-content: flex-start !important;
    padding-bottom: 4px !important;
    scrollbar-width: none !important;
  }
  .logo-bar-grid::-webkit-scrollbar { display: none !important; }
  .logo-pill {
    flex-shrink: 0 !important;
    border-right: 1px solid rgba(201,168,76,0.15) !important;
  }
}

/* ══ VIDEO EMBED: Maintain 16/9 on all screens ══ */
@media (max-width: 960px) {
  .video-wrap {
    max-width: 100% !important;
    margin: 0 !important;
  }
}

/* ══ BIO QUOTE: better mobile padding ══ */
@media (max-width: 540px) {
  .bio-quote { padding: 18px 20px !important; }
  .bio-quote p { font-size: 18px !important; }
}

/* ══ ABOUT PAGE: hero two-col → single on tablet ══ */
@media (max-width: 960px) {
  .hero-card {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}
@media (max-width: 540px) {
  .hero-card {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ══ VENTURES PAGE: venture-item padding on mobile ══ */
@media (max-width: 480px) {
  .venture-item { padding: 28px 16px !important; gap: 12px !important; }
}

/* ══ COOKIE BANNER: stack on mobile ══ */
@media (max-width: 768px) {
  .cookie-banner {
    padding: 16px 20px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 14px !important;
  }
  .cookie-actions { width: 100% !important; }
  .cookie-accept, .cookie-decline {
    flex: 1 !important;
    text-align: center !important;
    min-height: 44px !important;
  }
}

/* ══ NEWSLETTER FORM: stack input+btn on mobile ══ */
@media (max-width: 540px) {
  .wl-form {
    flex-direction: column !important;
    gap: 0 !important;
  }
  .wl-input {
    border-right: 1px solid rgba(201,168,76,0.2) !important;
    border-bottom: none !important;
  }
  .wl-btn { width: 100% !important; }
}

/* ══ SPEAKING: topic tag chips wrap cleanly ══ */
@media (max-width: 540px) {
  .topic-tags, .tag-grid {
    gap: 8px !important;
  }
}

/* ══ BUTTON PAIRS: stack on very small phones ══ */
@media (max-width: 400px) {
  .hero-btns,
  .cta-buttons,
  .btn-row {
    flex-direction: column !important;
    gap: 10px !important;
    align-items: stretch !important;
  }
  .btn-primary, .btn-secondary, .btn-gold, .btn-outline {
    width: 100% !important;
    text-align: center !important;
    justify-content: center !important;
  }
}

/* ══ FILTER TABS: horizontal scroll on mobile ══ */
@media (max-width: 600px) {
  .filters {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 4px !important;
    scrollbar-width: none !important;
    gap: 8px !important;
  }
  .filters::-webkit-scrollbar { display: none !important; }
  .filter-btn, .filter-tab {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
}

/* ══ PRESS PAGE: cards on mobile ══ */
@media (max-width: 600px) {
  .press-card { padding: 22px 18px !important; }
}

/* ══ TESTIMONIALS: narrower fade on mobile ══ */
@media (max-width: 540px) {
  .testi-track-wrap::before,
  .testi-track-wrap::after { width: 40px !important; }
}

/* ══ GENERAL: Images never overflow ══ */
img, video, iframe, embed, object {
  max-width: 100%;
}

/* ══ GENERAL: Better line-height for small text on mobile ══ */
@media (max-width: 540px) {
  .stat-lbl, .sec-label, .v-role, .work-num { letter-spacing: 2px !important; }
}

/* ══ BLOG: Post card hover lift ══ */
.post-card {
  transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease !important;
}
.post-card:hover {
  transform: translateY(-3px) !important;
  box-shadow: 0 8px 24px rgba(201,168,76,0.08) !important;
}

/* ══ BLOG: Filter tabs — right-edge fade on mobile ══ */
@media (max-width: 600px) {
  .filters {
    position: relative;
  }
  .filters::after {
    content: '';
    position: absolute; top: 0; right: 0; bottom: 0;
    width: 48px;
    background: linear-gradient(270deg, rgba(8,8,8,0.97) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
  }
}

/* ══ INDEX: Social card hover — spring feel ══ */
.s-card {
  transition: border-color 0.25s ease, background 0.25s ease,
              transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease !important;
}
.s-card:hover {
  transform: translateY(-6px) !important;
}

/* ══ MOBILE: BTT + SHARE safe area tighter ══ */
@media (max-width: 540px) {
  #ui-btt { bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important; right: 16px !important; }
  #ui-share { bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; right: 16px !important; }
}
