/* ─────────────────────────────────────────────────────────────────────
   glass-nav.css — shared site navigation (presence pill · brand · menu).
   Single source of truth so / and /portfolio (+ /sv mirrors) stay
   pixel-identical. Self-contained: every text element sets its own font,
   and all tokens (--ink, --bg, --lavender, --green, --ink-dim) resolve to
   the same canonical values on every host page.

   Extracted verbatim from index.html (home). Do not fork — edit here.
   ───────────────────────────────────────────────────────────────────── */

/* Lock the nav's inherited font to the home baseline (IBM Plex Mono) so it
   renders the same regardless of the host page's body font. */
nav.top { font-family: 'IBM Plex Mono', ui-monospace, monospace; }

  /* Language switcher — SV / EN */
  .lang-switch { display: inline-flex; gap: 4px; align-items: center; font-family: inherit; font-size: 11px; letter-spacing: 0.04em; margin-left: 6px; }
  .lang-opt { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border: 1px solid rgba(10,10,10,0.14); border-radius: 999px; color: #666; text-decoration: none; line-height: 1; }
  .lang-opt:hover { color: var(--ink); border-color: rgba(10,10,10,0.4); }
  .lang-opt.is-active { color: var(--ink); border-color: var(--ink); background: #f7f7f7; cursor: default; }
  .lang-opt .flag { font-size: 12px; line-height: 1; }
  @media (max-width: 640px) { .lang-switch { margin-left: 4px; gap: 3px; } .lang-opt { padding: 4px 7px; font-size: 10.5px; } }

  :root { --glass-radius: 100px; --glass-radius-open: 28px; }

  nav.top { position: sticky; top: 20px; z-index: 100; padding: 0; }
  nav.top .container { max-width: none; padding: 0; }

  .glass-nav-wrap {
    position: relative;
    width: min(100%, 720px);
    margin: 0 auto;
    padding: 0 16px;
  }

  .glass-nav {
    position: relative;
    background: rgba(255, 253, 248, 0.62);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(10, 10, 10, 0.08);
    border-radius: var(--glass-radius);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.7),
      0 8px 28px rgba(26, 20, 16, 0.07),
      0 2px 6px rgba(26, 20, 16, 0.04);
    overflow: hidden;
    transition:
      border-radius 520ms cubic-bezier(0.16, 1, 0.3, 1),
      box-shadow 420ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .glass-nav.is-open {
    border-radius: var(--glass-radius-open);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.7),
      0 24px 60px rgba(26, 20, 16, 0.12),
      0 6px 16px rgba(26, 20, 16, 0.06);
  }
  @supports not (backdrop-filter: blur(1px)) {
    .glass-nav { background: rgba(255, 253, 248, 0.94); }
  }

  .glass-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 10px 14px;
    gap: 12px;
  }

  .glass-slot-left  { justify-self: start; display: flex; align-items: center; gap: 10px; min-width: 0; }
  .glass-slot-right { justify-self: end;   display: flex; align-items: center; gap: 10px; min-width: 0; }

  .glass-brand {
    justify-self: center; text-align: center; text-decoration: none;
    color: var(--ink); font-family: 'Fraunces', serif;
    font-size: 22px; font-weight: 600; letter-spacing: -0.02em;
    white-space: nowrap; line-height: 1;
  }
  .glass-brand:hover { opacity: 0.7; color: var(--ink); }

  /* ── LEFT SLOT: presence badge (face + desaturated dot + name + sthlm time) ── */
  .presence {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 5px 12px 5px 5px; border-radius: 100px;
    border: 1px solid transparent; background: transparent;
    color: var(--ink, #0a0a0a); cursor: pointer; line-height: 1;
    font: inherit;
    transition: background 180ms ease, border-color 180ms ease;
  }
  .presence:hover { background: rgba(10,10,10,0.05); border-color: rgba(10,10,10,0.1); }
  .presence[aria-expanded="true"] {
    background: rgba(10,10,10,0.05); border-color: rgba(10,10,10,0.14);
  }

  .presence-face {
    position: relative; flex: none;
    width: 26px; height: 26px; border-radius: 50%;
    background-image: url('/profile.png');
    background-size: cover; background-position: center 20%;
    border: 1px solid rgba(10,10,10,0.12);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55);
  }
  .presence-dot {
    position: absolute; right: -1px; bottom: -1px;
    width: 9px; height: 9px; border-radius: 50%;
    background: #9ca3af;
    box-shadow: 0 0 0 1.5px #faf7f2;
  }
  .presence-dot[data-state="online"] {
    background: #6b9977;
    animation: presenceBreathe 2.4s ease-in-out infinite;
  }
  .presence-dot[data-state="away"]    { background: #d8a34a; }
  .presence-dot[data-state="offline"] { background: #9ca3af; }
  @keyframes presenceBreathe {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.6; }
  }

  .presence-label {
    display: inline-flex; align-items: baseline; gap: 7px;
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 12px; letter-spacing: 0; line-height: 1;
    color: rgba(10,10,10,0.72); font-weight: 500;
  }
  .presence-label .sep { color: rgba(10,10,10,0.28); }
  .presence-label .presence-time {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 11px; letter-spacing: 0;
    color: rgba(10,10,10,0.48);
  }

  /* Presence pop-down — anchored to pill's left edge, sibling of .glass-nav */
  .presence-panel {
    position: absolute; top: calc(100% + 10px); left: 16px;
    width: 288px; max-width: calc(100vw - 32px);
    background: rgba(255, 253, 248, 0.72);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(10,10,10,0.08);
    border-radius: 20px;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.7),
      0 24px 60px rgba(26,20,16,0.12),
      0 6px 16px rgba(26,20,16,0.06);
    padding: 16px;
    transform-origin: top left;
    transform: scale(0.96) translateY(-4px); opacity: 0;
    pointer-events: none;
    transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1), opacity 200ms ease;
    z-index: 110;
  }
  .presence-panel.is-open {
    transform: scale(1) translateY(0); opacity: 1; pointer-events: auto;
  }
  @supports not (backdrop-filter: blur(1px)) {
    .presence-panel { background: rgba(255, 253, 248, 0.97); }
  }

  .presence-card-head { display: flex; align-items: center; gap: 12px; }
  .presence-face-lg {
    width: 44px; height: 44px; border-radius: 50%; flex: none;
    background-image: url('/profile.png');
    background-size: cover; background-position: center 20%;
    border: 1px solid rgba(10,10,10,0.1);
    box-shadow:
      inset 0 0 0 1px rgba(255,255,255,0.55),
      0 0 0 2px rgba(255,253,248,0.8),
      0 0 0 3.5px #9ca3af;
    transition: box-shadow 220ms ease;
  }
  .presence-panel[data-state="online"]  .presence-face-lg { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55), 0 0 0 2px rgba(255,253,248,0.8), 0 0 0 3.5px #6b9977; }
  .presence-panel[data-state="away"]    .presence-face-lg { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55), 0 0 0 2px rgba(255,253,248,0.8), 0 0 0 3.5px #d8a34a; }
  .presence-panel[data-state="offline"] .presence-face-lg { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.55), 0 0 0 2px rgba(255,253,248,0.8), 0 0 0 3.5px #9ca3af; }

  .presence-card-head .who { min-width: 0; }
  .presence-fullname {
    font-family: 'Fraunces', serif; font-size: 17px; font-weight: 600;
    letter-spacing: -0.01em; line-height: 1.1; color: var(--ink);
  }
  .presence-loc {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 10.5px; letter-spacing: 0.04em;
    color: rgba(10,10,10,0.5); margin-top: 4px;
  }

  .presence-rows {
    margin: 14px 0 12px;
    display: flex; flex-direction: column; gap: 4px;
  }
  .presence-row {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; padding: 7px 0;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 11px; letter-spacing: 0.04em;
    border-top: 1px solid rgba(10,10,10,0.06);
  }
  .presence-row:first-child { border-top: none; }
  .presence-row .k { color: rgba(10,10,10,0.5); text-transform: uppercase; letter-spacing: 0.09em; }
  .presence-row .v { color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
  .presence-row .v .state-dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: #9ca3af;
    box-shadow: 0 0 0 1px rgba(255,253,248,0.8);
  }
  .presence-panel[data-state="online"]  .presence-row .v .state-dot { background: #6b9977; }
  .presence-panel[data-state="away"]    .presence-row .v .state-dot { background: #d8a34a; }
  .presence-panel[data-state="offline"] .presence-row .v .state-dot { background: #9ca3af; }

  /* ── presence-actions: 3-row action list inside the popover ── */
  .presence-actions {
    margin-top: 12px; padding-top: 12px;
    border-top: 1px solid rgba(10,10,10,0.06);
    display: flex; flex-direction: column; gap: 4px;
  }
  .presence-act {
    display: flex; align-items: center; gap: 10px;
    min-height: 40px;
    padding: 10px 12px; border-radius: 12px;
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 13px; line-height: 1.2; color: var(--ink);
    text-decoration: none; cursor: pointer;
    background: transparent; border: 0;
    transition: background 160ms ease;
    text-align: left;
  }
  .presence-act .label { font-weight: 500; flex: none; }
  .presence-act .label em { font-style: italic; font-family: 'Fraunces', serif; font-weight: 500; font-size: 14px; }
  .presence-act .meta {
    margin-left: auto; min-width: 0;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 10.5px; letter-spacing: 0.06em;
    color: rgba(10,10,10,0.45);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .presence-act .arr {
    color: rgba(10,10,10,0.45);
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    flex: none;
    transition: transform 160ms ease, color 160ms ease;
  }
  .presence-act:hover { background: rgba(10,10,10,0.04); }
  .presence-act:hover .arr { transform: translateX(2px); color: var(--ink); }
  .presence-act:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
  .presence-act.is-primary { background: var(--lavender, #ebe3ff); }
  .presence-act.is-primary:hover { background: #e0d3fb; }
  .presence-act.is-primary .meta { color: rgba(10,10,10,0.6); }
  .presence-act.is-soon { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
  .presence-act.is-soon .chip-soon {
    margin-left: auto;
    padding: 3px 8px; border-radius: 100px;
    background: var(--lavender, #ebe3ff);
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 9.5px; font-weight: 600;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--ink);
  }
  @media (max-width: 360px) {
    .presence-act { padding: 9px 10px; }
    .presence-act .meta { max-width: 44%; }
  }

  .presence-mail {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 14px; border-radius: 100px;
    border: 1px solid rgba(10,10,10,0.14);
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 11px; letter-spacing: 0.04em;
    color: var(--ink); text-decoration: none;
    transition: background 180ms ease, border-color 180ms ease;
  }
  .presence-mail:hover { background: rgba(10,10,10,0.05); border-color: rgba(10,10,10,0.4); }
  .presence-mail::before { content: "→"; color: rgba(10,10,10,0.5); }

  /* ── RIGHT SLOT menu toggle ── */
  .glass-toggle {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--ink); background: transparent; cursor: pointer;
    padding: 9px 14px; border-radius: 100px;
    border: 1px solid rgba(10,10,10,0.18);
    display: inline-flex; align-items: center; gap: 8px; line-height: 1;
    transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
  }
  .glass-toggle:hover { background: rgba(10,10,10,0.06); border-color: rgba(10,10,10,0.4); }
  .glass-toggle .chev { width: 10px; height: 10px; transition: transform 420ms cubic-bezier(0.16, 1, 0.3, 1); }
  .glass-nav.is-open .glass-toggle { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .glass-nav.is-open .glass-toggle .chev { transform: rotate(180deg); }

  /* ── Expanded tray ── */
  .glass-panel {
    max-height: 0; overflow: hidden;
    transition: max-height 520ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .glass-nav.is-open .glass-panel { max-height: 720px; }

  .glass-panel-inner {
    padding: 6px 16px 16px;
    display: flex; flex-direction: column; gap: 10px;
  }

  .glass-divider { height: 1px; background: rgba(10,10,10,0.08); margin: 2px 0; }

  .glass-stack { display: flex; flex-direction: column; gap: 6px; }

  .glass-item {
    display: flex; align-items: center; justify-content: flex-start;
    gap: 14px; padding: 14px 16px; border-radius: 18px;
    text-decoration: none; color: var(--ink);
    border: 1px solid transparent; background: transparent;
    transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
  }
  .glass-item:hover { background: rgba(10,10,10,0.04); }
  .glass-item .body { min-width: 0; flex: 1; }
  .glass-item .glass-icon {
    flex: none;
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--ink);
    border-radius: 12px;
    background: rgba(10,10,10,0.035);
    border: 1px solid rgba(10,10,10,0.06);
  }
  .glass-item .glass-icon svg { width: 26px; height: 26px; display: block; }
  .glass-item .t {
    font-family: 'Fraunces', serif; font-size: 19px; font-weight: 600;
    letter-spacing: -0.01em; line-height: 1.2; color: var(--ink);
  }
  .glass-item .t em { font-style: italic; font-weight: 600; }
  .glass-item .d {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--ink-dim, #666); margin-top: 4px;
  }
  .glass-item .arr {
    flex: none;
    width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid rgba(10,10,10,0.2);
    display: inline-flex; align-items: center; justify-content: center;
    font-family: 'Fraunces', serif; font-size: 15px; color: var(--ink);
    transition: transform 180ms ease;
  }
  .glass-item:hover .arr { transform: translateX(2px); }

  .glass-item--primary {
    background: var(--lavender, #e9e2ff);
    border-color: rgba(10,10,10,0.08);
  }
  .glass-item--primary:hover {
    background: #ddd4f5;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(26,20,16,0.08);
  }
  .glass-item--primary .glass-icon {
    background: rgba(255,255,255,0.55);
    border-color: rgba(10,10,10,0.08);
    color: var(--ink);
  }
  .glass-item--primary .arr {
    background: var(--ink); color: var(--bg); border-color: var(--ink);
    font-size: 14px;
  }
  .glass-item--primary:hover .arr { transform: scale(1.05); }

  .glass-brief {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 11px 16px; border-radius: 100px;
    text-decoration: none; color: var(--ink);
    border: 1px dashed rgba(10,10,10,0.22);
    background: transparent;
    transition: background 180ms ease, border-color 180ms ease, border-style 0ms;
  }
  .glass-brief:hover {
    background: rgba(10,10,10,0.04);
    border-style: solid;
    border-color: rgba(10,10,10,0.35);
  }
  .glass-brief .code {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 12px; color: var(--ink); letter-spacing: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .glass-brief .code .slash {
    color: var(--green, #22c55e); opacity: 0.75; margin-right: 6px;
  }
  .glass-brief .code .ctx { color: rgba(10,10,10,0.5); margin-left: 6px; }
  .glass-brief .arr-r { flex: none; color: rgba(10,10,10,0.4); font-family: 'Fraunces', serif; font-size: 16px; }
  .glass-brief:hover .arr-r { color: var(--ink); }

  .glass-meta {
    display: flex; align-items: center; justify-content: flex-end;
    padding: 2px 2px 0;
  }
  .glass-meta .lang-switch { margin-left: 0; }

  /* ── Responsive ── */
  @media (max-width: 640px) {
    nav.top { top: 12px; }
    .glass-nav-wrap { padding: 0 12px; }
    .glass-header { padding: 8px 10px; gap: 8px; }
    .glass-brand { font-size: 18px; }
    .glass-toggle { padding: 8px 12px; font-size: 10.5px; }

    .presence { padding: 4px 10px 4px 4px; gap: 7px; }
    .presence-face { width: 24px; height: 24px; }
    .presence-dot { width: 8px; height: 8px; }
    .presence-label .presence-name { display: none; }
    .presence-label .sep { display: none; }
    .presence-panel { left: 12px; }

    .glass-item { padding: 12px 12px; gap: 12px; }
    .glass-item .t { font-size: 17px; }
    .glass-item .d { display: none; }
    .glass-item .arr { width: 28px; height: 28px; }
    .glass-item .glass-icon { width: 40px; height: 40px; }
    .glass-item .glass-icon svg { width: 24px; height: 24px; }

    .glass-brief { padding: 10px 12px; }
    .glass-brief .code { font-size: 11.5px; }
    .glass-brief .code .ctx { display: none; }
  }
  @media (max-width: 480px) {
    .presence-label { display: none; }
    .presence { padding: 4px; }
  }
  @media (max-width: 380px) {
    .glass-brand { font-size: 16px; }
  }
