/*
  PREETIAWASTHI.COM — SHARED RESPONSIVE FOUNDATION
  Load this stylesheet AFTER styles.css and every page-specific stylesheet.
  Covers desktop, tablet portrait/landscape, and phone portrait/landscape.
  New public pages should use the shared header pattern documented in RESPONSIVE-STANDARD.md.
*/
:root { --site-content-width: 1200px; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-width: 320px; overflow-x: clip; }
img, picture, video, iframe { max-width: 100%; }
img { height: auto; }
button, input, select, textarea { max-width: 100%; }
main, section, article, aside, footer, header { min-width: 0; }

/* Shared responsive navigation: use the compact menu on phones and tablets,
   regardless of whether the device is held portrait or landscape. */
.mobile-menu { display: none; }
@media screen and (max-width: 1024px) {
  header.site-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    height: auto;
    min-height: 78px;
    padding: 12px clamp(14px, 3vw, 28px);
    position: relative;
    z-index: 50;
  }
  header.site-header > .brand {
    flex: 1 1 auto;
    min-width: 0;
    max-width: calc(100% - 112px);
    white-space: normal;
  }
  header.site-header > .brand a {
    display: block;
    font-size: clamp(17px, 2.6vw, 25px);
    line-height: 1.2;
  }
  header.site-header > .brand span {
    display: block;
    font-size: clamp(7px, 1.15vw, 10px);
    line-height: 1.35;
  }
  header.site-header > nav[aria-label="Main navigation"] { display: none !important; }
  header.site-header > .mobile-menu {
    display: block !important;
    position: relative;
    flex: 0 0 auto;
    z-index: 60;
  }
  .mobile-menu summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 11px;
    border: 1px solid rgba(196,154,74,.8);
    border-radius: 6px;
    color: #102a43;
    background: #fffaf2;
    font: 700 11px 'Source Sans 3', Arial, sans-serif;
    white-space: nowrap;
  }
  .mobile-menu summary::-webkit-details-marker { display: none; }
  .mobile-menu summary::marker { content: ''; }
  .hamburger-lines { display: inline-flex; flex-direction: column; gap: 4px; }
  .hamburger-lines i { display: block; width: 16px; height: 2px; background: currentColor; }
  .mobile-menu nav {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    width: min(240px, calc(100vw - 28px));
    max-height: min(70vh, 420px);
    overflow-y: auto;
    padding: 6px 0;
    background: #fffaf2;
    border: 1px solid #d9c8aa;
    border-top: 3px solid #c49a4a;
    border-radius: 7px;
    box-shadow: 0 10px 24px rgba(6,26,42,.2);
    z-index: 70;
  }
  header.site-header .mobile-menu nav a {
    display: block;
    padding: 11px 15px;
    border: 0;
    border-bottom: 1px solid #eee3d2;
    color: #102a43;
    font: 700 12px 'Libre Baskerville', Georgia, serif;
    text-decoration: none;
  }
  header.site-header .mobile-menu nav a:last-child { border-bottom: 0; }
  header.site-header .mobile-menu nav a.active { color: #986b28; background: #f7f0e5; }
  header.site-header .mobile-menu nav a:hover { background: #f2e8d8; }
}

/* Tablet and compact landscape: preserve the editorial composition without
   allowing the desktop header or portrait to collide with the hero copy. */
@media screen and (orientation: landscape) and (max-height: 600px) and (max-width: 1024px) {
  header.site-header { min-height: 68px; padding-top: 8px; padding-bottom: 8px; }
  .hero:not(.students-hero) {
    height: clamp(300px, calc(100svh - 68px), 410px);
    min-height: 300px;
    overflow: hidden;
  }
  .hero:not(.students-hero) .portrait-wrap {
    top: 0;
    left: 3.5%;
    width: clamp(150px, 29vw, 280px);
    max-width: 32%;
    height: 100%;
    transform: none;
    overflow: visible;
    background: transparent;
    box-shadow: none;
  }
  .hero:not(.students-hero) .portrait-wrap picture { display: block; width: 100%; height: 100%; }
  .hero:not(.students-hero) .portrait-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    transform: scaleX(-1);
  }
  .hero:not(.students-hero) .hero-copy {
    left: 37%;
    right: 4%;
    top: clamp(16px, 4vh, 32px);
    max-width: 59%;
    padding: 0 8px 12px 0;
    text-align: left;
  }
  .hero:not(.students-hero) .hero-copy h1 { font-size: clamp(30px, 5.2vw, 48px); margin-bottom: 8px; }
  .hero:not(.students-hero) .hero-copy h2 { font-size: clamp(14px, 2.1vw, 18px); margin-bottom: 8px; }
  .hero:not(.students-hero) .hero-copy p { font-size: clamp(11px, 1.45vw, 13px); line-height: 1.4; margin-bottom: 8px; }
  .hero:not(.students-hero) .gold-sweep { bottom: 4px; height: 45px; }
  .about-masthead { min-height: 300px; padding-top: 26px; padding-bottom: 26px; gap: 20px; }
  .masthead-portrait { max-height: 280px; }
  .students-hero { min-height: 300px; padding-top: 32px; padding-bottom: 32px; }
  .students-hero .hero-copy { max-width: min(760px, 82%); }
  .students-hero h1 { font-size: clamp(36px, 5vw, 58px); }
}

/* General content safeguards for narrow screens, including landscape phones. */
@media screen and (max-width: 760px) {
  .intro-grid, .two-col, .profile-layout, .research-layout { grid-template-columns: minmax(0, 1fr); }
  .intro-copy { border-right: 0; }
  .career-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
  .publication { grid-template-columns: 58px minmax(0, 1fr); }
  .publication-list, .publication, .pub-content { min-width: 0; }
  .pub-content h3 { overflow-wrap: anywhere; }
  .about-masthead { grid-template-columns: minmax(0, 1fr); }
  .about-section, .patel-quote-section { padding-left: clamp(18px, 4vw, 28px); padding-right: clamp(18px, 4vw, 28px); }
  .students-intro { grid-template-columns: minmax(0, 1fr); }
  .level-cards { grid-template-columns: minmax(0, 1fr); }
  footer { grid-template-columns: minmax(0, 1fr); }
  footer .footer-bottom { grid-column: 1; }
}

/* Very narrow portrait phones. */
@media screen and (max-width: 420px) and (orientation: portrait) {
  .hero:not(.students-hero) { min-height: 570px; }
  .hero:not(.students-hero) .portrait-wrap { width: min(205px, 58vw); }
  .career-grid, .book-grid, .closing-links { grid-template-columns: minmax(0, 1fr); }
  .publication { grid-template-columns: 1fr; }
  .level-card { flex-wrap: wrap; }
}
