/* =============================================================================
   Khurram Rashid · Portfolio — design layer
   Palette and type follow Ibtidaa Tech's brand: navy ink, logo blue, and the
   teal → saffron "beginning line" from the letterhead. Teal leads here.
   Type: Source Serif 4 (headings), Source Sans 3 (text), Source Code Pro (labels).
============================================================================= */

@font-face { font-family: 'Source Serif 4'; src: url('/assets/fonts/source-serif-4.woff2') format('woff2'); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url('/assets/fonts/source-sans-3.woff2') format('woff2'); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url('/assets/fonts/source-sans-3-italic.woff2') format('woff2'); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Source Code Pro'; src: url('/assets/fonts/source-code-pro-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --ink: #0f2340;
  --text: #24344d;
  --slate: #56647c;
  --paper: #f6f7f9;
  --card: #ffffff;
  --hairline: #dce2ea;
  --hairline-strong: #c7d0dc;
  --teal: #1f8f86;            /* decorative teal (letterhead) */
  --accent: #16756e;          /* teal for text & buttons, AA on white */
  --on-accent: #ffffff;
  --accent-soft: rgba(31, 143, 134, .10);
  --saffron: #e3a92b;
  --saffron-ink: #8a5a00;
  --saffron-soft: rgba(227, 169, 43, .16);
  --brand: #1f4e95;           /* Ibtidaa logo blue */
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(15, 35, 64, .05), 0 8px 24px -12px rgba(15, 35, 64, .18);
  --shadow-lg: 0 2px 6px rgba(15, 35, 64, .06), 0 24px 48px -20px rgba(15, 35, 64, .28);

  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'Source Code Pro', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --line: linear-gradient(90deg, var(--teal) 0 50%, var(--saffron) 50% 100%);
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 20px;
  --top: 62px;
  --tab: 64px;
  color-scheme: light;
}

[data-theme='dark'] {
  --ink: #eaf0f8;
  --text: #cdd6e4;
  --slate: #9fadc2;
  --paper: #0b1a30;
  --card: #10223e;
  --hairline: #22375a;
  --hairline-strong: #2e4670;
  --teal: #4cc3b6;
  --accent: #4cc3b6;
  --on-accent: #052a26;
  --accent-soft: rgba(76, 195, 182, .13);
  --saffron: #f0c35a;
  --saffron-ink: #f0c35a;
  --saffron-soft: rgba(240, 195, 90, .14);
  --brand: #8db6f0;
  --danger: #ff8a80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .35), 0 28px 56px -24px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--top) + 12px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font-family: var(--sans); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .25s ease, color .25s ease;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { color: var(--ink); margin: 0; line-height: 1.2; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--saffron-soft); color: var(--ink); }
code { font-family: var(--mono); font-size: .88em; background: var(--accent-soft); padding: .1em .35em; border-radius: 5px; }

.wrap { width: 100%; max-width: 1140px; margin-inline: auto; padding-inline: clamp(18px, 5vw, 40px); }
.muted { color: var(--slate); }
.small { font-size: .88rem; }
.err { color: var(--danger); }
.i { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.18em; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 12px; }

.rule { display: block; width: 76px; height: 3px; border-radius: 3px; background: var(--line); }
.rule-sm { width: 44px; height: 2px; }
.kicker { display: inline-flex; align-items: center; gap: .45em; font-family: var(--mono); font-size: .8rem; color: var(--accent); letter-spacing: .02em; }
.kicker .i { width: 1em; height: 1em; }

.skeleton { border-radius: var(--r); background: linear-gradient(90deg, var(--hairline) 0%, var(--card) 50%, var(--hairline) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; opacity: .6; }
@keyframes shimmer { to { background-position: -200% 0; } }

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: .55em 1.1em; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .96rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px -8px rgba(22, 117, 110, .7); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--hairline-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-brand { background: transparent; color: var(--brand); border-color: currentColor; }
.btn-brand:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.btn-sm { min-height: 36px; padding: .4em .9em; font-size: .88rem; }
.btn:disabled { opacity: .6; cursor: progress; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 999px;
  background: transparent; border: 1px solid var(--hairline); color: var(--ink); text-decoration: none;
  transition: border-color .15s, color .15s, background-color .15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn .i { width: 19px; height: 19px; }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.tlink { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; display: inline-flex; align-items: center; gap: .3em; font-size: .95rem; }
.tlink .i { width: .95em; height: .95em; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent; transition: border-color .2s, box-shadow .2s;
}
.topbar.scrolled { border-bottom-color: var(--hairline); }
.topbar-in { height: 100%; display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.mono-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--ink); color: var(--paper); font-family: var(--serif); font-weight: 700; font-size: 14px; letter-spacing: .02em;
  position: relative; overflow: hidden;
}
.mono-mark::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.08rem; }
.topnav { display: none; margin-left: auto; gap: 4px; }
.topnav a { color: var(--slate); text-decoration: none; font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: 999px; transition: color .15s, background-color .15s; }
.topnav a:hover { color: var(--ink); }
.topnav a.active { color: var(--accent); background: var(--accent-soft); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .topbar-actions { margin-left: 8px; }
}

/* ---------------------------------------------------------------- hero */
.hero { padding: clamp(28px, 6vw, 72px) 0 clamp(28px, 5vw, 56px); }
.hero-grid { display: grid; gap: 28px; align-items: center; }
.hero-main { min-width: 0; }
.avail {
  display: inline-flex; align-items: center; gap: 9px; font-size: .9rem; font-weight: 600; color: var(--ink);
  background: var(--card); border: 1px solid var(--hairline); padding: 6px 14px 6px 12px; border-radius: 999px; margin-bottom: 20px;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 rgba(31, 143, 134, .5); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 143, 134, .45); } 70% { box-shadow: 0 0 0 9px rgba(31, 143, 134, 0); } 100% { box-shadow: 0 0 0 0 rgba(31, 143, 134, 0); } }
.hero-name { font-size: clamp(2.6rem, 8.5vw, 4.8rem); line-height: 1.02; letter-spacing: -0.025em; font-weight: 650; font-variation-settings: 'opsz' 60; }
.hero .rule { margin: 18px 0 16px; width: 96px; height: 4px; }
.hero-roles { font-family: var(--mono); font-size: .9rem; color: var(--accent); margin-bottom: 14px; }
.hero-headline { font-size: clamp(1.12rem, 2.4vw, 1.32rem); line-height: 1.5; color: var(--text); max-width: 46ch; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 16px; color: var(--slate); font-size: .95rem; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.venture-link { color: var(--brand); font-weight: 600; text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--brand) 40%, transparent); }
.venture-link:hover { border-bottom-color: var(--brand); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-social { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero-photo { margin: 0 0 4px; justify-self: start; width: min(34vw, 136px); position: relative; order: -1; }
[data-theme='dark'] .hero-photo img { filter: brightness(.92); }
.hero-photo img { width: 100%; height: auto; aspect-ratio: 419 / 596; object-fit: cover; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--hairline); box-shadow: var(--shadow); position: relative; z-index: 1; }
.hero-photo::before { content: ''; position: absolute; inset: 10px -10px -10px 10px; border-radius: var(--r-lg); border: 1.5px solid var(--teal); opacity: .55; }
.hero-photo::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: -10px; height: 4px; border-radius: 4px; background: var(--line); z-index: 2; }
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1.55fr) minmax(0, .8fr); gap: 56px; }
  .hero-photo { order: 0; justify-self: end; width: 100%; max-width: 330px; }
  .hero-photo::before { inset: 14px -14px -14px 14px; }
  .hero-photo::after { left: 22px; right: 22px; bottom: -14px; }
}

.glance {
  margin: clamp(32px, 6vw, 56px) 0 0; display: grid; grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--hairline); border-left: 1px solid var(--hairline);
  background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow);
}
.glance-item { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 2px; padding: 16px 18px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.glance dd { margin: 0; font-family: var(--serif); font-weight: 650; font-size: clamp(1.5rem, 4vw, 2rem); color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.glance dt { font-size: .86rem; color: var(--slate); }
@media (min-width: 620px) { .glance { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1040px) { .glance { grid-template-columns: repeat(6, 1fr); } }

/* ---------------------------------------------------------------- about */
.about { padding: clamp(40px, 7vw, 80px) 0; border-top: 1px solid var(--hairline); }
.about-grid { display: grid; gap: 28px; }
.about-text .kicker { margin-bottom: 14px; }
.about-bio { font-family: var(--serif); font-size: clamp(1.18rem, 2.4vw, 1.42rem); line-height: 1.55; color: var(--ink); font-weight: 400; max-width: 46ch; }
.venture { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow); align-self: start; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.wordmark { font-family: var(--serif); font-size: 1.9rem; font-weight: 700; color: var(--brand); letter-spacing: -0.01em; line-height: 1.1; }
.venture-logo { max-height: 56px; width: auto; }
.venture-tag { font-family: var(--serif); font-style: italic; color: var(--ink); font-size: 1.08rem; }
.venture-desc { color: var(--slate); font-size: .98rem; }
.venture .btn { margin-top: 6px; }
@media (min-width: 900px) { .about-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 56px; align-items: start; } }

/* ---------------------------------------------------------------- sections */
.sec { padding: clamp(48px, 8vw, 96px) 0; border-top: 1px solid var(--hairline); }
.sec-head { position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: baseline; margin-bottom: clamp(22px, 4vw, 36px); padding-right: 84px; }
.sec-num { font-family: var(--mono); font-size: .85rem; color: var(--accent); display: inline-flex; align-items: center; }
.sec-num .i { width: 1.1em; height: 1.1em; }
.sec-head h2 { font-size: clamp(1.75rem, 4.2vw, 2.5rem); }
.sec-intro { grid-column: 1 / -1; color: var(--slate); margin-top: 10px; max-width: 62ch; }
.sec-head::after { content: ''; grid-column: 1 / -1; display: block; width: 56px; height: 3px; border-radius: 3px; background: var(--line); margin-top: 16px; }
.sec-head-mini { display: flex; align-items: center; margin-bottom: 16px; }
.sec-head-mini::after { display: none; }
.sec-edit { position: absolute; right: 0; top: 0; display: none; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--saffron-ink); background: var(--saffron-soft); border: 1px dashed var(--saffron); border-radius: 999px; padding: 5px 12px; }
.is-admin .sec-edit { display: inline-flex; }
.sec-spotlight { padding-top: clamp(32px, 5vw, 56px); }

/* spotlight */
.spot { position: relative; background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: clamp(22px, 4vw, 36px); box-shadow: var(--shadow-lg); overflow: hidden; }
.spot::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(180deg, var(--teal) 0 50%, var(--saffron) 50% 100%); }
.spot + .spot { margin-top: 16px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .82rem; color: var(--saffron-ink); background: var(--saffron-soft); border-radius: 999px; padding: 5px 12px; margin-bottom: 14px; }
.spot-title { font-family: var(--serif); font-weight: 600; font-size: clamp(1.4rem, 3.4vw, 1.9rem); letter-spacing: -0.01em; }
.spot-meta { font-family: var(--mono); font-size: .84rem; color: var(--slate); margin-top: 8px; }
.spot-desc { margin-top: 14px; max-width: 72ch; }
.spot-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* experience */
.xp { list-style: none; margin: 0; padding: 0; }
.xp-item { display: grid; gap: 6px 32px; padding: 24px 0; border-top: 1px solid var(--hairline); }
.xp-item:first-child { border-top: 0; padding-top: 0; }
.xp-when { display: flex; flex-wrap: wrap; gap: 2px 12px; font-family: var(--mono); font-size: .84rem; color: var(--slate); }
.xp-place { color: var(--slate); opacity: .85; }
.xp-body h3 { font-size: 1.18rem; font-weight: 700; }
.xp-org { color: var(--accent); font-weight: 600; margin-top: 2px; }
.xp-body ul { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.xp-body li { position: relative; padding-left: 20px; }
.xp-body li::before { content: ''; position: absolute; left: 0; top: .72em; width: 10px; height: 2px; background: var(--teal); border-radius: 2px; }
.xp-link { margin-top: 10px; }
@media (min-width: 760px) {
  .xp-item { grid-template-columns: 210px minmax(0, 1fr); }
  .xp-when { flex-direction: column; padding-top: 3px; }
}

/* pills */
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 14px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.pill { flex: none; border: 1px solid var(--hairline-strong); background: var(--card); color: var(--text); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: .9rem; transition: all .15s; }
.pill span { color: var(--slate); font-weight: 500; margin-left: 2px; }
.pill:hover { border-color: var(--accent); }
.pill.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pill.active span { color: color-mix(in srgb, var(--paper) 70%, transparent); }

/* project cards */
.pgrid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.pcard {
  display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--hairline);
  border-radius: var(--r); padding: 22px; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.pcard:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--hairline)); box-shadow: var(--shadow); transform: translateY(-2px); }
.pcard-tag { font-family: var(--mono); font-size: .78rem; color: var(--accent); }
.pcard h3 { font-family: var(--serif); font-weight: 600; font-size: 1.32rem; letter-spacing: -0.005em; }
.metrics { display: flex; flex-wrap: wrap; gap: 6px; }
.metrics span { font-size: .8rem; font-weight: 600; color: var(--saffron-ink); background: var(--saffron-soft); border-radius: 6px; padding: 3px 8px; }
.pcard-desc { color: var(--text); font-size: .97rem; }
.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.clamp.open { -webkit-line-clamp: unset; display: block; }
.more { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; font-size: .9rem; margin-top: -4px; }
.stack { display: flex; flex-wrap: wrap; gap: 4px 6px; font-family: var(--mono); font-size: .76rem; color: var(--slate); }
.stack span { border: 1px solid var(--hairline); border-radius: 6px; padding: 2px 7px; }
.pcard-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.pcard-links:empty { display: none; }

/* ---------------------------------------------------------------- github */
.gh-top { display: grid; gap: 16px; margin-bottom: 22px; }
@media (min-width: 900px) { .gh-top { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.card { background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.streak-nums { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 28px; margin: 12px 0 16px; }
.streak-nums > div { display: flex; flex-direction: column; }
.streak-nums .big { font-family: var(--serif); font-weight: 700; font-size: 3rem; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.streak-nums .mid { font-family: var(--serif); font-weight: 650; font-size: 1.6rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.streak-nums .lbl { font-size: .84rem; color: var(--slate); }
.heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; max-width: 520px; }
.heat i { aspect-ratio: 1; border-radius: 2.5px; background: var(--hairline); }
.heat .pad { visibility: hidden; }
.heat .h1 { background: color-mix(in srgb, var(--teal) 30%, var(--hairline)); }
.heat .h2 { background: color-mix(in srgb, var(--teal) 55%, var(--hairline)); }
.heat .h3 { background: color-mix(in srgb, var(--teal) 80%, var(--hairline)); }
.heat .h4 { background: var(--teal); }
.bars { display: flex; align-items: stretch; gap: 8px; height: 130px; margin: 14px 0 10px; }
.bar { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; background: none; border: 0; padding: 0; color: var(--slate); }
.bar-fill { display: flex; align-items: flex-start; justify-content: center; height: max(var(--h), 16%); background: var(--accent-soft); border-top: 3px solid var(--teal); border-radius: 6px 6px 2px 2px; transition: background-color .15s; }
.bar-n { font-family: var(--mono); font-size: .78rem; color: var(--ink); margin-top: 4px; }
.bar-y { font-family: var(--mono); font-size: .76rem; }
.bar:hover .bar-fill { background: color-mix(in srgb, var(--teal) 25%, transparent); }
.bar.on .bar-fill { background: var(--accent); border-top-color: var(--saffron); }
.bar.on .bar-n { color: var(--on-accent); }
.bar.on .bar-y { color: var(--accent); font-weight: 600; }

.gh-controls { display: grid; gap: 12px; margin-bottom: 6px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--hairline-strong); border-radius: 12px; padding: 0 14px; min-height: 48px; color: var(--slate); transition: border-color .15s, box-shadow .15s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 12px 0; color: var(--ink); }
.gh-selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
select {
  appearance: none; -webkit-appearance: none; min-height: 44px; border: 1px solid var(--hairline-strong); border-radius: 12px; background: var(--card);
  padding: 0 34px 0 12px; color: var(--ink); font-size: .92rem; width: 100%;
  background-image: linear-gradient(45deg, transparent 50%, var(--slate) 50%), linear-gradient(135deg, var(--slate) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
@media (min-width: 900px) { .gh-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } .gh-controls .pills { grid-column: 1 / -1; } }
.gh-count { font-size: .9rem; color: var(--slate); margin: 2px 0 14px; }
.rgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.rcard { display: flex; flex-direction: column; gap: 8px; background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r); padding: 18px; transition: border-color .2s, box-shadow .2s; min-width: 0; }
.rcard:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--hairline)); box-shadow: var(--shadow); }
.rcard-head { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.rcard-title { color: var(--ink); font-weight: 700; font-size: 1.02rem; text-decoration: none; overflow-wrap: anywhere; line-height: 1.3; }
.rcard-title:hover { color: var(--accent); text-decoration: underline; }
.tag-pin { flex: none; font-size: .72rem; font-weight: 700; color: var(--saffron-ink); background: var(--saffron-soft); border-radius: 999px; padding: 2px 8px; }
.rcard-desc { font-size: .92rem; color: var(--slate); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.topics { display: flex; flex-wrap: wrap; gap: 5px; }
.topics span { font-size: .74rem; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; }
.rcard-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: .82rem; color: var(--slate); margin-top: auto; }
.rcard-foot > span { display: inline-flex; align-items: center; gap: 5px; }
.lang i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cat { font-family: var(--mono); font-size: .75rem; border: 1px solid var(--hairline); border-radius: 6px; padding: 1px 7px; }
.rcard-links { display: flex; gap: 16px; padding-top: 10px; border-top: 1px dashed var(--hairline); }
.rcard-links a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .9rem; text-decoration: none; }
.rcard-links a:hover { text-decoration: underline; }
.gh-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.empty { grid-column: 1 / -1; text-align: center; color: var(--slate); padding: 28px; border: 1px dashed var(--hairline-strong); border-radius: var(--r); }

/* ---------------------------------------------------------------- skills */
.skills { display: grid; gap: 0; grid-template-columns: 1fr; border-top: 1px solid var(--hairline); }
.skill { display: grid; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--hairline); }
.skill h3 { font-family: var(--mono); font-weight: 500; font-size: .84rem; color: var(--slate); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { display: inline-flex; align-items: center; font-size: .9rem; color: var(--ink); background: var(--card); border: 1px solid var(--hairline); border-radius: 8px; padding: 4px 10px; text-decoration: none; }
a.chip:hover { border-color: var(--accent); color: var(--accent); }
@media (min-width: 760px) { .skill { grid-template-columns: 200px minmax(0, 1fr); align-items: baseline; gap: 24px; } }

/* ---------------------------------------------------------------- timeline */
.tl { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.tl-item { display: grid; gap: 4px 28px; padding: 18px 0; border-top: 1px solid var(--hairline); }
.tl-item:first-child { border-top: 0; padding-top: 0; }
.tl-meta { font-family: var(--mono); font-size: .82rem; color: var(--accent); padding-top: 3px; }
.tl-body h3 { font-size: 1.1rem; font-weight: 700; }
.tl-body p { color: var(--slate); margin-top: 4px; }
.tl-body .tlink { margin-top: 8px; }
@media (min-width: 760px) { .tl-item { grid-template-columns: 160px minmax(0, 1fr); } }

/* grouped list */
.groups { display: grid; gap: 28px; }
@media (min-width: 760px) { .groups { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 40px; } }
.group-title { font-family: var(--mono); font-weight: 500; font-size: .88rem; color: var(--slate); margin-bottom: 10px; display: flex; gap: 8px; }
.group-title span { color: var(--accent); }
.glist { list-style: none; padding: 0; margin: 0; }
.glist li { padding: 10px 0 10px 20px; border-top: 1px solid var(--hairline); position: relative; }
.glist li::before { content: ''; position: absolute; left: 0; top: 1.15em; width: 8px; height: 8px; border-radius: 2px; background: var(--accent-soft); border: 1.5px solid var(--teal); }

/* tiles */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }
.tile { display: flex; flex-direction: column; gap: 4px; background: var(--card); border: 1px solid var(--hairline); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--text); transition: border-color .2s, transform .2s, box-shadow .2s; min-width: 0; }
a.tile:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tile-meta { font-family: var(--mono); font-size: .74rem; color: var(--slate); }
.tile-ic { color: var(--accent); width: 16px; height: 16px; }
.tile-title { font-weight: 700; color: var(--ink); line-height: 1.3; }
.tile-desc { font-size: .88rem; color: var(--slate); }
.tile-cta { font-size: .85rem; font-weight: 600; color: var(--accent); margin-top: 4px; }
.tile-off { opacity: .75; }
.show-all { margin-top: 18px; }

/* ---------------------------------------------------------------- contact */
.contact-grid { display: grid; gap: 28px; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.2fr); gap: 56px; } }
.contact-side { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.mail-row { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.mail { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.05rem; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; min-width: 0; }
.mail .i { color: var(--accent); }
.mail:hover span { text-decoration: underline; }
.copy { width: auto; height: 34px; padding: 0 12px; font-size: .82rem; font-weight: 600; gap: 6px; display: inline-flex; }
.copy .copied-ic { display: none; width: 15px; height: 15px; }
.copy.done .copied-ic { display: inline; color: var(--accent); }
.copy.done .copy-txt::after { content: 'ied'; }
.contact-social { display: flex; flex-wrap: wrap; gap: 8px; }
.cform { display: grid; gap: 14px; background: var(--card); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: clamp(18px, 4vw, 28px); box-shadow: var(--shadow); }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: .92rem; color: var(--ink); }
.field input, .field textarea, .f input, .f textarea, .adm-new input, .adm-form input, .row2 input {
  width: 100%; border: 1px solid var(--hairline-strong); border-radius: 10px; background: var(--paper); color: var(--ink);
  padding: 11px 13px; font-size: 1rem; transition: border-color .15s, box-shadow .15s;
}
.field textarea, .f textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.field input:focus, .field textarea:focus, .f input:focus, .f textarea:focus, .row2 input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cform-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.cform-msg { font-size: .92rem; color: var(--slate); }
.cform-msg.ok { color: var(--accent); font-weight: 600; }
.cform-msg.err { color: var(--danger); }

/* ---------------------------------------------------------------- footer */
.foot { border-top: 1px solid var(--hairline); padding: 36px 0 calc(36px + var(--tab) + env(safe-area-inset-bottom)); background: var(--card); }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 22px; align-items: flex-start; }
.foot-name { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--ink); margin-bottom: 8px; }
.foot .rule { margin-bottom: 10px; }
.foot-right { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.foot-social { display: flex; gap: 8px; flex-wrap: wrap; }
.foot-links { display: flex; gap: 18px; }
.foot-links .tlink { color: var(--slate); font-weight: 500; }
@media (min-width: 900px) { .foot { padding-bottom: 36px; } .foot-right { align-items: flex-end; } }

/* ---------------------------------------------------------------- tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--card) 90%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--hairline);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--slate); text-decoration: none; font-size: .72rem; font-weight: 600; -webkit-tap-highlight-color: transparent; }
.tabbar .i { width: 22px; height: 22px; }
.tabbar a.active { color: var(--accent); }
.tabbar a.active::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--line); }
@media (min-width: 900px) { .tabbar { display: none; } }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab) + 16px + env(safe-area-inset-bottom)); z-index: 80; display: grid; gap: 8px; width: min(92vw, 460px); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { pointer-events: auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--ink); color: var(--paper); border-radius: 12px; padding: 12px 14px 12px 16px; font-size: .94rem; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
.toast.in { opacity: 1; transform: none; }
.toast-btn { flex: none; background: var(--teal); color: #fff; border: 0; border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: .86rem; }
[data-theme='dark'] .toast-btn { color: var(--on-accent); }

/* ---------------------------------------------------------------- admin */
.admin-only { display: none; }
.adminbar { position: fixed; right: 14px; bottom: calc(var(--tab) + 14px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--saffron); border-radius: 999px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow-lg); }
@media (min-width: 900px) { .adminbar { bottom: 20px; right: 20px; } }
.adminbar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--saffron); }
.adminbar-txt { font-weight: 700; font-size: .86rem; color: var(--ink); }
.adminbar .icon-btn { width: 36px; height: 36px; }

.drawer-wrap { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(8, 18, 34, .45); opacity: 0; transition: opacity .25s; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(680px, 100%); background: var(--paper); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-lg); }
.drawer-wrap.open { pointer-events: auto; }
.drawer-wrap.open .drawer-scrim { opacity: 1; }
.drawer-wrap.open .drawer { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top)) 18px 10px; border-bottom: 1px solid var(--hairline); background: var(--card); }
.drawer-head h2 { font-size: 1.35rem; }
.drawer-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--hairline); }
.drawer-tabs button { flex: none; background: none; border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 600; color: var(--slate); }
.drawer-tabs button.active { background: var(--ink); color: var(--paper); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 18px calc(40px + env(safe-area-inset-bottom)); display: grid; gap: 14px; align-content: start; overscroll-behavior: contain; }
.drawer-body h3 { font-size: 1.05rem; margin-bottom: 6px; }
.notice { background: var(--card); border: 1px solid var(--saffron); border-radius: var(--r); padding: 20px; display: grid; gap: 12px; justify-items: start; }
.adm-list { display: grid; gap: 10px; }
.adm-sec { background: var(--card); border: 1px solid var(--hairline); border-radius: 12px; }
.adm-sec[open] { border-color: var(--accent); }
.adm-sec summary { display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none; font-weight: 600; color: var(--ink); }
.adm-sec summary::-webkit-details-marker { display: none; }
.adm-n { font-family: var(--mono); font-size: .8rem; color: var(--accent); }
.adm-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-type { font-size: .76rem; color: var(--slate); font-weight: 500; }
.adm-hidden { font-size: .72rem; color: var(--saffron-ink); background: var(--saffron-soft); border-radius: 999px; padding: 2px 8px; }
.adm-sec-body { padding: 0 16px 16px; display: grid; gap: 12px; }
.adm-items { display: grid; gap: 12px; }
.adm-item { margin: 0; border: 1px solid var(--hairline); border-radius: 10px; padding: 12px; display: grid; gap: 10px; background: var(--paper); min-width: 0; }
.adm-item-fields { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .adm-item-fields { grid-template-columns: 1fr 1fr; } .adm-item-fields .wide { grid-column: 1 / -1; } }
.adm-item-actions { display: flex; gap: 6px; justify-content: flex-end; }
.adm-item-actions .icon-btn, .adm-actions .icon-btn { width: 36px; height: 36px; }
.f { display: grid; gap: 5px; min-width: 0; }
.f > span { font-size: .8rem; font-weight: 600; color: var(--slate); }
.f input, .f textarea { background: var(--card); font-size: .95rem; padding: 9px 11px; }
.f textarea { min-height: 80px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; font-weight: 600; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.f.check { display: flex; align-self: end; padding-bottom: 8px; }
.row2 { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .row2 { grid-template-columns: 1fr 1fr; } }
.row2 input { background: var(--card); padding: 9px 11px; font-size: .95rem; }
.adm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.adm-actions.sticky { position: sticky; bottom: -40px; background: var(--paper); padding: 12px 0; }
.adm-status { font-size: .86rem; color: var(--accent); font-weight: 600; }
.adm-new { background: var(--card); border: 1px dashed var(--hairline-strong); border-radius: 12px; padding: 16px; display: grid; gap: 10px; justify-items: start; }
.adm-new .row2 { width: 100%; }
.adm-new input { background: var(--paper); padding: 9px 11px; }
.adm-form { display: grid; gap: 12px; }
.adm-form input { background: var(--card); }
.adm-stats { display: grid; gap: 8px; }
.adm-repos { display: grid; gap: 10px; }
.adm-repo { background: var(--card); border: 1px solid var(--hairline); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.adm-repo-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.adm-repo-head a { font-weight: 700; color: var(--ink); }
.adm-repo-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.adm-msgs { display: grid; gap: 10px; }
.adm-msg { background: var(--card); border: 1px solid var(--hairline); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.adm-msg.unread { border-left: 4px solid var(--teal); }
.adm-msg header { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.adm-msg p { white-space: normal; overflow-wrap: anywhere; }
.adm-block { background: var(--card); border: 1px solid var(--hairline); border-radius: 12px; padding: 16px; display: grid; gap: 10px; }

/* ---------------------------------------------------------------- 404 */
.nf { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 48px 20px; }
.nf h1 { font-size: clamp(3rem, 12vw, 6rem); }
.nf .rule { margin: 14px auto 18px; }
.nf p { color: var(--slate); margin-bottom: 22px; }

/* ---------------------------------------------------------------- print */
@media print {
  .topbar, .tabbar, .toasts, .adminbar, .cform, .gh-controls, .gh-more, .hero-cta { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .reveal { opacity: 1; transform: none; }
  .sec { padding: 18pt 0; }
}
