/* ============================================================
   bugsv2.com, Fares Walid (SirBugs)
   Shared theme: homepage + blog index. Dark by default.
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #fafafa;
  --bg-soft: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --ink: #0b0b0e;
  --ink-2: #52525b;
  --ink-3: #7c7c86;
  --line: #e4e4e7;
  --line-2: #eeeef1;
  --accent: #d10f24;
  --accent-2: #a80c1d;
  --accent-soft: #fdecee;
  --ring: rgba(209, 15, 36, .22);
  --nav: rgba(250, 250, 250, .84);
  --glow: rgba(209, 15, 36, .08);
  --shadow: rgba(12, 12, 18, .14);
  --shadow-soft: rgba(12, 12, 18, .06);
  --hover: #f4f4f5;
  --code: #101014;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08080a;
  --bg-soft: #0b0b0f;
  --surface: #101014;
  --surface-2: #131318;
  --ink: #f4f4f5;
  --ink-2: #a5a5b0;
  --ink-3: #767680;
  --line: #222228;
  --line-2: #191920;
  --accent: #ff2b3d;
  --accent-2: #ff5a6a;
  --accent-soft: rgba(255, 43, 61, .12);
  --ring: rgba(255, 43, 61, .3);
  --nav: rgba(8, 8, 10, .8);
  --glow: rgba(255, 43, 61, .12);
  --shadow: rgba(0, 0, 0, .55);
  --shadow-soft: rgba(0, 0, 0, .32);
  --hover: #1a1a20;
  --code: #0d0d12;
}

html { background: var(--bg); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16.5px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(820px 420px at 78% -8%, var(--glow), transparent 66%),
    radial-gradient(520px 300px at -8% 4%, var(--glow), transparent 72%);
}

body::after {
  content: "";
  position: fixed;
  inset: -1px;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--line-2) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line-2) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: .42;
  -webkit-mask-image: radial-gradient(ellipse 82% 54% at 50% 0%, #000 0%, transparent 76%);
  mask-image: radial-gradient(ellipse 82% 54% at 50% 0%, #000 0%, transparent 76%);
}

::selection { background: var(--accent); color: #fff; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

html { scroll-padding-top: 84px; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }

.skip {
  position: absolute; left: -9999px; top: 10px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px;
  font: 600 13px var(--font-mono);
}
.skip:focus { left: 16px; }

/* ---------------------------------------------------------- top bar */
.top {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
}
.top-in { height: 54px; display: flex; align-items: center; gap: 14px; }

.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand .avatar {
  width: 30px; height: 30px; flex: 0 0 auto; overflow: hidden;
  border-radius: 50%; background: var(--ink);
  border: 1px solid var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.brand .avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; }
.brand b { font: 600 15px/1 var(--font-head); letter-spacing: -.01em; white-space: nowrap; }

.chip {
  flex: 0 0 auto; padding: 4px 8px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--ring);
  font: 600 10.5px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase;
}

.top-nav { margin-left: auto; display: flex; align-items: center; gap: 3px; }
.top-nav .navlink {
  padding: 7px 12px; border-radius: 7px; color: var(--ink-2);
  font: 500 14px/1 var(--font-body);
}
.top-nav .navlink:hover { color: var(--ink); background: var(--hover); text-decoration: none; }
.top-nav .navlink[aria-current="page"] { color: var(--ink); background: var(--hover); }

.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 8px; background: none; color: var(--ink-2); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { color: var(--ink); background: var(--surface); text-decoration: none; }
.icon-btn svg { width: 15px; height: 15px; fill: currentColor; }
.nav-sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; flex: 0 0 auto; }

.theme-btn svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.theme-btn .ic-sun { display: none; }
html[data-theme="dark"] .theme-btn .ic-sun { display: block; }
html[data-theme="dark"] .theme-btn .ic-moon { display: none; }

/* ---------------------------------------------------------- hero */
main { position: relative; z-index: 1; }

.intro { max-width: 860px; padding: clamp(56px, 9vw, 96px) 0 20px; }

.intro-head { display: flex; align-items: center; gap: 30px; }

.avatar-large {
  width: clamp(86px, 12vw, 112px); height: clamp(86px, 12vw, 112px);
  flex: 0 0 auto; border-radius: 50%; object-fit: cover; object-position: 50% 32%;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 6px var(--accent-soft), 0 24px 60px -26px var(--shadow);
}

.eyebrow {
  margin: 0 0 16px; color: var(--accent);
  font: 600 11px/1 var(--font-mono); letter-spacing: .17em; text-transform: uppercase;
}

h1 {
  margin: 0; color: var(--ink);
  font: 700 clamp(40px, 7vw, 66px)/1.02 var(--font-head); letter-spacing: -.042em;
}
h1 .alias {
  display: inline-block; margin-left: 8px; padding: 7px 12px;
  transform: translateY(-6px);
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--ring); border-radius: 999px;
  font: 600 clamp(12px, 1.5vw, 15px)/1 var(--font-mono); letter-spacing: .01em;
}

.role {
  display: inline-flex; align-items: center; flex-wrap: wrap; gap: 9px;
  margin: 18px 0 0; color: var(--ink-2);
  font: 500 13px/1.4 var(--font-mono); letter-spacing: .01em;
}
.role .role-dot {
  width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
.role strong { color: var(--ink); font-weight: 600; }

.tagline {
  max-width: 650px; margin: 18px 0 0; color: var(--ink-2);
  font: 400 clamp(17.5px, 2.1vw, 21px)/1.55 var(--font-body);
}

.bio {
  max-width: 710px; margin: 28px 0 0; color: var(--ink-2);
  font-size: 16.5px;
}
.bio strong { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------- account cards */
.accounts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px; max-width: 500px; margin: 34px 0 0;
}
.account {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 15px; border: 1px solid var(--line); border-radius: 13px;
  background: var(--surface); color: var(--ink);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.account:hover {
  transform: translateY(-2px);
  border-color: var(--accent); text-decoration: none;
  box-shadow: 0 16px 38px -28px var(--shadow);
}
.account .ic {
  width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 9px; background: var(--accent-soft); color: var(--accent);
}
.account .ic svg { width: 16px; height: 16px; fill: currentColor; }
.account small {
  display: block; margin-bottom: 4px; color: var(--ink-3);
  font: 500 9.5px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase;
}
.account b { display: block; color: var(--ink); font: 600 13px/1.2 var(--font-mono); }
.account .arrow { margin-left: auto; color: var(--ink-3); font: 500 13px var(--font-mono); }
.account:hover .arrow { color: var(--accent); }

.status {
  display: inline-flex; align-items: center; gap: 10px; margin: 30px 0 0;
  color: var(--ink-3); font: 500 12px/1.4 var(--font-mono); letter-spacing: .02em;
}
.status .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--ring); animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--ring); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------------------------------------------------------- sections */
.section { padding: 84px 0 104px; }

.section-rule {
  height: 1px; margin-bottom: 34px;
  background: linear-gradient(90deg, var(--accent), var(--line) 24%, var(--line));
}

.section-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 26px; }
.section-head .eyebrow { margin: 0 0 11px; }
.section-head h2 {
  margin: 0; color: var(--ink);
  font: 700 clamp(28px, 4vw, 40px)/1.08 var(--font-head); letter-spacing: -.032em;
}
.section-head .count {
  margin-bottom: 6px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-3); font: 500 10.5px/1 var(--font-mono); letter-spacing: .06em;
}
.section-head .all {
  margin-left: auto; margin-bottom: 6px; color: var(--ink-3);
  font: 500 11px/1 var(--font-mono); letter-spacing: .09em; text-transform: uppercase;
}
.section-head .all:hover { color: var(--accent); text-decoration: none; }

/* ---------------------------------------------------------- post card */
.card {
  position: relative; display: flex; flex-direction: column;
  overflow: hidden; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface);
  transition: border-color .2s ease, box-shadow .25s ease, transform .25s ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--ring);
  box-shadow: 0 30px 70px -42px var(--shadow), 0 0 0 1px var(--ring);
}
.card .cover {
  position: relative; display: block; overflow: hidden;
  background: var(--code); aspect-ratio: 2 / 1;
}
.card .cover img {
  width: 100%; height: 100%; object-fit: cover; object-position: center;
}
.card-body {
  display: flex; flex-direction: column; gap: 12px;
  flex: 1; min-width: 0; padding: 22px 22px 24px;
}

.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  color: var(--ink-3);
  font: 500 11px/1.4 var(--font-mono); letter-spacing: .03em; text-transform: uppercase;
}
.meta .dotsep { color: var(--line); font-size: 14px; line-height: 1; }
.meta .views { color: var(--accent); font-weight: 600; }
.meta .views:empty { display: none; }

.card h3 {
  margin: 0; color: var(--ink);
  font: 600 21px/1.3 var(--font-head); letter-spacing: -.018em;
}
.card h3 a { color: inherit; }
.card h3 a:hover { color: var(--accent); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.7; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.card .tags { margin-top: auto; }
.tags li { margin: 0; }
.tags span {
  display: inline-block; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-3); font: 500 10px/1.3 var(--font-mono);
}
.card:hover .tags span { border-color: var(--line); }

.read {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--accent); font: 600 11px/1 var(--font-mono);
  letter-spacing: .1em; text-transform: uppercase;
}
.read span { transition: transform .2s ease; }
.read:hover { text-decoration: none; }
.read:hover span { transform: translateX(4px); }

/* ---------------------------------------------------------- blog index */
.page-head { max-width: 820px; padding: clamp(52px, 8vw, 84px) 0 38px; }
.page-head h1 {
  margin: 0 0 16px;
  font: 700 clamp(44px, 7vw, 68px)/1 var(--font-head); letter-spacing: -.045em;
}
.page-head .lead {
  max-width: 620px; margin: 0; color: var(--ink-2);
  font-size: clamp(17px, 2vw, 19px); line-height: 1.6;
}
.head-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-top: 24px; color: var(--ink-3);
  font: 500 11px/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
}
.head-meta .count {
  padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-2);
}
.back-home {
  display: inline-block; margin-bottom: 26px; color: var(--ink-3);
  font: 500 11px/1 var(--font-mono); letter-spacing: .09em; text-transform: uppercase;
}
.back-home:hover { color: var(--accent); text-decoration: none; }

.post-list {
  display: grid; gap: 22px; padding-bottom: 104px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}
.post-list--flush { padding-bottom: 0; }

/* ---------------------------------------------------------- footer */
.site-footer {
  position: relative; z-index: 1;
  padding: 30px 0 42px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.foot-in { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 18px; }
.foot-brand { display: flex; align-items: center; gap: 9px; color: var(--ink-2); font-size: 13px; }
.foot-brand svg { width: 17px; height: 22px; color: var(--accent); flex: 0 0 auto; }
.foot-brand b { color: var(--ink); font-weight: 600; }
.foot-links {
  margin-left: auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font: 500 10.5px/1 var(--font-mono); letter-spacing: .1em; text-transform: uppercase;
}
.foot-links a { color: var(--ink-3); }
.foot-links a:hover { color: var(--accent); text-decoration: none; }
.foot-visits {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--ink-3); font: 500 10.5px/1 var(--font-mono); letter-spacing: .05em;
}
.foot-visits::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); opacity: .85;
}

/* ---------------------------------------------------------- reveal */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.intro { animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
.section, .post-list { animation: rise .7s .08s cubic-bezier(.2, .7, .2, 1) both; }
.page-head { animation: rise .55s cubic-bezier(.2, .7, .2, 1) both; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 720px) {
  .wrap { padding: 0 22px; }
  .intro { padding-top: 48px; }
  .intro-head { align-items: flex-start; gap: 20px; }
  .avatar-large { width: 82px; height: 82px; }
  h1 { font-size: clamp(36px, 10vw, 48px); }
  h1 .alias {
    display: inline-block; margin: 10px 0 0; transform: none;
    font-size: 12px;
  }
  .tagline { margin-top: 14px; font-size: 17px; }
  .accounts { grid-template-columns: 1fr; max-width: 420px; }
  .section { padding: 66px 0 80px; }
  .section-head { flex-wrap: wrap; }
  .section-head .all { margin-left: 0; width: 100%; margin-top: 4px; }
  .post-list { padding-bottom: 80px; }
  .foot-in { align-items: flex-start; }
  .foot-links { margin-left: 0; width: 100%; }
  .foot-visits { width: 100%; }
}

@media (max-width: 560px) {
  .top-in { height: 54px; gap: 10px; }
  .hide-sm { display: none !important; }
  .nav-sep { margin: 0 3px; }
  .meta { gap: 7px; font-size: 10px; }
}

@media (max-width: 480px) {
  .top-nav .navlink { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
