/* ============================================================
   Mobile Safari edges (studio standard "seamless-mobile-safari",
   version of 11 Nov 2026), shared by every page.

   Safari 26 on iPhone lays the page under its status and address bars.
   It fills that area with a solid colour when it finds a real fixed
   element across the full width at the top edge. .edge-top is that
   element; safari-edges.js keeps its colour in sync with whatever is
   at the top of the screen. There is no strip at the bottom: the page
   runs on under Safari's floating bar on purpose.

   Markup, direct children of <body> (never pseudo-elements):
     <div class="edge-top" aria-hidden="true"></div>
     <div class="edge-top-fade" aria-hidden="true"></div>

   One colour source: --edge-top-background colours the strip, <html>,
   the fade and theme-color; --edge-bottom-background only <body>, the
   ground behind the end of the page.
   ============================================================ */
:root{
  --edge-top-background:#6c4921;    /* hero video, average of its top row */
  --edge-bottom-background:#ffffff;
  --edge-z:300;                     /* above the nav (200), below the menu drawer (600) */
  --edge-fade-z:150;                /* the soft fade stays under the nav */
}
html{background-color:var(--edge-top-background)}
body{background-color:var(--edge-bottom-background)}

.edge-top,.edge-top-fade{display:none}

@media (hover:none) and (pointer:coarse){
  /* Real fixed element, full width, taller than 10px, opaque background-color:
     Safari reads that colour directly at 4px from the edge. 8px stay visible.
     No opacity, filter or transition; the same-colour shadow makes Safari
     sample again on every colour change. */
  .edge-top{
    display:block;position:fixed;top:-4px;left:0;right:0;height:12px;
    z-index:var(--edge-z);pointer-events:none;
    background-color:var(--edge-top-background);
    box-shadow:0 1px 0 var(--edge-top-background);
  }
  /* Soft fade below the strip. Its own element (the strip forms its own
     stacking context) so it can sit under the nav; starts below the point
     Safari samples. */
  .edge-top-fade{
    display:block;position:fixed;top:8px;left:0;right:0;height:44px;
    z-index:var(--edge-fade-z);pointer-events:none;
    background-image:linear-gradient(to bottom, var(--edge-top-background), transparent);
  }
  :root[data-edge-top="media"] .edge-top-fade{display:none}
}
@media print{.edge-top,.edge-top-fade{display:none}}

/* ---- termbase.io layout: keep the nav, the menu and the last line of the
   footer inside the safe areas once the page runs under Safari's bars ---- */
.nav{top:calc(clamp(20px,2.5vw,32px) + env(safe-area-inset-top))}
.nav__drawer{padding-top:calc(96px + env(safe-area-inset-top));padding-bottom:calc(40px + env(safe-area-inset-bottom))}
.drawer-close{top:calc(22px + env(safe-area-inset-top))}
@media (max-width:900px){
  footer{padding-bottom:calc(28px + env(safe-area-inset-bottom))}
}
@media (max-width:932px) and (orientation:landscape) and (pointer:coarse){
  .nav{width:calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right))}
}
