/* Shared primary download action and responsive navigation. */

.nav__burger, .nav__dl, .nav__ic, .nav__go{display:none}

@media (min-width:1000px){
  .navbar .nav__dl{
    display:inline-flex; align-items:center; justify-content:center; gap:8px; flex-shrink:0;
    height:40px; padding-inline:14px; border-radius:12px;
    background:var(--ink); color:var(--on-dark); font-size:15px; font-weight:700; white-space:nowrap;
  }
  .navbar .nav__dl:hover{background:var(--ink-hover); color:var(--on-dark)}
  .navbar .nav__gh{
    justify-content:center; gap:0; width:40px; padding:0;
    background:var(--tint); color:var(--ink); font-size:0;
  }
  .navbar .nav__gh .ic{font-size:18px}
  .navbar .nav__gh:hover{background:var(--accent-2); color:var(--ink)}
}
@media (min-width:1000px) and (max-width:1100px){
  .navbar .nav__controls{gap:6px}
  .navbar .nav__dl{padding-inline:10px; font-size:14px}
  .navbar .nav__gh{width:34px}
}

@media (max-width:999px){
  .navbar .nav{position:relative}

  .nav__burger{
    display:grid; place-items:center; flex-shrink:0; width:58px; height:58px; padding:0; cursor:pointer;
    border:1px solid var(--border); border-radius:18px; background:rgba(255,255,255,.94); color:var(--ink);
    backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
    transition:background-color .2s, border-color .2s;
  }
  .nav__burger:hover{border-color:var(--accent-1)}
  .nav__burger:focus-visible{outline:3px solid var(--accent); outline-offset:3px}
  .nav.is-open .nav__burger{background:var(--ink); border-color:var(--ink); color:var(--on-dark)}
  .nav__burger-lines{position:relative; display:block; width:22px; height:16px}
  .nav__burger-lines span{
    position:absolute; left:0; right:0; height:2.5px; border-radius:2px; background:currentColor;
    transition:top .22s .18s cubic-bezier(.65,0,.35,1), transform .22s cubic-bezier(.65,0,.35,1), opacity .15s .15s;
  }
  .nav__burger-lines span:nth-child(1){top:0}
  .nav__burger-lines span:nth-child(2){top:6.75px}
  .nav__burger-lines span:nth-child(3){top:13.5px}
  /* Open: the outer lines meet in the middle, then turn into an ✕. */
  .nav.is-open .nav__burger-lines span{transition:top .22s cubic-bezier(.65,0,.35,1), transform .22s .18s cubic-bezier(.65,0,.35,1), opacity .1s}
  .nav.is-open .nav__burger-lines span:nth-child(1){top:6.75px; transform:rotate(45deg)}
  .nav.is-open .nav__burger-lines span:nth-child(2){opacity:0}
  .nav.is-open .nav__burger-lines span:nth-child(3){top:6.75px; transform:rotate(-45deg)}

  /* The menu: the bar's own controls, as a panel under it. */
  .navbar .nav__controls{
    position:absolute; top:calc(100% + 10px); left:0; right:0; z-index:2;
    display:grid; grid-template-columns:auto 1fr; align-items:center; gap:14px 10px; padding:12px;
    border-radius:22px; background:var(--surface, #fff); backdrop-filter:none; -webkit-backdrop-filter:none; box-shadow:0 24px 60px rgba(107,36,16,.18), 0 2px 8px rgba(107,36,16,.06);
    opacity:0; visibility:hidden; transform:translateY(-10px) scale(.97); transform-origin:top right;
    transition:opacity .2s ease, transform .3s cubic-bezier(.2,.8,.2,1), visibility 0s linear .3s;
  }
  .nav.is-open .nav__controls{opacity:1; visibility:visible; transform:none; transition:opacity .2s ease, transform .35s cubic-bezier(.2,.9,.25,1.15), visibility 0s}

  .navbar .nav__links{grid-column:1 / -1; display:flex; flex-direction:column; gap:4px}
  .navbar .nav__links a,
  .navbar .nav__links a:not(.nav__links--page){
    display:flex; align-items:center; gap:14px; padding:8px 12px 8px 8px; border-radius:16px; font-size:17px; font-weight:700; color:var(--ink);
    opacity:0; transform:translateY(-6px);
    transition:opacity .2s var(--menu-link-delay,0s), transform .25s cubic-bezier(.2,.8,.2,1) var(--menu-link-delay,0s), background-color .15s, color .22s ease-in-out;
  }
  .navbar .nav__links a:is(:hover,:focus-visible,:active){background:var(--subtle)}
  .navbar .nav__links a.is-current, .navbar .nav__links a.is-active, .navbar .nav__links a[aria-current="page"]{background:var(--tint)}
  .navbar .nav__links a:is(:hover,:focus-visible,:active,.is-current,.is-active,[aria-current="page"]){color:var(--accent)}
  /* Each row: a picture in a soft tile, the name, an arrow at the end. */
  .navbar .nav__ic{display:grid; place-items:center; flex-shrink:0; width:40px; height:40px; border-radius:12px; background:var(--tint); color:var(--accent)}
  .navbar .nav__links a.is-current .nav__ic, .navbar .nav__links a.is-active .nav__ic, .navbar .nav__links a[aria-current="page"] .nav__ic{background:var(--surface)}
  .navbar .nav__ic .ic{width:20px; height:20px}
  .navbar .nav__go{display:grid; place-items:center; margin-left:auto; color:var(--faint)}
  .navbar .nav__go .ic{width:18px; height:18px}
  .nav.is-open .nav__links a{opacity:1; transform:none}
  /* One after another, top to bottom. */
  .nav.is-open .nav__links a:nth-child(1){--menu-link-delay:.06s}
  .nav.is-open .nav__links a:nth-child(2){--menu-link-delay:.1s}
  .nav.is-open .nav__links a:nth-child(3){--menu-link-delay:.14s}
  .nav.is-open .nav__links a:nth-child(4){--menu-link-delay:.18s}
  .nav.is-open .nav__links a:nth-child(5){--menu-link-delay:.22s}
  .nav.is-open .nav__links a:nth-child(6){--menu-link-delay:.26s}

  /* Getting the app: the menu's main button, across the full width. */
  .nav__dl{
    grid-column:1 / -1; display:flex; align-items:center; justify-content:center; gap:10px; height:54px; border-radius:16px;
    background:var(--accent); color:#fff; font-weight:800; font-size:17px; box-shadow:0 8px 20px rgba(240,138,75,.35);
    opacity:0; transform:translateY(-6px); transition:opacity .2s, transform .25s cubic-bezier(.2,.8,.2,1), background-color .15s;
  }
  .nav__dl:hover{background:#E77A38; color:#fff}
  .nav__dl .ic{width:20px; height:20px}
  .nav.is-open .nav__dl{opacity:1; transform:none; transition-delay:.24s}

  /* Language and GitHub share the bottom row; GitHub stays quieter. */
  .navbar .nav__controls .seg{padding:4px}
  .navbar .nav__controls .seg > *{padding:8px 14px; font-size:14px}
  .navbar .nav__gh, .navbar .nav__gh span{display:flex}
  .navbar .nav__gh{justify-content:center; height:46px; padding:0 16px; border-radius:14px; background:var(--tint); color:var(--ink)}
  .navbar .nav__gh:hover{background:var(--accent-2); color:var(--ink)}

  /* The page dims behind the open menu; a tap on it closes the menu. */
  body::after{
    content:''; position:fixed; inset:0; z-index:29; pointer-events:none;
    background:rgba(60,24,10,.22); opacity:0; transition:opacity .25s ease;
  }
  html.nav-open body::after{opacity:1; pointer-events:auto}
}

@media (max-width:999px) and (prefers-reduced-motion:reduce){
  .nav__burger-lines span, .navbar .nav__controls, .nav.is-open .nav__controls, .navbar .nav__links a, .nav__dl, body::after{transition:none !important}
}
