/* ============================================================
   EssayMasterz — Mobile optimization layer
   Append AFTER masterz/styles.css (do not replace).
   ============================================================ */

html, body { max-width: 100vw; overflow-x: hidden; }
img, svg, video { max-width: 100%; height: auto; }

/* Injected by mobile-nav.js — hidden on desktop, revealed ≤720px below */
.mobile-burger, .mobile-drawer { display: none; }

@media (max-width: 720px) {
  .container { padding: 0 20px; }

  /* TOP STRIP — shorten on mobile */
  .top-strip { font-size: 10.5px; padding: 7px 14px; letter-spacing: 0.04em; }

  /* NAV — collapse 3-col grid to logo + hamburger */
  .nav-inner {
    grid-template-columns: auto 1fr auto;
    padding: 12px 0; gap: 12px;
  }
  .nav-left, .nav-right { display: none; }
  .logo { align-items: flex-start; }
  .logo-name { font-size: 22px; }
  .logo-est { font-size: 9px; }

  /* Hamburger */
  .mobile-burger {
    grid-column: 3;
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px;
    background: transparent; border: 1px solid var(--navy);
    cursor: pointer; padding: 0;
    color: var(--navy);
  }
  .mobile-burger span,
  .mobile-burger span::before,
  .mobile-burger span::after {
    display: block; width: 20px; height: 1.5px; background: var(--navy);
  }
  .mobile-burger span { position: relative; }
  .mobile-burger span::before,
  .mobile-burger span::after { content: ""; position: absolute; left: 0; }
  .mobile-burger span::before { top: -7px; }
  .mobile-burger span::after  { top:  7px; }

  /* Drawer */
  .mobile-drawer {
    position: fixed; inset: 0; z-index: 100;
    background: var(--cream);
    padding: 88px 32px 32px;
    display: none; flex-direction: column;
    overflow-y: auto;
  }
  .mobile-drawer.open { display: flex; }
  .mobile-drawer a {
    display: block; padding: 18px 0;
    font-family: "Cormorant Garamond", serif;
    font-weight: 500; font-style: italic;
    font-size: 30px; line-height: 1;
    color: var(--navy); text-decoration: none;
    border-bottom: 1px solid var(--navy);
  }
  .mobile-drawer .btn { margin-top: 28px; align-self: flex-start; }
  .mobile-drawer-close {
    position: absolute; top: 20px; right: 24px;
    width: 44px; height: 44px;
    background: transparent; border: 1px solid var(--navy);
    color: var(--navy);
    font-family: "Cormorant Garamond", serif; font-size: 28px;
    cursor: pointer; line-height: 1;
  }

  /* HERO */
  .hero { padding: 48px 0 56px; }
  .hero-grid { gap: 40px; grid-template-columns: 1fr; }
  .eyebrow { font-size: 11px; margin-bottom: 18px; }
  .hero h1 { font-size: clamp(40px, 11vw, 64px); margin-bottom: 22px; line-height: 1.05; }
  .hero p.lede { font-size: 17px; margin-bottom: 24px; }
  .hero-actions { gap: 12px; }
  .btn { padding: 12px 18px; font-size: 13px; }
  .btn--xl { padding: 14px 24px; font-size: 14px; }
  .hero-meta { gap: 24px; margin-top: 36px; padding-top: 20px; flex-wrap: wrap; }
  .hero-meta-item .n { font-size: 28px; }
  .hero-meta-item .l { font-size: 10px; }

  /* Crest — shrink, remove orbit decorations */
  .crest { max-width: 320px; margin: 0 auto; }
  .crest-orbit-text { display: none; }
  .ribbon { font-size: 16px; padding: 8px 18px; }
  .ribbon::before, .ribbon::after { width: 12px; }
  .ribbon::before { left: -12px; }
  .ribbon::after  { right: -12px; }

  /* STRIP marquee */
  .strip { padding: 20px 0; }
  .strip-inner { font-size: 20px; gap: 40px; }
  .strip-inner span { gap: 40px; }

  /* SECTIONS */
  section { padding: 64px 0; }
  .sec-head { grid-template-columns: 1fr; gap: 16px; margin-bottom: 36px; }
  .sec-head h2 { font-size: clamp(34px, 9vw, 52px); }
  .sec-head p { font-size: 17px; }

  /* METHOD — single column */
  .method-grid { grid-template-columns: 1fr; border-left: none; }
  .method-step {
    padding: 28px 22px;
    border-right: none;
    border-bottom: 1px solid var(--navy);
  }
  .method-step:last-child { border-bottom: none; }
  .step-num { font-size: 48px; margin-bottom: 12px; }
  .method-step h3 { font-size: 22px; }

  /* PRICING */
  .price-card { grid-template-columns: 1fr; }
  .price-form { padding: 28px 22px; border-right: none; border-bottom: 1px solid var(--navy); }
  .price-form h3 { font-size: 26px; margin-bottom: 22px; }
  .opt { padding: 10px 14px; font-size: 13px; min-height: 40px; }
  .price-total { padding: 32px 22px; }
  .price-total .total-n { font-size: 64px; }
  .stepper button { width: 40px; height: 40px; }

  /* FACULTY */
  .faculty-grid { grid-template-columns: 1fr; gap: 1px; }
  .fac-card { padding: 24px 22px; gap: 16px; }
  .fac-portrait { width: 72px; height: 72px; }
  .fac-info h4 { font-size: 19px; }
  .fac-info .title { font-size: 10px; letter-spacing: 0.1em; }
  .fac-info p { font-size: 13px; }

  /* DISCIPLINES */
  .disciplines { padding: 64px 0; }
  .disc-list { columns: 1; }
  .disc-list .disc { font-size: 18px; padding: 12px 0; }

  /* REVIEWS */
  .reviews { padding: 64px 0; }
  .review-grid { grid-template-columns: 1fr; }
  .review {
    padding: 32px 22px;
    border-right: none !important;
    border-bottom: 1px solid rgba(243,235,217,0.2) !important;
  }
  .review:last-child { border-bottom: none !important; }
  .review .quote { font-size: 20px; }
  .review .quote-mark { font-size: 60px; }

  /* HONOR */
  .honor { padding: 64px 0; }
  .honor-grid { grid-template-columns: 1fr; gap: 32px; }
  .honor h2 { font-size: clamp(32px, 9vw, 48px); }
  .honor p { font-size: 17px; }
  .promise { grid-template-columns: 44px 1fr; gap: 16px; padding: 18px 0; }
  .promise .num { font-size: 28px; }
  .promise h4 { font-size: 19px; }
  .promise p { font-size: 14px; }

  /* FINAL */
  .final { padding: 80px 0; }
  .final .ornament { font-size: 22px; margin-bottom: 12px; }
  .final h2 { font-size: clamp(40px, 11vw, 64px); margin-bottom: 22px; }
  .final p { font-size: 17px; margin-bottom: 28px; }

  /* FOOTER */
  footer { padding: 48px 0 24px; }
  .foot-grid { grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
  .foot-grid > div:first-child { grid-column: 1 / -1; }
  .foot-logo { font-size: 26px; }
  .foot-bot { flex-direction: column; gap: 8px; align-items: flex-start; }

  /* SUBPAGE */
  .page-hero { padding: 44px 0 36px; }
  .page-hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .page-hero h1 { font-size: clamp(36px, 10vw, 56px); margin: 12px 0 14px; }
  .page-hero .lede { font-size: 17px; }
  .page-hero-art { padding: 24px; }

  .prose { font-size: 16px; }
  .prose h2 { font-size: 26px; margin: 36px 0 12px; }
  .prose h3 { font-size: 20px; margin: 24px 0 10px; }
  .prose blockquote { font-size: 19px; padding: 8px 0 8px 20px; }

  .tabs { gap: 0; }
  .tab { padding: 10px 14px; font-size: 11px; }

  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat { padding: 22px 16px; border-right: none; border-bottom: 1px solid var(--navy); }
  .stat:nth-child(2n) { border-right: none; }
  .stat:nth-last-child(-n+2) { border-bottom: none; }
  .stat .n { font-size: 40px; }

  .sample-grid { grid-template-columns: 1fr; }
  .sample { padding: 24px 22px; border-right: none; border-bottom: 1px solid var(--navy); }
  .sample:last-child { border-bottom: none; }
  .sample h3 { font-size: 20px; }

  .policy-page { padding: 48px 0 64px; }
  .policy-grid { grid-template-columns: 1fr; gap: 20px; }
  .policy-nav { display: flex; flex-wrap: wrap; gap: 14px; }
  .policy-nav a { padding: 6px 0; border-bottom: none; }

  .filter-bar { gap: 6px; }
  .filter { padding: 8px 14px; font-size: 12px; min-height: 38px; }

  .form-grid { gap: 14px; }
  .form-row { grid-template-columns: 1fr; gap: 14px; }
  .field input, .field textarea, .field select { padding: 12px 14px; font-size: 16px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat:nth-last-child(-n+2) { border-bottom: 1px solid var(--navy); }
  .stat:last-child { border-bottom: none; }
  .hero-meta { gap: 18px; }
  .hero-actions .btn { width: 100%; text-align: center; }
  .hero-meta-item { min-width: 45%; }
}

/* ============================================================
   Subpage clipping fixes (added 2026-05-24)
   Subpages set grid columns via inline style="" and per-page <style>
   blocks that never collapsed on phones, so multi-column content ran
   off the right edge and the root overflow-x:hidden clipped it.
   Collapse those inline grids to one column. Selectors are anchored to
   "grid-template-columns: " so icon/label rows (28px/60px 1fr) and the
   live tuition matrix (1.5fr repeat(...)) are NOT matched. The "by the
   numbers" stat rows (1.2fr 1fr) are deliberately left as 2 columns.
   !important beats inline style attributes + late <style> blocks.
   ============================================================ */
@media (max-width: 720px) {
  body { overflow-wrap: break-word; }            /* long emails/words wrap instead of overflowing */

  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1.4fr"],
  [style*="grid-template-columns: 1fr 1.6fr"],
  [style*="grid-template-columns: 1.4fr 1fr"],
  [style*="grid-template-columns: 240px 1fr"],
  [style*="grid-template-columns: 80px 1fr 2fr"],
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns: repeat(5, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }

  .form-row { grid-template-columns: 1fr !important; }          /* name/email stack */
  [style*="position: sticky"] { position: static !important; }  /* unstick FAQ category rail */
  [style*="padding: 64px;"],
  [style*="padding: 50px;"] { padding: 28px !important; }        /* trim oversized feature-card padding */

  /* Keep inline-grid columns proportional so header cells line up with the
     price rows below them (default grid min-width:auto let long header labels
     widen their columns, knocking the header out of sync with the rows and
     pushing the last/PhD column off). Also stops long emails widening the
     contact cards. */
  [style*="grid-template-columns"] > * { min-width: 0; }

  /* Live tuition matrix -> swipe horizontally within its own box */
  .m-matrix { overflow-x: auto !important; }
  .m-row { min-width: 600px; }
  .m-head { font-size: 10px !important; }
}
