/* =====================================================================
   Abdulaziz Alzamil — CV dashboard (v2)
   Structure:
     1. Design tokens          5. Tile system (notched corners)
     2. Base / reset           6. Placeholder tiles
     3. Background layers      7. CONTACT tile
     4. Top bar + bento grid   8. Responsive + reduced motion
   ===================================================================== */

/* ---------- 1. DESIGN TOKENS ---------------------------------------- */
:root {
  /* Colour — near-black base, sky-blue primary (matches avatar ~#6fb0ee) */
  --c-bg:          #0a0b0e;   /* page */
  --c-surface:     #101217;   /* tile body */
  --c-surface-2:   #151821;   /* raised / button */
  --c-line:        rgba(255, 255, 255, 0.06);  /* grid lines */
  --c-border:      #232734;   /* tile border */
  --c-border-hi:   #3a4256;
  --c-text:        #eef1f6;   /* 16.9:1 on surface */
  --c-text-muted:  #a3abbb;   /*  8.0:1 on surface */
  --c-text-dim:    #7f879a;   /*  5.0:1 on surface (AA for small text) */

  --c-accent:      #6fb0ee;   /* sky blue — main accent / glow */
  --c-accent-hi:   #9ccbf6;   /* hover / highlight */
  --c-accent-deep: #2b5f93;   /* deep tint for borders/gradients */
  --c-accent-ink:  #06121f;   /* text on accent (11.8:1) */
  --c-accent-rgb:  111, 176, 238;
  --c-accent-2:    #ff5fa8;   /* glitch magenta — tiny status accents ONLY */

  /* Radii + notch */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --notch: 16px;              /* concave corner radius of tiles */

  /* Spacing scale (4px base) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
  --gap: 14px;                /* bento gutter */

  /* Type */
  --f-display: "Space Grotesk", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --t-2xs: 0.6875rem;  /* 11px HUD labels */
  --t-xs:  0.75rem;
  --t-sm:  0.875rem;
  --t-md:  1rem;
  --t-lg:  1.25rem;
  --t-xl:  clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
  --t-2xl: clamp(2.1rem, 1.2rem + 2.6vw, 3.6rem);

  /* Motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: 220ms;

}

/* Notched-corner mask, shared by every tile layer.
   Written as a class (not a custom property) so a per-element --notch override works. */
.notched, .tile__shell, .tile__body, .wordmark__mark {
  --_n: var(--notch);
  --_m:
    radial-gradient(circle at 0 0,       #0000 var(--_n), #000 calc(var(--_n) + .5px)) 0 0       / 51% 51% no-repeat,
    radial-gradient(circle at 100% 0,    #0000 var(--_n), #000 calc(var(--_n) + .5px)) 100% 0    / 51% 51% no-repeat,
    radial-gradient(circle at 0 100%,    #0000 var(--_n), #000 calc(var(--_n) + .5px)) 0 100%    / 51% 51% no-repeat,
    radial-gradient(circle at 100% 100%, #0000 var(--_n), #000 calc(var(--_n) + .5px)) 100% 100% / 51% 51% no-repeat;
  -webkit-mask: var(--_m);
          mask: var(--_m);
}

/* ---------- 2. BASE ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-display);
  font-size: var(--t-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, p { margin: 0; }
ul[role="list"] { list-style: none; margin: 0; padding: 0; }

:focus-visible {
  outline: 2px solid var(--c-accent-hi);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute; left: var(--s-4); top: -100px; z-index: 100;
  padding: var(--s-3) var(--s-4);
  background: var(--c-accent); color: var(--c-accent-ink);
  font-family: var(--f-mono); font-size: var(--t-sm); text-decoration: none;
  border-radius: var(--r-sm);
}
.skip-link:focus { top: var(--s-4); }

/* Small mono HUD label, reused everywhere */
.hud-label {
  font-family: var(--f-mono);
  font-size: var(--t-2xs);
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  line-height: 1.2;
}
.hud-label--dim    { color: var(--c-text-dim); }
.hud-label--accent { color: var(--c-accent); }

.dot {
  display: inline-block; width: 6px; height: 6px; margin-right: 8px; vertical-align: 1px;
  background: var(--c-accent-2); box-shadow: 0 0 8px var(--c-accent-2);
  animation: blink 2.4s steps(2, jump-none) infinite;
}
.dot--accent { background: var(--c-accent); box-shadow: 0 0 8px var(--c-accent); }
@keyframes blink { 50% { opacity: .35; } }

.accent { color: var(--c-accent); }
.nw { white-space: nowrap; }   /* keep phrase + its separator together */

/* ---------- 3. BACKGROUND LAYERS ------------------------------------ */
.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 70% 10%, rgba(var(--c-accent-rgb), .07), transparent 70%),
    linear-gradient(var(--c-line) 1px, transparent 1px) 0 0 / 56px 56px,
    linear-gradient(90deg, var(--c-line) 1px, transparent 1px) 0 0 / 56px 56px;
}
/* One slow, faint scan band. transform-only animation = cheap. */
.bg-scan {
  position: fixed; left: 0; right: 0; top: 0; height: 30vh; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(var(--c-accent-rgb), .035) 50%, transparent);
  animation: scan 9s linear infinite;
}
@keyframes scan { from { transform: translateY(-30vh); } to { transform: translateY(100vh); } }

/* ---------- 4. TOP BAR + BENTO GRID --------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  max-width: 1360px; margin: 0 auto;
  padding: var(--s-3) var(--s-5);
  padding-top: max(var(--s-3), env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(10, 11, 14, .92), rgba(10, 11, 14, .72));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-line);
}
.wordmark {
  display: inline-flex; align-items: center; gap: var(--s-3);
  min-height: 44px; text-decoration: none;
}
.wordmark__mark {
  display: grid; place-items: center; width: 30px; height: 30px;
  background: var(--c-accent); color: var(--c-accent-ink);
  font-family: var(--f-mono); font-size: var(--t-xs); font-weight: 700;
  --notch: 7px;
}
.wordmark__text {
  font-family: var(--f-display); font-weight: 700; font-size: var(--t-sm);
  letter-spacing: .22em;
}

.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: var(--gap);
  max-width: 1360px; margin: 0 auto;
  padding: var(--s-5);
}
/* Span utilities for future tiles (desktop). Overridden in media queries. */
.span-3  { grid-column: span 3; }
.span-4  { grid-column: span 4; }
.span-6  { grid-column: span 6; }
.span-8  { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.footer {
  display: flex; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap;
  max-width: 1360px; margin: 0 auto;
  padding: var(--s-4) var(--s-5) max(var(--s-6), env(safe-area-inset-bottom));
}

/* ---------- 5. TILE SYSTEM ------------------------------------------ */
/* .tile        : grid item; hover lift + outer glow (filter must live OUTSIDE the mask)
   .tile__shell : masked; its background IS the 1px border (gradient)
   .tile__body  : masked, inset 1px; the surface and content            */
.tile {
  position: relative;
  min-width: 0;
  transition: transform var(--dur) var(--ease), filter var(--dur) var(--ease);
  filter: drop-shadow(0 0 0 rgba(var(--c-accent-rgb), 0));
}
.tile__shell {
  height: 100%;
  padding: 1px;
  background:
    linear-gradient(160deg, rgba(var(--c-accent-rgb), .55), var(--c-border) 28%, var(--c-border) 72%, rgba(var(--c-accent-rgb), .3));
}
.tile__body {
  position: relative;
  height: 100%;
  padding: var(--s-5);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(var(--c-accent-rgb), .05), transparent 60%),
    var(--c-surface);
  overflow: hidden;
}
@media (hover: hover) {
  .tile:hover, .js .tile.is-in:hover {
    transform: translateY(-3px);
    filter: drop-shadow(0 0 14px rgba(var(--c-accent-rgb), .22));
  }
}

/* Tiny L-shaped tick marks just inside each notch */
.tile__ticks, .tile__ticks::before, .tile__ticks::after { pointer-events: none; }
.tile__ticks {
  position: absolute;
  --tk: rgba(var(--c-accent-rgb), .55);
  background:
    linear-gradient(var(--tk), var(--tk)) 0 0 / 8px 1px no-repeat,
    linear-gradient(var(--tk), var(--tk)) 0 0 / 1px 8px no-repeat,
    linear-gradient(var(--tk), var(--tk)) 100% 0 / 8px 1px no-repeat,
    linear-gradient(var(--tk), var(--tk)) 100% 0 / 1px 8px no-repeat,
    linear-gradient(var(--tk), var(--tk)) 0 100% / 8px 1px no-repeat,
    linear-gradient(var(--tk), var(--tk)) 0 100% / 1px 8px no-repeat,
    linear-gradient(var(--tk), var(--tk)) 100% 100% / 8px 1px no-repeat,
    linear-gradient(var(--tk), var(--tk)) 100% 100% / 1px 8px no-repeat;
  inset: 10px;
}

/* HUD label row at the top of a tile */
.tile__hud {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap;
  padding: 0 var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--c-line);
}
.tile__hud .hud-coords { margin-left: auto; }

/* ---------- 6. LAYOUT: tile placement --------------------------------
   Desktop (12 col):  [ contact 8 ][ education 4 ]
                      [ experience 12 (current-role bullets in 2 columns) ]
                      [ leadership 12 (two entries side by side) ]
                      [ skills 12 (chips flow in rows) ]
   DOM order (= phone order): contact, experience, education, leadership, skills */
.tile--contact    { grid-column: 1 / span 8; grid-row: 1; }
.tile--skills     { grid-column: 1 / -1;     grid-row: 4; }
.tile--experience { grid-column: 1 / -1;     grid-row: 2; }
.tile--education  { grid-column: 9 / span 4; grid-row: 1; }
@media (min-width: 1100px) {
  .entry--current .entry__list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s-6); }
  .entry--current .entry__list li:last-child:nth-child(odd) { grid-column: 1 / -1; }  /* odd count: last bullet spans both columns */
}
.tile--leadership { grid-column: 1 / -1;     grid-row: 3; }
.tile__title { margin: 0; }

/* Entrance animation (JS adds .js on <html>; IntersectionObserver adds .is-in) */
.js .tile { opacity: 0; transform: translateY(14px); }
.js .tile.is-in { opacity: 1; transform: none; transition: opacity 500ms var(--ease), transform 500ms var(--ease), filter var(--dur) var(--ease); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Shared small tag + date */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  font-family: var(--f-mono); font-size: var(--t-2xs); font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: var(--c-text-muted);
  border: 1px solid var(--c-border-hi); border-radius: 4px;
  background: rgba(255,255,255,.02);
  white-space: nowrap;
}
.tag .dot { margin-right: 0; }
.tag--present { color: var(--c-accent-hi); border-color: rgba(var(--c-accent-rgb), .55); background: rgba(var(--c-accent-rgb), .10); }
.entry__date { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--c-text-muted); letter-spacing: .04em; white-space: nowrap; }

/* ---------- 6a. EXPERIENCE TILE ------------------------------------ */
.timeline { list-style: none; margin: 0; padding: var(--s-4) 0 0; display: grid; gap: var(--s-3); position: relative; }
.timeline::before {                      /* vertical rail */
  content: ""; position: absolute; left: 7px; top: calc(var(--s-4) + 22px); bottom: 22px; width: 1px;
  background: linear-gradient(var(--c-accent), var(--c-border-hi) 30%, var(--c-border) 100%);
}
.entry { position: relative; padding-left: 28px; }
.entry__node {
  position: absolute; left: 3px; top: 20px; width: 9px; height: 9px;
  background: var(--c-surface); border: 1px solid var(--c-border-hi); transform: rotate(45deg);
}
.entry--current .entry__node { background: var(--c-accent); border-color: var(--c-accent); box-shadow: 0 0 10px rgba(var(--c-accent-rgb), .7); }
.entry__card {
  position: relative; overflow: hidden;
  border: 1px solid var(--c-border); border-radius: var(--r-md);
  background: rgba(255,255,255,.015);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.entry--current .entry__card { border-color: rgba(var(--c-accent-rgb), .35); background: linear-gradient(180deg, rgba(var(--c-accent-rgb), .06), transparent 70%); }
.entry__card:hover { border-color: var(--c-border-hi); }
.entry__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-4); flex-wrap: wrap;
  min-height: 56px; padding: var(--s-3) var(--s-4);
}
summary.entry__head { cursor: pointer; list-style: none; padding-right: 48px; position: relative; }
summary.entry__head::-webkit-details-marker { display: none; }
summary.entry__head:focus-visible { outline-offset: -2px; }
.entry__role { margin: 0; font-size: var(--t-md); font-weight: 600; line-height: 1.25; }
.entry--current .entry__role { font-size: var(--t-lg); }
.entry__org { margin-top: 2px; font-family: var(--f-mono); font-size: var(--t-xs); letter-spacing: .06em; color: var(--c-accent); }
.entry__meta { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.entry__toggle {                          /* plus → minus */
  position: absolute; right: 16px; top: 50%; width: 14px; height: 14px; translate: 0 -50%;
  background:
    linear-gradient(var(--c-text-muted), var(--c-text-muted)) center / 14px 1.5px no-repeat,
    linear-gradient(var(--c-text-muted), var(--c-text-muted)) center / 1.5px 14px no-repeat;
  transition: transform var(--dur) var(--ease);
}
details[open] .entry__toggle { transform: rotate(45deg); }
.entry__list { margin: 0; padding: 0 var(--s-4) var(--s-4); display: grid; gap: 6px; }
.entry__list li { position: relative; padding-left: 18px; color: var(--c-text-muted); font-size: var(--t-sm); line-height: 1.5; }
.entry__list li::before { content: "›"; position: absolute; left: 2px; top: -1px; color: var(--c-accent); font-family: var(--f-mono); }
.entry__list strong { color: var(--c-text); font-weight: 600; }
details[open] .entry__list { animation: reveal 260ms var(--ease); }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } }
.entry__scan {                            /* slow scan-line over the current role */
  position: absolute; left: 0; right: 0; top: 0; height: 40%; pointer-events: none;
  background: linear-gradient(to bottom, transparent, rgba(var(--c-accent-rgb), .06), transparent);
  animation: entryScan 5.5s linear infinite;
}
@keyframes entryScan { from { transform: translateY(-100%); } to { transform: translateY(260%); } }

/* ---------- 6b. EDUCATION + CAPSTONE ------------------------------- */
/* Tile body is a flex column: the degree block grows and centres itself, the capstone sits at the bottom,
   so the tile never shows dead space when it stretches to match its row. */
.tile--education .tile__body { display: flex; flex-direction: column; }
.edu {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-5) var(--s-1) var(--s-6);
  background: linear-gradient(90deg, rgba(var(--c-accent-rgb), .45), transparent) left 34px / 1px calc(100% - 68px) no-repeat; /* thin HUD rail */
  padding-left: var(--s-4);
}
.edu__degree { font-size: clamp(2.2rem, 1.2rem + 2vw, 3.1rem); font-weight: 600; line-height: 1.02; letter-spacing: -.025em; text-wrap: balance; }
.edu__label { letter-spacing: .16em; }
.edu__school { color: var(--c-text-muted); font-size: var(--t-sm); }
.capstone {
  position: relative; padding: var(--s-4); border-radius: var(--r-md);
  border: 1px solid rgba(var(--c-accent-rgb), .3);
  background: linear-gradient(180deg, rgba(var(--c-accent-rgb), .06), transparent 80%);
}
.capstone::before {                       /* connector from degree to capstone */
  content: ""; position: absolute; left: 20px; top: -17px; height: 16px; width: 1px; background: rgba(var(--c-accent-rgb), .5);
}
.capstone__head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.capstone__title { margin: var(--s-2) 0 var(--s-1); font-size: var(--t-lg); font-weight: 600; line-height: 1.2; }
.capstone__desc { color: var(--c-text-muted); font-size: var(--t-sm); }
.awards { display: grid; gap: var(--s-2); margin-top: var(--s-4); }
.award {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3); min-height: 44px;
  font-size: var(--t-sm); line-height: 1.3;
  border: 1px solid var(--c-border-hi); border-radius: var(--r-sm); background: var(--c-surface-2);
}
.award__rank {
  flex: none; display: grid; place-items: center; width: 40px; height: 28px;
  font-family: var(--f-mono); font-size: var(--t-xs); font-weight: 700; letter-spacing: .06em;
  color: var(--c-accent-ink); background: var(--c-accent);
  clip-path: polygon(6px 0, calc(100% - 6px) 0, 100% 50%, calc(100% - 6px) 100%, 6px 100%, 0 50%);
}

/* ---------- 6c. LEADERSHIP (compact) ------------------------------- */
.leads { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--s-5); }
.lead { padding: var(--s-4) var(--s-1) 0; }
.lead + .lead { padding-left: var(--s-5); border-left: 1px solid var(--c-line); }
.lead__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2) var(--s-3); flex-wrap: wrap; }
.lead__role { margin: 0; font-size: var(--t-md); font-weight: 600; line-height: 1.3; }
.lead__org { margin-top: 2px; font-family: var(--f-mono); font-size: var(--t-xs); color: var(--c-accent); letter-spacing: .06em; }
.lead__desc { margin-top: var(--s-2); color: var(--c-text-muted); font-size: var(--t-sm); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); margin-top: var(--s-3); }
.stat { display: grid; gap: 2px; padding: var(--s-2) var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-sm); background: rgba(255,255,255,.02); }
.stat__num { font-family: var(--f-mono); font-size: var(--t-md); font-weight: 700; color: var(--c-text); }
.stat__label { font-size: var(--t-xs); color: var(--c-text-muted); line-height: 1.3; }

/* ---------- 6d. SKILLS --------------------------------------------- */
ul.skills.chips { padding: var(--s-5) var(--s-1) 0; gap: var(--s-2); }
.skills .chip { padding: 9px 14px; font-size: var(--t-md); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  --notch: 5px;
  position: relative;
  padding: 6px 11px;
  font-size: var(--t-sm); line-height: 1.3; color: var(--c-text);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-hi);
  border-radius: 4px;
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.chip::before {                           /* tiny pixel bullet */
  content: ""; display: inline-block; width: 4px; height: 4px; margin-right: 8px; vertical-align: 2px;
  background: var(--c-accent); opacity: .7;
}
.chip:hover { border-color: var(--c-accent); color: #fff; transform: translateY(-1px); box-shadow: 0 0 12px rgba(var(--c-accent-rgb), .18); }
.js .tile--skills:not(.is-in) .chip { opacity: 0; }
.js .tile--skills.is-in .chip { animation: chipIn 420ms var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms + 120ms); }
@keyframes chipIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------- 6e. FOOTER LINKS ------------------------------------- */
.footer { align-items: center; }
.footer__link { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--c-text-muted); }
.footer__link:hover { color: var(--c-accent-hi); }

/* ---------- 7. CONTACT TILE ----------------------------------------- */
.tile--contact .tile__body { padding: var(--s-5) var(--s-5) var(--s-6); }

.contact {
  /* NOTE: no z-index/transform/isolation here or on .avatar-stage — they would
     create an isolated group and break the avatar's mix-blend-mode. */
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: var(--s-5);
  padding: var(--s-5) var(--s-2) 0;
}
.contact__copy { display: flex; flex-direction: column; gap: var(--s-4); min-width: 0; }

.contact__title {
  font-size: clamp(2.4rem, 1.3rem + 3vw, 4rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.contact__title .accent { text-shadow: 0 0 24px rgba(var(--c-accent-rgb), .35); }
.contact__sub { color: var(--c-text-muted); font-size: var(--t-md); max-width: 46ch; }

/* Buttons */
.actions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2);
  margin-top: var(--s-2);
}
.btn {
  position: relative;
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; min-height: 48px; padding: 0 var(--s-4);
  font: 500 var(--t-sm) / 1 var(--f-display);
  color: var(--c-text); text-decoration: none; cursor: pointer;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-hi);
  border-radius: var(--r-sm);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:hover { border-color: var(--c-accent); color: #fff; box-shadow: 0 0 0 1px rgba(var(--c-accent-rgb), .25), 0 0 18px rgba(var(--c-accent-rgb), .18); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--c-accent); border-color: var(--c-accent); color: var(--c-accent-ink); font-weight: 700;
}
.btn--primary:hover { background: var(--c-accent-hi); border-color: var(--c-accent-hi); color: var(--c-accent-ink); }
.btn__icon, .btn__arrow {
  flex: none; width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: square; stroke-linejoin: miter;
}
.btn__icon .fill { fill: currentColor; stroke: none; }
.btn__arrow { margin-left: auto; width: 16px; height: 16px; opacity: .8; transition: transform var(--dur) var(--ease); }
.btn:hover .btn__arrow { transform: translate(2px, -2px); }
.btn.is-copied { border-color: var(--c-accent); color: var(--c-accent-hi); }

/* Inline toast (aria-live). Reserved height => no layout shift. */
.toast {
  min-height: 1.4em;
  font-family: var(--f-mono); font-size: var(--t-xs); letter-spacing: .08em;
  color: var(--c-accent-hi);
  opacity: 0; transform: translateY(-4px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.is-visible { opacity: 1; transform: none; }
.toast::before { content: "▸ "; color: var(--c-accent); }
.toast:empty::before { content: ""; }
.toast.is-error { color: #ffd2e6; }

/* Live clock */
.clock {
  display: grid; gap: var(--s-1);
  padding: var(--s-3) var(--s-4);
  border-left: 2px solid var(--c-accent);
  background: linear-gradient(90deg, rgba(var(--c-accent-rgb), .07), transparent 80%);
}
.clock__row { display: flex; align-items: baseline; gap: var(--s-4); flex-wrap: wrap; }
.clock__time {
  font-family: var(--f-mono); font-weight: 500; font-size: var(--t-xl);
  font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--c-text);
}
.clock__date { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--c-text-muted); letter-spacing: .06em; }
.clock__zone { color: var(--c-text-muted); }

/* Avatar stage — 360° hologram turntable.
   Wider than tall (6:5) so the side glitch FX have room beside the figure.
   NOTE: no z-index/transform/isolation on .contact or .avatar-stage — that would
   create an isolated group and break the avatar's mix-blend-mode. */
.avatar-stage {
  position: relative;
  margin: 0;
  aspect-ratio: 6 / 5;            /* fixed box => zero layout shift */
  width: 100%; max-width: 560px; justify-self: center;
}
.avatar-stage__glow {
  position: absolute; inset: 12% 22% 10%; z-index: -1;
  background: radial-gradient(closest-side, rgba(var(--c-accent-rgb), .30), rgba(var(--c-accent-rgb), .08) 60%, transparent);
  filter: blur(8px);
  animation: pulse 6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .7; transform: scale(.96); } }
.avatar-stage__ring {
  position: absolute; top: 4%; bottom: 4%; left: 50%; aspect-ratio: 1; z-index: -1;
  translate: -50% 0; border-radius: 50%;
  border: 1px dashed rgba(var(--c-accent-rgb), .22);
  animation: spin 60s linear infinite;
}
.avatar-stage__ring::after {
  content: ""; position: absolute; inset: 9%; border-radius: 50%;
  border: 1px solid rgba(var(--c-accent-rgb), .10);
}
@keyframes spin { to { transform: rotate(360deg); } }
.avatar-stage__base {
  position: absolute; left: 30%; right: 30%; bottom: 5%; height: 7%; z-index: -1;
  background: radial-gradient(closest-side, rgba(var(--c-accent-rgb), .35), transparent);
  border-radius: 50%;
  animation: shadow 6s ease-in-out infinite;
}
@keyframes shadow { 50% { transform: scaleX(.86); opacity: .65; } }

/* Whole avatar group is screen-blended onto the tile: pure black => tile colour. */
.avatar-float {
  position: absolute; inset: 0;
  mix-blend-mode: screen;
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* Static first-paint / no-JS image: square, centred, same crop maths as the canvas. */
.avatar-float picture {
  position: absolute; top: 0; bottom: 0; left: 50%; aspect-ratio: 1; translate: -50% 0;
  overflow: hidden;
}
.avatar {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.096);        /* = 640/584, matches canvas source crop (CROP=28) */
  user-select: none; -webkit-user-drag: none;
  transition: opacity 200ms linear;
}
.avatar-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; transition: opacity 200ms linear;
}
.avatar-stage.is-ready .avatar-canvas { opacity: 1; }
.avatar-stage.is-ready .avatar { opacity: 0; }

/* Interaction surface (role=slider). pan-y keeps vertical page scroll on phones. */
.avatar-viewer {
  position: absolute; inset: 0; z-index: 1;
  touch-action: pan-y;
  cursor: grab;
  border-radius: var(--r-md);
  -webkit-tap-highlight-color: transparent;
}
.avatar-viewer.is-dragging { cursor: grabbing; }
.avatar-viewer:focus-visible { outline-offset: -2px; }

.avatar-stage__angle, .avatar-stage__hint { position: absolute; bottom: 0; pointer-events: none; }
.avatar-stage__angle { left: 2%; font-variant-numeric: tabular-nums; }
.avatar-stage__angle span { color: var(--c-accent); }
.avatar-stage__hint  { right: 2%; }

/* ---------- 8. RESPONSIVE ------------------------------------------- */
/* Tablet: 6 columns */
@media (max-width: 1099.98px) {
  .bento { grid-template-columns: repeat(6, minmax(0, 1fr)); padding: var(--s-4); }
  .span-3, .span-6 { grid-column: span 3; }
  .span-4, .span-8, .span-12 { grid-column: span 6; }
  .tile--contact, .tile--experience, .tile--skills { grid-column: 1 / -1; grid-row: auto; }
  .tile--education  { grid-column: 1 / span 3; grid-row: auto; }
  .tile--leadership { grid-column: 4 / span 3; grid-row: auto; }
  .leads { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .lead + .lead { padding-left: var(--s-1); border-left: 0; margin-top: var(--s-4); border-top: 1px solid var(--c-line); }
    .contact { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: var(--s-4); }
  .avatar-stage__angle, .avatar-stage__hint { font-size: 10px; letter-spacing: .08em; }
  .btn { padding: 0 var(--s-3); gap: var(--s-2); }
  .avatar-stage { max-width: 400px; }
}

/* Phones: single column, app-like */
@media (max-width: 699.98px) {
  :root { --notch: 14px; --gap: 12px; }
  .topbar { padding-left: var(--s-4); padding-right: var(--s-4); }
  .wordmark__text { font-size: var(--t-xs); letter-spacing: .18em; }
  .bento { grid-template-columns: minmax(0, 1fr); padding: var(--s-3); }
  .bento > * { grid-column: 1 / -1 !important; }
  .skills .chip { padding: 7px 10px; font-size: 13px; }
  .skills .chip::before { margin-right: 6px; }
  ul.skills.chips { gap: 6px; }
  .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
  .stat { padding: var(--s-2); }
  .stat__num { font-size: var(--t-sm); }
  .entry { padding-left: 22px; }
  .timeline::before { left: 5px; }
  .entry__node { left: 1px; }
  .entry__head { padding: var(--s-3); }
  summary.entry__head { padding-right: 40px; }
  .entry__toggle { right: 12px; }
  .entry__list { padding: 0 var(--s-3) var(--s-3); }
  .tile__body { padding: var(--s-4); }
  .footer { flex-direction: column; align-items: flex-start; gap: 0; }
  html { scroll-padding-top: 76px; }
  .tile--contact .tile__body { padding: var(--s-4) var(--s-4) var(--s-5); }
  .tile__hud { gap: var(--s-3); padding-inline: var(--s-1); }
  .tile__hud .hud-coords { display: none; }
  .contact { grid-template-columns: minmax(0, 1fr); padding: var(--s-2) var(--s-1) 0; gap: var(--s-3); }
  .avatar-stage { order: -1; max-width: 360px; }
  .avatar-stage__angle, .avatar-stage__hint { font-size: 10px; }
  .actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .btn { min-height: 52px; padding: 0 var(--s-3); gap: var(--s-2); }
  .footer { padding-inline: var(--s-4); }
}
@media (max-width: 359.98px) {
  .actions { grid-template-columns: minmax(0, 1fr); }
}

/* Reduced motion: kill every decorative animation + parallax */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .bg-scan, .entry__scan { display: none; }
  .js .tile, .js .tile--skills .chip { opacity: 1 !important; transform: none !important; }
}
