/* ==========================================================
   kianshah.in - mobile styles for the HOMEPAGE (the strip)
   Loaded AFTER style.css. Every rule scoped to
   @media (max-width: 768px); removing the <link> fully reverts.
   The compact bar + drawer are built by assets/mobile.js (html.m-on).
   ========================================================== */

@media (max-width: 768px) {

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(148, 210, 189, 0.18);
  }

  /* shorter scroll loop so the strip doesn't feel endless on a tall phone;
     script.js maps the camera parameter off docRange(), so it auto-retunes */
  html:not(.simple), html:not(.simple) body { height: 400vh; }

  /* ---------- replace the hover-reveal header with a persistent bar ---------- */
  html.m-on #site-header,
  html.m-on #header-zone { display: none; }

  .m-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 160;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    padding: 0 8px 0 14px;
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(0, 18, 25, 0.72);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(148, 210, 189, 0.1);
  }
  .m-bar .m-brand {
    font-family: var(--serif);
    font-size: 20px;
    letter-spacing: 0.05em;
    color: #f2ede0;
    text-decoration: none;
    margin-right: auto;
    white-space: nowrap;
  }
  .m-bar #viewToggle {
    margin: 0;
    min-height: 40px;
    flex: none;
  }
  .m-bar .m-menu {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--aqua);
    background: transparent;
    border: 1px solid rgba(148, 210, 189, 0.5);
    border-radius: 6px;
    cursor: pointer;
    flex: none;
  }
  .m-bar .m-menu .m-burger { position: relative; width: 18px; height: 12px; flex: none; }
  .m-bar .m-menu .m-burger::before,
  .m-bar .m-menu .m-burger::after,
  .m-bar .m-menu .m-burger span {
    content: "";
    position: absolute; left: 0; right: 0; height: 2px;
    background: currentColor; border-radius: 2px;
  }
  .m-bar .m-menu .m-burger::before { top: 0; }
  .m-bar .m-menu .m-burger span { top: 5px; }
  .m-bar .m-menu .m-burger::after { top: 10px; }

  /* ---------- drawer + scrim (shared look with the subpages) ---------- */
  .m-scrim {
    position: fixed; inset: 0;
    z-index: 170;
    background: rgba(0, 8, 12, 0.6);
    opacity: 0;
    visibility: hidden;          /* no pointer-blocking / no tab stops when closed */
    transition: opacity 0.28s ease, visibility 0.28s ease;
  }
  .m-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 171;
    width: min(86vw, 330px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px
             calc(env(safe-area-inset-bottom, 0px) + 24px);
    background: #04202a;
    border-left: 1px solid rgba(148, 210, 189, 0.16);
    transform: translateX(100%);
    visibility: hidden;          /* keep the off-screen links out of the tab order */
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.32s ease;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  html.m-drawer-open .m-drawer { transform: none; visibility: visible; }
  html.m-drawer-open .m-scrim { opacity: 1; visibility: visible; }
  html.m-drawer-open, html.m-drawer-open body { overflow: hidden; }

  .m-drawer-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
  }
  .m-drawer-head .m-drawer-title {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .m-drawer .m-close {
    width: 44px; height: 44px;
    display: grid; place-items: center;
    font-size: 26px; line-height: 1;
    color: var(--wheat);
    background: transparent; border: 0; cursor: pointer;
  }
  .m-drawer a {
    display: flex; align-items: baseline; gap: 10px;
    min-height: 54px;
    padding: 12px;
    font-family: var(--mono);
    font-size: 18px;
    letter-spacing: 0.06em;
    color: #e6ecee;
    text-decoration: none;
    border-bottom: 1px solid rgba(148, 210, 189, 0.08);
  }

  /* ---------- strip labels: obviously tappable, resting affordance ----------
     They already carry a dashed underline + glow at rest (no :hover needed).
     Give them a larger resting hit surface and keep the solid/amber state for
     the moment a finger is down. Real sizing/scale is tuned in script.js. */
  .strip-label a {
    padding: 0.5em 0.62em;
    text-decoration-thickness: 0.05em;
  }
  .strip-label a:active {
    color: #fff6dc;
    text-decoration-style: solid;
    text-decoration-color: var(--amber);
  }

  /* ---------- scroll indicator sits above the home indicator ---------- */
  .scroll-indicator { bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }

  /* ---------- simple view: proper phone treatment ---------- */
  html.simple #site-title { font-size: clamp(44px, 13vw, 60px); margin-top: clamp(84px, 16vh, 120px); }
  html.simple #site-tagline { font-size: 12px; letter-spacing: 0.18em; margin-bottom: 36px; }

  #simple-view { padding: 0 16px calc(72px + env(safe-area-inset-bottom, 0px)); }
  .simple-lede { font-size: 17px; }
  .simple-links a { padding: 14px 16px; }
  .simple-links span { font-size: 16px; }
  .simple-links small { font-size: 12.5px; }
  .simple-social { gap: 4px; margin-top: 24px; }
  .simple-social a { width: 48px; height: 48px; }

  /* in simple view the on-page links are the nav; the bar just carries
     brand + view toggle (menu button is hidden by mobile.js) */
  html.simple.m-on .m-bar { background: rgba(0, 18, 25, 0.9); }
}

@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .m-drawer, .m-scrim { transition: none; }
}
