/* =======================================
   pro-styles.css
   Purpose: responsive & premium styles
   ======================================= */

/* (Optional) Theme tokens — delete if you already set these in styles.css */
:root{
  --text:#0a2540;
  --brand:#1d71b8;
  --brand-dark:#0b5494;
  --line:#e6edf5;
  --panel-strong:#d7e6fb;
}

/* Reduce mobile tap highlight flash */
:root { -webkit-tap-highlight-color: transparent; }

/* ===== Desktop nav (spacing + pill highlight) ===== */
.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 0;
}
.nav a {
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  position: relative;
  transition: background .18s ease, color .18s ease;
}
.nav a::after { display: none !important; } 
.nav a:hover { background: #f1f6ff; color: var(--brand-dark); transform: none; }
.nav a[aria-current="page"] { background: #e7f0ff; color: var(--brand-dark); }
.nav a:active { background: #e7f0ff; }
.nav a:focus { outline: none; }
.nav a:focus-visible { outline: 3px solid rgba(29,113,184,.25); outline-offset: 2px; }

/* ===== Mobile button (glassy + animates to X) ===== */
.menu-toggle { position: absolute; left: -9999px; }
.menu-btn {
  display: none; 
  width: 44px; height: 44px; margin-left: auto;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(247,251,255,.9);
  backdrop-filter: saturate(120%) blur(6px);
  box-shadow: 0 2px 10px rgba(2,6,23,.06);
  cursor: pointer;
  align-items: center; justify-content: center;
  transition: box-shadow .2s ease, transform .12s ease, background .2s ease;
}
.menu-btn:hover { box-shadow: 0 6px 20px rgba(2,6,23,.10); transform: translateY(-1px); }

.menu-icon { position: relative; width: 22px; height: 16px; display: inline-block; }
.menu-icon .bar {
  position: absolute; left: 0; right: 0; height: 2px; background: var(--text); border-radius: 2px;
  transition: transform .22s ease, opacity .18s ease, top .22s ease, background .22s ease;
}
.menu-icon .bar1 { top: 0; } .menu-icon .bar2 { top: 7px; } .menu-icon .bar3 { top: 14px; }
.menu-toggle:checked + .menu-btn .bar1 { top: 7px; transform: rotate(45deg); background: var(--brand-dark); }
.menu-toggle:checked + .menu-btn .bar2 { opacity: 0; }
.menu-toggle:checked + .menu-btn .bar3 { top: 7px; transform: rotate(-45deg); background: var(--brand-dark); }

/* ===== Off-canvas sheet + overlay (mobile) ===== */


  @media (max-width: 900px){
    .header{
      grid-template-rows: auto auto;
      grid-template-areas:
        "logo brand toggler"
        "nav  nav   nav";
      align-items:center;
      gap:10px;
    }
  
    /* show the hamburger on mobile */
    .menu-btn{ display:inline-flex; justify-self:end; z-index:70; }
    .logo{ justify-self:start; }
    .brand-center{ justify-self:center; text-align:center; }
  
    /* nav row remains centered */
    .navbar .nav{ justify-content:center; }
  }

  /* Overlay */
  .menu-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(6,16,31,0.42);
    backdrop-filter: blur(2px);
    opacity: 0; transition: opacity .2s ease; z-index: 40;
  }
  .menu-toggle:checked ~ .menu-overlay { display: block; opacity: 1; }

  /* Drawer container */
  .navbar {
    position: fixed; top: 16px; right: 16px; bottom: 16px;
    width: min(84vw, 360px); z-index: 50; pointer-events: none;
  }

  /* Drawer panel */
  .nav {
    display: flex; flex-direction: column; gap: 6px;
    padding: 12px; height: 100%;
    background: #fff; border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 24px 60px rgba(2,6,23,.22);
    transform: translateX(110%); opacity: 0;
    transition: transform .24s ease, opacity .18s ease;
    overflow: auto;
    backface-visibility: hidden; transform: translateZ(0);
  }
  .menu-toggle:checked ~ .navbar { pointer-events: auto; }
  .menu-toggle:checked ~ .navbar .nav { transform: translateX(0); opacity: 1; }

  .nav a { padding: 12px 14px; border-radius: 10px; }
  .nav a:hover,
  .nav a[aria-current="page"] { background: #eaf3ff; color: var(--brand-dark); transform: none; }

  /* While drawer is open, kill transitions to avoid blink on tap */
  .menu-toggle:checked ~ .menu-overlay,
  .menu-toggle:checked ~ .navbar .nav { transition: none !important; }


/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .nav a, .menu-btn, .menu-icon .bar, .menu-overlay, .nav { transition: none !important; }
}

/* ===== About dropdown (desktop + mobile, CSS-only) ===== */

/* Parent label (“About”) */
.nav .nav-parent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  color: var(--text);
  transition: background .18s ease, color .18s ease;
}
.nav .nav-parent:hover { background: #f1f6ff; color: var(--brand-dark); }

/* Chevron */
.nav .nav-parent::after {
  content: "▾";
  font-size: 12px;
  opacity: .7;
  transform: translateY(1px);
}

/* Wrapper */
.has-sub { position: relative; display: inline-flex; align-items: center; }
.sub-toggle { position: absolute; left: -9999px; } /* visually hidden */

/* Submenu (desktop default: popover) */
.submenu {
  display: none;
  position: absolute;
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(2,6,23,.14);
  padding: 8px;
  z-index: 60;
}
.submenu a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}
.submenu a:hover { background: #eaf3ff; color: var(--brand-dark); }

/* DESKTOP: open on hover + hover-bridge fix (no flicker) */
@media (min-width: 901px) {
  .header, .navbar, .nav, .has-sub { overflow: visible; }
  .has-sub { position: relative; z-index: 60; }

  .submenu {
    top: 100%;          
    margin-top: 0;
    transform: translateY(8px); 
  }
  .has-sub:hover > .submenu { display: block; }

  /* invisible “bridge” preserves hover while moving down */
  .has-sub::before {
    content: "";
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    height: 10px;
  }
}

/* MOBILE: inside drawer — accordion style, centered labels */
@media (max-width: 900px) {
  .has-sub { width: 100%; display: block; }

  /* Center both links and the About label */
  .nav a,
  .nav .nav-parent {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
  }

  .nav .nav-parent {
    padding: 12px 14px;
    border-radius: 10px;
    background: transparent;
  }
  .nav .nav-parent:hover { background: #f6f9ff; color: var(--brand-dark); }

  .nav .nav-parent::after { margin-left: 8px; }

  /* Submenu becomes stacked list (not absolute) */
  .submenu {
    position: static;
    display: none;
    margin-top: 6px;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: none;
    background: #fff;
  }
  .sub-toggle:checked ~ .submenu { display: block; }

  .submenu a { padding: 12px 12px; }
  .submenu a + a { margin-top: 4px; }
}

/* ===== Logo sizing (consistent across breakpoints) ===== */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;              
}
/* If using a colored block as the mark */
.logo-mark {
  width: clamp(44px, 7vw, 72px);
  height: clamp(44px, 6vw, 56px);
}
/* Brand text next to mark */
.logo span:last-child {
  font-weight: 800;
  letter-spacing: .2px;
  font-size: clamp(18px, 4.6vw, 24px);
  line-height: 1.1;
}
/* If using an image logo instead */
.logo-img { height: clamp(32px, 7vw, 56px); width: auto; display: block; }

/* Ensure mobile header doesn’t squeeze the logo */
@media (max-width: 900px) {
  .header { 
     align-items: center; gap: 12px; }
}

/* ===== Contact page visuals ===== */
.contact-dl { padding-top: 4px; }
.contact-dl dt { color: var(--brand-dark); }
.contact-dl .row {
  padding: 10px 12px;
  border: 1px solid var(--panel-strong);
  border-radius: 12px;
  background: #f7fbff;
}
.contact-dl .row:nth-child(even){ background:#ffffff; }
.contact-dl a { color: var(--brand-dark); text-decoration: none; }
.contact-dl a:hover { text-decoration: underline; }


/* [pro-styles.css] Sidebar visuals */
.sidenav {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.sidenav-title {
  padding: 12px 12px 0 12px;
  color: var(--brand-dark);
  font-weight: 700;
}

.sidenav-link {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  margin: 4px 6px;
  color: var(--text);
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
  font-size: 18px;
}
.sidenav-link:hover {
  background: #f1f6ff;
  color: var(--brand-dark);
}
.sidenav-link[aria-current="page"] {
  background: #eaf3ff;
  color: var(--brand-dark);
  font-weight: 700;
  border: 1px solid var(--line);
}

/* [pro-styles.css] — make the sidebar chips truly scrollable on mobile */
@media (max-width: 1000px) {
  .sidenav { border: 0; background: transparent; }
  .sidenav-title { padding: 0 0 8px; text-align: center; }

  .sidenav-list {
    display: flex;                  
    gap: 8px;
    padding: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    scroll-snap-type: x proximity;     
  }
  .sidenav-link {
    white-space: nowrap;
    margin: 0;
    scroll-snap-align: start;         
  }
}


/* active state in sidebar */
.sidenav-link[aria-current="page"] {
  background: #eaf3ff;
  color: var(--brand-dark);
  font-weight: 700;
  border: 1px solid var(--line);
}

/* active state in top nav (you already have this) */
.nav a[aria-current="page"] {
  background: #e7f0ff;
  color: var(--brand-dark);
}

.nav .nav-parent[data-active="true"] {
  background: #e7f0ff;
  color: var(--brand-dark);
  border-radius: 12px;
}

/* [pro-styles.css] Colloquium table polish */
.colloq-table thead th {
  font-weight: 700;
  color: var(--brand-dark);
  background: #f5faff;                  
  border-bottom: 1px solid var(--panel-strong);
  box-shadow: 0 2px 0 rgba(2,6,23,.03);
}

.colloq-table tbody td + td { border-left: 1px solid #f1f5fb; }
.colloq-table tbody tr + tr td { border-top: 1px solid #eef3f8; }

.colloq-table td:first-child {
  white-space: nowrap;
  font-weight: 600;
  color: var(--text);
}

/* [pro-styles.css] — Modal polish */
.modal__panel { box-shadow: 0 24px 60px rgba(2,6,23,.22); }
.modal__close {
  color: var(--text); background: rgba(247,251,255,.9);
  transition: background .18s ease, transform .12s ease, box-shadow .18s ease;
}
.modal__close:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.modal__title { color: var(--brand-dark); }
.modal__body a { color: var(--brand-dark); text-decoration: underline; }


/* [pro-styles.css] — People list polish */
.person-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  transition: box-shadow .18s ease, transform .12s ease;
}
.person-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }

.person-photo {
  border: 1px solid #eef3f8;
  box-shadow: 0 1px 4px rgba(2,6,23,.05);
  border: 1px solid #eef3f8;
}

.person-name a {
  color: var(--text);
  font-weight: 800;
  letter-spacing: .2px;
}
.person-name a:hover { color: var(--brand-dark); text-decoration: underline; }

.person-fields dd a { color: var(--brand-dark); text-decoration: none; }
.person-fields dd a:hover { text-decoration: underline; }

/* Research tags */
.tags li {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--panel-strong);
  background: #f7fbff;
  color: var(--brand-dark);
  font-size: 13px;
}

/* Homepage button-like link */
.btn-link {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #eaf3ff;
  color: var(--brand-dark);
  font-weight: 700;
  text-decoration: none;
  transition: background .18s ease, transform .12s ease;
}
.btn-link:hover { background: #e1eeff; transform: translateY(-1px); }

/* === Desktop dropdown isolation fix === */
@media (min-width: 901px) {
  /* Close everything by default on desktop */
  .nav > .has-sub > .submenu { display: none !important; }

  /* Only the item being hovered opens */
  .nav > .has-sub:hover > .submenu { display: block !important; }

  /* Ignore the mobile checkbox state on desktop entirely */
  .nav > .has-sub > .sub-toggle:checked ~ .submenu { display: none !important; }

  /* Keep submenu positioned below the parent and above neighbors */
  .nav > .has-sub { position: relative; z-index: 60; }
  .nav > .has-sub .submenu {
    top: 100%;
    left: 0;
    margin-top: 0;
    transform: translateY(8px);
  }

  /* Optional: narrow the hover bridge to just under its own parent,
     so it doesn't “spill” under adjacent pills */
  .nav > .has-sub::before {
    content: "";
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    height: 8px;      /* small gap helper */
  }
}


/* === MOBILE (<=900px): keep 3-column header + off-canvas drawer === */
@media (max-width: 900px){
  /* Keep SAME 3 columns: logo | brand | toggler */
  .header{
    display:grid;
    grid-template-columns:auto 1fr auto;
    grid-template-rows:auto auto;
    grid-template-areas:
      "logo brand toggler"
      "nav  nav   nav";
    align-items:center;
    gap:10px;
  }

  /* Show hamburger, keep positions */
  .menu-btn{ display:inline-flex; justify-self:end; z-index:70; }
  .logo{ justify-self:start; }
  .brand-center{ justify-self:center; text-align:center; }

  /* Overlay */
  .menu-overlay{
    display:none;
    position:fixed; inset:0;
    background:rgba(6,16,31,.42);
    backdrop-filter:blur(2px);
    opacity:0; transition:opacity .2s ease; z-index:40;
  }
  .menu-toggle:checked ~ .menu-overlay{ display:block; opacity:1; }

  /* Drawer container */
  .navbar{
    position:fixed; top:16px; right:16px; bottom:16px;
    width:min(84vw,360px); z-index:50; pointer-events:none;
  }

  /* Drawer panel */
  .navbar .nav{
    display:flex !important;
    flex-direction:column !important;
    flex-wrap:nowrap !important;
    justify-content:flex-start !important;
    align-items:stretch !important;
    gap:8px !important;
    padding:12px; height:100%;
    background:#fff; border:1px solid var(--line); border-radius:16px;
    box-shadow:0 24px 60px rgba(2,6,23,.22);
    transform:translateX(110%); opacity:0;
    transition:transform .24s ease, opacity .18s ease;
    overflow:auto; backface-visibility:hidden; transform:translateZ(0);
  }
  .menu-toggle:checked ~ .navbar{ pointer-events:auto; }
  .menu-toggle:checked ~ .navbar .nav{ transform:translateX(0); opacity:1; }

  /* Mobile link look */
  .nav a{ padding:12px 14px; border-radius:10px; text-align:center; }
  .nav a:hover, .nav a[aria-current="page"]{ background:#eaf3ff; color:var(--brand-dark); }
  .menu-toggle:checked + .menu-btn{
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 80;                   /* above drawer (50) and overlay (40) */
    box-shadow: 0 8px 22px rgba(2,6,23,.18);
  }

  /* optional: slightly dim background of the pinned button when open */
  .menu-toggle:checked + .menu-btn{
    background: rgba(255,255,255,.95);
    border-color: var(--line);
  }
}

/* Phones: put logo + hamburger on row 1, brand centered on row 2 */
@media (max-width: 640px){
  .header{
    grid-template-columns: auto 1fr auto;   /* keep 3 slots */
    grid-template-rows: auto auto auto;     /* mast, brand, nav */
    grid-template-areas:
      "logo .      toggler"
      "brand brand brand"
      "nav   nav   nav";
    gap: 8px;
  }

  /* Give the logo column a guaranteed width */
  .logo{ justify-self:start; min-width: 64px; }
  .logo-img{ height: 38px; width: auto; }

  /* Brand now has full width, so it won’t push the logo */
  .brand-center{ justify-self:center; text-align:center; margin-top: 2px; }

  /* Hamburger stays at the right edge */
  .menu-btn{ display:inline-flex; justify-self:end; }
}
