/* ============================================================
   shared.css — single source of truth for chrome shared across
   all pages (top nav, Work dropdown, buttons, theme toggle,
   back-link, footer, mobile menu). Linked LAST in <head> so it
   wins over any per-page inline styles. Edit common chrome HERE.
   Relies on per-page tokens: --bg --ink --muted --line --field
   --accent --card --card-line --accent-soft.
   ============================================================ */

/* ---- Global zoom (on BODY so it scales everything uniformly with no reflow
   and doesn't feed back into the media-query viewport). Thresholds are in
   LOGICAL px — macOS Retina/Thunderbolt reports ~1680, not 2560. ---- */
@media (min-width: 800px)  { body { zoom: 1.12; } }
@media (min-width: 1250px) { body { zoom: 1.3; } }
@media (min-width: 1500px) { body { zoom: 1.55; } }
@media (min-width: 1800px) { body { zoom: 1.8; } }
@media (min-width: 2200px) { body { zoom: 2.1; } }

/* ---- Top bar ---- */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--line); }
.topbar .inner { max-width: 1080px; margin: 0 auto; padding: 0 32px; height: 64px; display: flex; align-items: center; gap: 20px; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.brand .mk { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 800; }

/* nav (case studies/home use <nav>, resume uses <nav class="tabs">) */
.topbar nav { display: flex; align-items: center; gap: 24px; margin-left: 14px; }
.topbar nav > a { text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 500; line-height: 1; transition: color 0.18s; }
.topbar nav > a:hover, .topbar nav > a.active { color: var(--ink); }

/* Work dropdown */
.nav-work { position: relative; }
.nav-work > a { display: inline-flex; align-items: center; gap: 4px; }
.nav-work .caret { width: 9px; height: 9px; opacity: 0.65; transition: transform 0.18s; }
.nav-work:hover .caret { transform: rotate(180deg); }
.nav-work::after { content: ""; position: absolute; top: 100%; left: -14px; right: -14px; height: 14px; }
.work-menu { position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(-4px); min-width: 240px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 44px -18px rgba(0,0,0,0.30); padding: 7px; opacity: 0; visibility: hidden; transition: opacity 0.16s ease, transform 0.16s ease; z-index: 80; }
.nav-work:hover .work-menu { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.topbar .work-menu a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); font-size: 13.5px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.topbar .work-menu a small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; margin-top: 1px; }
.topbar .work-menu a:hover { background: var(--field); }
.nav-work.open .work-menu { opacity: 1 !important; visibility: visible !important; transform: translateX(-50%) translateY(0) !important; }
.nav-work.open .caret { transform: rotate(180deg); }

.topbar .spacer { flex: 1; }

/* Primary button */
.btn-primary { background: var(--accent); color: #fff; border: 0; padding: 9px 18px; border-radius: 999px; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; transition: filter 0.18s, transform 0.15s; white-space: nowrap; }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* Theme toggle */
.theme-toggle { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; background: transparent; border: 1px solid var(--line); color: var(--ink); cursor: pointer; transition: background-color 0.2s, border-color 0.2s; margin-left: 0; }
.theme-toggle:hover { background: var(--field); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
body[data-theme="graphite"] .theme-toggle .icon-sun { display: block; }
body[data-theme="graphite"] .theme-toggle .icon-moon { display: none; }

/* Back to work link (case studies) */
.back-link { max-width: 1080px; margin: 0 auto; padding: 32px 32px 0; display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; font-family: "Figtree", sans-serif; letter-spacing: 0.1em; text-transform: uppercase; }
.back-link:hover { color: var(--accent); }

/* ---- Footer ---- */
footer, footer#contact { background: #0E0E11; color: #C9C9CF; margin-top: 64px; min-height: calc(100vh - 64px); display: flex; align-items: center; }
footer .fin { width: 100%; max-width: 1080px; margin: 0 auto; padding: 64px 32px 48px; }
footer .ft-top { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; gap: 32px 40px; }
footer .ft-brand { font-weight: 800; font-size: 19px; color: #fff; display: flex; align-items: center; gap: 8px; }
footer .ft-brand .mk { width: 24px; height: 24px; border-radius: 7px; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
footer .ft-tag { font-size: 14px; color: #8C8C95; margin-top: 8px; max-width: 30ch; }
footer .ft-cta { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
footer .ft-cta > span { color: #C9C9CF; font-size: 15px; line-height: 1.5; }
footer .ft-links { display: flex; gap: 12px; }
footer .ft-links a { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--accent); display: grid; place-items: center; color: #fff; text-decoration: none; transition: background-color 0.18s; }
footer .ft-links a svg { display: block; }
footer .ft-links a:hover { border-color: var(--accent); color: #fff; background: var(--accent); }
footer .ft-cta a { color: #fff; font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
footer .ft-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 24px; border-top: 1px solid #232329; font-size: 13px; color: #76767E; }

/* Contact jiggle (when already at footer) */
@keyframes contact-jiggle { 0%,100%{transform:translateX(0)} 18%{transform:translateX(-5px)} 38%{transform:translateX(5px)} 58%{transform:translateX(-3px)} 78%{transform:translateX(3px)} }
.ft-cta.jiggle > span { animation: contact-jiggle .5s ease; display:inline-block; }
.ft-cta.jiggle .ft-links a { animation: contact-jiggle .55s ease; }
.ft-cta.jiggle .ft-links a:nth-child(2){ animation-delay:.06s; }
@media (prefers-reduced-motion: reduce){ .ft-cta.jiggle > span, .ft-cta.jiggle .ft-links a { animation:none; } }

/* ---- Mobile nav (hamburger) ---- */
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; color: var(--ink); }
.nav-toggle svg { width: 24px; height: 24px; display: block; }
.mobile-menu { display: none; }
@media (max-width: 700px) {
  .topbar nav { display: none !important; }
  .topbar .btn-primary { display: none !important; }
  .nav-toggle { display: grid; place-items: center; }
  .mobile-menu { display: block; position: fixed; top: 64px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 20px 44px -22px rgba(0,0,0,.4); padding: 10px; z-index: 90; max-height: calc(100vh - 64px); overflow-y: auto; opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity .18s ease, transform .18s ease, visibility .18s; }
  .mobile-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
  .mobile-menu a { display: block; padding: 13px 14px; border-radius: 10px; text-decoration: none; color: var(--ink); font-size: 16px; font-weight: 600; }
  .mobile-menu a small { display: block; font-size: 12.5px; font-weight: 400; color: var(--muted); margin-top: 2px; }
  .mobile-menu a:active { background: var(--field); }
  .mobile-menu .mm-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 14px 14px 4px; }
  .mobile-menu .mm-cta { margin-top: 8px; background: var(--accent); color: #fff; text-align: center; }
  .mobile-menu .mm-sep { height: 1px; background: var(--line); margin: 8px 6px; }
}
