/* ============================================================
   ag-ui-upgrade.css  |  Alvena Global
   Phase 2 — Foundation & Mobile Improvements
   Loaded additively after existing styles. No JS changes.
   Branch: dev  |  Do NOT merge to main without owner approval.
   ============================================================ */

/* ── 1. Design Tokens ──────────────────────────────────────── */
:root {
  --ag-navy-900: #050e1c;
  --ag-navy-800: #09192f;
  --ag-navy-600: #0e2f55;
  --ag-navy-500: #1759a0;
  --ag-navy-400: #1d94cc;
  --ag-navy-300: #58b9e6;
  --ag-navy-100: #d9eef9;
  --ag-navy-50:  #f0f8fd;

  --ag-accent:       #f0a500;
  --ag-accent-hover: #c87d00;
  --ag-accent-light: #fff4d4;

  --ag-teal:       #33a08c;
  --ag-teal-light: #e5f7f3;

  --ag-grey-900: #111827;
  --ag-grey-700: #374151;
  --ag-grey-500: #6b7280;
  --ag-grey-300: #d1d5db;
  --ag-grey-100: #f3f4f6;
  --ag-grey-50:  #f9fafb;

  --ag-error:   #dc2626;
  --ag-warning: #d97706;
  --ag-info:    #1d94cc;
  --ag-success: #16a34a;

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;
  --sp-4: 16px; --sp-6: 24px; --sp-8: 32px;
  --sp-12: 48px; --sp-16: 64px; --sp-24: 96px;

  --r-sm: 8px; --r-md: 12px; --r-lg: 20px;
  --r-xl: 32px; --r-pill: 999px;

  --sh-sm: 0 1px 3px rgba(14,47,85,.07), 0 1px 2px rgba(14,47,85,.04);
  --sh-md: 0 4px 16px rgba(14,47,85,.09), 0 2px 6px rgba(14,47,85,.05);
  --sh-lg: 0 12px 40px rgba(14,47,85,.12), 0 4px 14px rgba(14,47,85,.06);

  --focus-ring: 0 0 0 3px rgba(29,148,204,.38);
}

/* ── 2. Global Baseline ────────────────────────────────────── */
h1, h2, h3, h4 { text-wrap: balance; }
p, li           { text-wrap: pretty; }
body            { -webkit-text-size-adjust: 100%; }
img             { height: auto; }
main a:not([class]):not([role]) {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* ── 3. Skip to Content ────────────────────────────────────── */
.ag-skip {
  position: absolute;
  top: -120%;
  left: 1rem;
  z-index: 9999;
  padding: .65rem 1.4rem;
  background: var(--ag-navy-600);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  border-radius: var(--r-md);
  text-decoration: none;
  transition: top .15s ease;
  white-space: nowrap;
}
.ag-skip:focus { top: 1rem; }

/* ── 4. Focus Ring ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--ocean, #1d94cc);
  outline-offset: 3px;
  border-radius: var(--r-sm);
  box-shadow: var(--focus-ring);
}

/* ── 5. Text Selection ─────────────────────────────────────── */
::selection {
  background: rgba(29,148,204,.18);
  color: var(--text, #0a2240);
}

/* ── 6. Scrollbar ──────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: rgba(29,148,204,.28) transparent; }
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(29,148,204,.32); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(29,148,204,.55); }

/* ── 7. Header & Navigation ────────────────────────────────── */
.site-header { transition: box-shadow .25s ease; }
.brand       { flex-shrink: 0; }
.brand span  { white-space: nowrap; }

.nav a {
  white-space: nowrap;
  font-size: clamp(.82rem, 1.1vw, .95rem);
  letter-spacing: .01em;
}
.nav a[href="/certification"] {
  background: linear-gradient(135deg, #b8860b, #d4a520) !important;
  color: #fff !important;
  padding: .38rem .9rem !important;
  border-radius: var(--r-pill) !important;
  font-weight: 800 !important;
  font-size: .82rem !important;
  letter-spacing: .015em !important;
  border-bottom: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: .3rem !important;
  white-space: nowrap !important;
  transition: transform .15s ease, box-shadow .15s ease !important;
}
.nav a[href="/certification"]:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 16px -4px rgba(184,134,11,.5) !important;
}

@media (max-width: 1120px) {
  .nav { padding: .5rem 1.25rem 1.25rem; gap: 0; }
  .nav a { padding: .85rem 0; font-size: 1rem; white-space: normal; }
  .nav a[href="/certification"] {
    margin-top: .75rem !important;
    display: inline-flex !important;
    padding: .6rem 1.1rem !important;
  }
  .menu-btn { width: 44px; height: 44px; font-size: 1.2rem; }
}

/* ── 8. Hero ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero { padding-block: 2.5rem 3.5rem; }
  .hero-copy { gap: 1.2rem; }
  h1 { font-size: clamp(2.4rem, 9vw, 3.5rem) !important; line-height: .97 !important; }
  .cta-row { flex-direction: column; gap: .6rem; width: 100%; }
  .cta-row .btn { width: 100%; justify-content: center; min-height: 52px; }
  .fine { font-size: .88rem; }
}

/* ── 9. Featured Event Card (Home) ─────────────────────────── */
.ag-feat-card {
  container-type: inline-size;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.ag-feat-card:hover {
  box-shadow: 0 16px 48px rgba(15,45,84,0.18) !important;
}

.ag-feat-poster {
  background: radial-gradient(circle at 50% 30%, #163e70 0%, #0a1f3b 100%) !important;
  position: relative;
  overflow: hidden;
}

.ag-feat-poster img {
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.ag-feat-card:hover .ag-feat-poster img {
  transform: scale(1.02);
}

@media (max-width: 900px) {
  .ag-feat-card {
    grid-template-columns: 1fr !important;
    border-radius: 20px !important;
  }
  .ag-feat-poster {
    min-height: auto !important;
    max-height: none !important;
    padding: 2rem 1.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .ag-feat-poster img {
    width: 100% !important;
    max-width: 380px !important;
    height: auto !important;
    max-height: 520px !important;
    object-fit: contain !important;
    margin: 0 auto !important;
    display: block !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 36px -4px rgba(0,0,0,0.45) !important;
  }
  .ag-feat-info {
    padding: 2rem 1.75rem !important;
  }
}

@media (max-width: 480px) {
  .ag-feat-card {
    border-radius: 18px !important;
  }
  .ag-feat-poster {
    min-height: auto !important;
    max-height: none !important;
    padding: 1.5rem 1rem !important;
  }
  .ag-feat-poster img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    max-height: 460px !important;
    box-shadow: 0 8px 24px -2px rgba(0,0,0,0.5) !important;
  }
  .ag-feat-info {
    padding: 1.5rem 1.25rem !important;
  }
  .ag-feat-info h3 {
    font-size: 1.35rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0.6rem !important;
  }
  .ag-feat-info p {
    font-size: 0.95rem !important;
    margin-bottom: 1.25rem !important;
  }
  .ag-feat-info > div:last-child {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.85rem !important;
    align-items: stretch !important;
  }
  .ag-feat-info .btn {
    width: 100% !important;
    justify-content: center !important;
    min-height: 52px !important;
    display: flex !important;
    font-size: 1.05rem !important;
  }
  .ag-feat-info > div:last-child > span {
    text-align: center !important;
    font-size: 1.25rem !important;
    font-weight: 800 !important;
    display: block !important;
  }
}

/* ── 10. Buttons ───────────────────────────────────────────── */
.btn { min-height: 48px; }
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(23,89,160,.28);
}
form button[type="submit"],
form .btn[type="submit"] { min-height: 52px; width: 100%; }

/* ── 11. Bento Grid ────────────────────────────────────────── */
@media (max-width: 768px) {
  .bento { grid-template-columns: 1fr !important; }
  .t-study, .t-research, .t-intern,
  .t-proj, .t-schol, .t-global {
    grid-column: span 1 !important;
    grid-row: auto !important;
  }
  .t-study { min-height: 280px !important; }
}

/* ── 12. Stage Tabs ────────────────────────────────────────── */
@media (max-width: 768px) {
  .track {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .track::-webkit-scrollbar { display: none; }
  .node { scroll-snap-align: center; min-width: 80px; }
  .node span.lab { font-size: .76rem; }
}

/* ── 13. Services ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .svc-list { grid-template-columns: 1fr !important; column-gap: 0 !important; }
  .filters button { font-size: .82rem; padding: .4rem .75rem; }
}

/* ── 14. Statement Section ─────────────────────────────────── */
.statement { text-align: center; max-width: 700px; margin-inline: auto; }
.statement h2 { font-size: clamp(1.8rem, 4.5vw, 3rem); margin-bottom: 1.1rem; }
.statement .lead { max-width: 56ch; margin-inline: auto; }

/* ── 15. Contact Section ───────────────────────────────────── */
.reach a.row { min-height: 64px; transition: border-color .15s ease, background-color .15s ease; }
.reach a.row:hover  { border-color: var(--ocean, #1d94cc); background: var(--bg-alt); }
.reach a.row:active { background: var(--tint-ocean, #dceffa); }

@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr !important; gap: 2.5rem; }
}

/* ── 16. Footer ────────────────────────────────────────────── */
footer .foot > div:nth-child(2) a,
footer .foot > div:nth-child(3) a {
  display: block;
  padding: .18rem 0;
  font-size: .94rem;
  color: var(--text);
  text-decoration: none;
  transition: color .15s;
}
footer .foot > div:nth-child(2) a:hover,
footer .foot > div:nth-child(3) a:hover { color: var(--ocean, #1d94cc); }
footer .copy { line-height: 1.7; }

@media (max-width: 760px) {
  footer .foot { grid-template-columns: 1fr; gap: 2rem; }
}

/* ── 17. Forms ─────────────────────────────────────────────── */
form input:focus-visible,
form select:focus-visible,
form textarea:focus-visible {
  border-color: var(--ocean, #1d94cc) !important;
  box-shadow: var(--focus-ring) !important;
  outline: none !important;
}
form > p a[href*="policies"] {
  color: var(--link, #1759a0) !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.status { min-height: 1.5em; font-size: .95rem; }

/* ── 18. Scroll Reveal ─────────────────────────────────────── */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s cubic-bezier(.2,.7,.2,1), transform .55s cubic-bezier(.2,.7,.2,1);
}
.animate-on-scroll.in-view { opacity: 1; transform: none; }

/* ── 19. Reduced Motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll,
  .animate-on-scroll.in-view {
    opacity: 1 !important; transform: none !important; transition: none !important;
  }
  .rise { animation: none !important; opacity: 1 !important; transform: none !important; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ── 20. General Mobile ≤ 480px ────────────────────────────── */
@media (max-width: 540px) {
  .team {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }
  .member {
    padding: 1.4rem;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .member .mono {
    max-width: 200px;
    width: 100%;
    aspect-ratio: 1/1 !important;
    border-radius: 16px;
    margin-bottom: 1rem;
  }
  .member .mono img {
    border-radius: 16px;
  }
  .member .role {
    font-size: 0.95rem;
  }
  .member p.r {
    font-size: 0.92rem;
    line-height: 1.5;
  }
  .socials {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .section { padding-block: 3rem 2.5rem; }
  h2 { font-size: clamp(1.6rem, 7vw, 2.2rem) !important; }
  h3 { font-size: 1.15rem; }
  .wrap { width: min(100% - 2rem, 1180px); }
  .careers-card { border-radius: 20px; padding: 1.75rem; }
  .careers-card .btn { width: 100%; justify-content: center; min-height: 52px; }
  form { border-radius: 24px; padding: 1.5rem 1.25rem; }
  form .two { grid-template-columns: 1fr !important; }
}

/* ── 21. Pill / Chip ───────────────────────────────────────── */
.pill { transition: border-color .15s ease, box-shadow .15s ease; }
.pill:hover { box-shadow: var(--sh-sm); }

/* ── 22. Lazy Image Fade ───────────────────────────────────── */
.member img[loading="lazy"] { opacity: 0; transition: opacity .35s ease; }
.member img[loading="lazy"].loaded { opacity: 1; }

