/* ============================================================
   MaShowMagic Portfolio — Shell, Sidebar, Bento layout
   ana.sh-style: sticky identity column (left) + living bento (right).
   Builds on colors_and_type.css tokens.
   ============================================================ */

html, body { height: 100%; }
html { background: var(--bg); }
body { overflow: hidden; }            /* desktop: lock page scroll */
#root { height: 100vh; }

/* ---- accent override hook (Tweaks can repaint the whole site) ---- */
:root { --accent-rgb: 88, 101, 242; }

/* ---- Light mode: deepen canvas + firm up card edges so bento cards
        don't melt into the near-white background ---- */
body[data-theme="light"],
html[data-theme="light"] {
  --bg: var(--zinc-200);              /* #e4e4e7 — a touch deeper than the white cards */
  --border: rgba(9, 9, 11, 0.10);
  --border-strong: rgba(9, 9, 11, 0.16);
  --shadow-card: 0 1px 2px rgba(9,9,11,0.05), 0 5px 16px rgba(9,9,11,0.09);
  --shadow-hover: 0 2px 6px rgba(9,9,11,0.07), 0 18px 40px rgba(9,9,11,0.14);
}

/* ============================================================
   APP — fixed-viewport dashboard shell (ana.sh-style)
     brand | nav
     sidebar | bento
   ============================================================ */
.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 326px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "brand   nav"
    "sidebar bento";
  overflow: hidden;
}
.app.side-right {
  grid-template-columns: minmax(0, 1fr) 326px;
  grid-template-areas:
    "nav  brand"
    "bento sidebar";
}
.app.dense { --gap: 12px; }
.app.airy  { --gap: 22px; }

/* faint grain (per visual foundations) */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  pointer-events: none; z-index: 1;
}
body[data-theme="light"]::before { opacity: 0.025; }
body[data-theme="dark"]::before  { opacity: 0.045; }
body.no-grain::before { display: none; }

/* ---------------- Brand (logo cell, top-left) ---------------- */
.brand {
  grid-area: brand;
  display: flex; align-items: center; gap: 10px;
  padding: 20px 24px 12px 30px;
}
.wordmark {
  font-family: var(--font-display); font-weight: 800;
  font-size: 22px; letter-spacing: -0.045em; color: var(--fg);
  line-height: 1; white-space: nowrap;
}
.wordmark em { color: var(--accent); font-style: normal; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 16px;
  background: linear-gradient(140deg, var(--blurple-400), var(--blurple-600));
  box-shadow: 0 4px 12px rgba(88,101,242,0.4);
}

/* ---------------- Top nav ---------------- */
.topnav {
  grid-area: nav;
  display: flex; align-items: center; gap: 14px;
  padding: 20px 30px 12px 24px;
  min-width: 0;
}
.nav-links { display: flex; gap: 2px; margin: 0 auto; }
.nav-link {
  font-family: var(--font-sans); font-weight: 600; font-size: 14px;
  color: var(--fg-muted); background: transparent; border: 0; cursor: pointer;
  padding: 8px 16px; border-radius: var(--radius-pill);
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
  white-space: nowrap; text-decoration: none;
}
.nav-link:hover { color: var(--fg); background: var(--surface-2); }
.nav-link.active { color: var(--fg); background: var(--surface); box-shadow: var(--shadow-card); }
.nav-right { display: flex; align-items: center; gap: 10px; flex: none; }

/* ---------------- Bento (the ONLY scrollable region) ---------------- */
.bento {
  grid-area: bento;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(208px, 1fr));
  grid-template-areas:
    "now      now       weather  status"
    "discord  discord   photo1   photo2"
    "blog     blog      photo1   photo2"
    "github   github    building building"
    "github   github    kofi     kofi";
  gap: var(--gap);
  padding: 4px 24px 26px 26px;
  overflow-y: auto;            /* scrolls when cards exceed the viewport */
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-gutter: stable;
}
.bento::-webkit-scrollbar { width: 8px; }
.bento::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
.bento::-webkit-scrollbar-track { background: transparent; }
.app.side-right .bento { padding: 4px 26px 26px 24px; }

/* area assignments */
.b-now{grid-area:now}
.b-github{grid-area:github}
.b-discord{grid-area:discord}
.b-building{grid-area:building}
.b-blog{grid-area:blog}
.b-weather{grid-area:weather}
.b-status{grid-area:status}
.b-kofi{grid-area:kofi}
.b-photo1{grid-area:photo1}
.b-photo2{grid-area:photo2}

/* ============================================================
   SIDEBAR — identity column (FIXED, full height, no scrollbar)
   Locked in place — never scrolls with the page.
   ============================================================ */
.sidebar {
  grid-area: sidebar;
  display: flex; flex-direction: column;
  gap: 16px;
  padding: 4px 24px 26px 30px;
  overflow: hidden;            /* locked: no scrollbar, never moves */
  min-height: 0;
}
.sb-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--fg-subtle); }

/* identity block */
.id-top { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 64px; height: 64px; border-radius: var(--radius-pill); flex: none;
  background: linear-gradient(140deg, var(--blurple-400), var(--blurple-600));
  display: grid; place-items: center; position: relative;
  font-family: var(--font-display); font-weight: 800; font-size: 30px; color: #fff;
  box-shadow: var(--shadow-card);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-pill); }
.avatar .presence {
  position: absolute; right: -1px; bottom: -1px; z-index: 2;
  width: 17px; height: 17px; border-radius: 999px;
  background: var(--status-online); border: 3px solid var(--bg);
}
.id-name { font-family: var(--font-display); font-weight: 800; font-size: 24px; letter-spacing: -0.035em; line-height: 1.05; color: var(--fg); }
.id-name em { color: inherit; font-style: normal; }
.id-role { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-subtle); margin-top: 5px; }

.id-greeting {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(1.55rem, 2.2vw, 1.9rem); letter-spacing: -0.04em; line-height: 1.04;
  color: var(--fg); margin: 4px 0 0;
}
.id-greeting .wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.6s var(--ease-out) infinite; }
.id-greeting .greet-last { white-space: nowrap; }
@keyframes wave { 0%,60%,100%{transform:rotate(0)} 12%{transform:rotate(16deg)} 24%{transform:rotate(-8deg)} 36%{transform:rotate(12deg)} 48%{transform:rotate(-4deg)} }
.id-greeting em { color: var(--accent); font-style: normal; }
.id-th { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); letter-spacing: .04em; margin-top: 8px; }
.id-bio { font-size: 14px; line-height: 1.6; color: var(--fg-muted); margin: 14px 0 0; max-width: 38ch; }

/* status pill */
.id-status {
  display: inline-flex; align-items: center; gap: 9px; align-self: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 8px 14px 8px 12px;
  box-shadow: var(--shadow-card);
}
.id-status .dot { width: 9px; height: 9px; }
.id-status b { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.id-status span { font-family: var(--font-mono); font-size: 10px; color: var(--fg-subtle); letter-spacing: .06em; }

/* location + local time line */
.id-meta { display: flex; flex-direction: column; gap: 8px; }
.id-meta-row { display: flex; align-items: center; gap: 8px; color: var(--fg-muted); font-size: 13px; }
.id-meta-row svg { width: 15px; height: 15px; color: var(--fg-subtle); flex: none; }
.id-meta-row .mono { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .03em; color: var(--fg); }
.id-meta-row .clk { margin-left: 10px; }
.id-meta-row .flag { display: inline-flex; align-items: center; }
.id-meta-row .flag svg { border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); display: block; }

/* socials row */
.id-socials { display: grid; grid-template-columns: repeat(6, minmax(0, 44px)); gap: 8px; justify-content: start; }
.soc-ico {
  width: 100%; aspect-ratio: 1; height: auto; border-radius: var(--radius-inner);
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-card); cursor: pointer;
  transition: transform var(--dur) var(--ease-out), background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.soc-ico img { width: 19px; height: 19px; transition: transform var(--dur) var(--ease-spring); }
.soc-ico:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.soc-ico:hover img { transform: scale(1.12); }
.soc-ico:active { transform: scale(0.94); }

/* sidebar footer + actions */
.id-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.id-foot { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-subtle); margin-top: 2px; }

/* ---------------- Theme toggle ---------------- */
.toggle {
  width: 60px; height: 32px; border-radius: 999px; flex: none;
  background: var(--surface-2); border: 1px solid var(--border);
  position: relative; cursor: pointer;
  transition: background var(--dur) var(--ease-out);
}
.toggle .thumb {
  position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 999px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  box-shadow: var(--shadow-card);
  transition: transform var(--dur) var(--ease-spring);
}
.toggle .thumb svg { width: 13px; height: 13px; }
body[data-theme="dark"] .toggle .thumb { transform: translateX(28px); }

/* ---------------- Responsive: unlock to a tall scrolling page ---------------- */
@media (max-width: 920px), (max-height: 660px) {
  body { overflow: auto; }
  #root { height: auto; }
  .app, .app.side-right {
    height: auto; min-height: 100vh;
    display: flex; flex-direction: column;
    overflow: visible;
  }
  .brand { padding: 18px 20px 6px; }
  .topnav { padding: 4px 20px 12px; overflow-x: auto; }
  .topnav::-webkit-scrollbar { display: none; }
  .sidebar {
    height: auto; overflow: visible; padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
  }
  .id-bio { max-width: none; }
  .bento {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: none;
    grid-template-areas: none;
    grid-auto-rows: minmax(184px, auto);
    overflow: visible;
    padding: 18px 20px 36px;
  }
  .bento > * { grid-area: auto !important; }
  .b-now, .b-discord, .b-building, .b-blog, .b-kofi { grid-column: span 2; }
  .b-github { grid-column: span 2; grid-row: span 2; }
  .b-photo1, .b-photo2 { grid-row: span 2; }   /* portrait photo cards */
}
@media (max-width: 540px) {
  .bento { grid-template-columns: 1fr; grid-auto-rows: minmax(172px, auto); }
  .bento > * { grid-column: span 1 !important; }
  .b-github { grid-row: span 2; }
}

/* ---------------- Card base ---------------- */
.card {
  position: relative; z-index: 2;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--pad-card);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-height: 0; min-width: 0;
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}
.motion-on .card { animation: rise var(--dur-slow) var(--ease-out) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
.card.lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--border-strong); }

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: auto; gap: 10px; }
.icotile {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.icotile svg { width: 17px; height: 17px; }

/* shared dot + pulse */
.dot { width: 9px; height: 9px; border-radius: 999px; flex: none; }
.dot.pulse { box-shadow: 0 0 0 0 rgba(35,165,90,0.5); animation: pulse 2.2s var(--ease-out) infinite; }
@keyframes pulse { 70%,100% { box-shadow: 0 0 0 10px transparent; } }

/* reduced motion / motion-off */
@media (prefers-reduced-motion: reduce) {
  .card { animation: none !important; }
  .eq.on i, .wave, .dot.pulse, .gh-cell.lit { animation: none !important; }
}
.motion-off .card { animation: none !important; }
.motion-off .eq.on i, .motion-off .wave, .motion-off .dot.pulse { animation: none !important; }
