/* ════════════════════════════════════════════════════════
   Portfolio — coding/terminal themed dark UI
   Accent colours are injected as CSS vars from the template.
   ════════════════════════════════════════════════════════ */

:root {
  --bg: #0a0e14;
  --bg-soft: #0f141d;
  --panel: #11161f;
  --panel-2: #161c27;
  --border: #1f2733;
  --text: #c9d4e3;
  --text-dim: #6b7888;
  --red: #ff5f56;
  --yellow: #ffbd2e;
  --green: #27c93f;
  --accent: #00ff9c;
  --accent-alt: #36a3ff;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── decorative background ── */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(54,163,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(54,163,255,.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 10%, transparent 80%);
}
.scanline {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(transparent 0 3px, rgba(0,0,0,.18) 3px 4px);
  opacity: .35; mix-blend-mode: overlay;
}

main, .footer { position: relative; z-index: 1; }

/* ── nav ── */
.nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem clamp(1rem, 5vw, 4rem);
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,14,20,.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand-bracket { color: var(--accent); }
.nav-links { display: flex; gap: clamp(.6rem, 2vw, 1.6rem); flex-wrap: wrap; }
.nav-links a {
  color: var(--text-dim); text-decoration: none; font-size: .9rem;
  transition: color .2s;
}
.nav-links a:hover { color: var(--accent); }

/* ── layout ── */
.section {
  max-width: 980px; margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) clamp(1rem, 5vw, 2rem) 0;
}
.section-title {
  font-size: clamp(1.2rem, 3vw, 1.7rem); font-weight: 700;
  color: var(--text); margin-bottom: 1.4rem; letter-spacing: -.5px;
}
.section-close { color: var(--text-dim); margin-top: 1rem; font-size: 1.3rem; }
.kw { color: var(--accent-alt); }
.fn { color: var(--accent); }
.quote { color: var(--text-dim); }
.empty-note { color: var(--text-dim); font-style: italic; }

/* ── HERO ── */
.hero {
  max-width: 1080px; margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5rem) clamp(1rem, 5vw, 2rem);
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 2.5rem; align-items: center;
}
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } }

.terminal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8);
}
.terminal-bar {
  display: flex; align-items: center; gap: .5rem;
  padding: .7rem 1rem; background: var(--panel-2); border-bottom: 1px solid var(--border);
}
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.red { background: var(--red); } .dot.yellow { background: var(--yellow); } .dot.green { background: var(--green); }
.terminal-title { margin-left: .6rem; color: var(--text-dim); font-size: .8rem; }
.terminal-body { padding: 1.3rem 1.4rem; font-size: clamp(.85rem, 2vw, .98rem); }
.line { white-space: pre-wrap; word-break: break-word; margin: .15rem 0; }
.prompt { color: var(--accent); }
.path { color: var(--accent-alt); }
.name-line {
  font-size: clamp(1.5rem, 5vw, 2.4rem); font-weight: 700; color: #fff;
  font-family: var(--sans); margin: .3rem 0 .6rem; line-height: 1.15;
}
.role-line { color: var(--accent-alt); margin-bottom: .6rem; }
.typing-line { color: var(--text); min-height: 1.6em; }
.caret { color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ── avatar ── */
.avatar-wrap { text-align: center; }
.avatar-frame {
  position: relative; width: min(280px, 80%); aspect-ratio: 1; margin: 0 auto;
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  background: var(--panel);
}
.avatar-frame img { width: 100%; height: 100%; object-fit: cover; display: block;
  filter: grayscale(.25) contrast(1.05); transition: filter .4s; }
.avatar-frame:hover img { filter: grayscale(0); }
.avatar-corner { position: absolute; width: 16px; height: 16px; border: 2px solid var(--accent); }
.avatar-corner.tl { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.avatar-corner.tr { top: 8px; right: 8px; border-left: 0; border-bottom: 0; }
.avatar-corner.bl { bottom: 8px; left: 8px; border-right: 0; border-top: 0; }
.avatar-corner.br { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }
.avatar-caption { color: var(--text-dim); font-size: .8rem; margin-top: .8rem; }

/* ── code cards ── */
.code-card {
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 1.4rem 1.6rem;
}
.code-comment { color: var(--text-dim); display: block; margin-bottom: .7rem; }
.about-text { color: var(--text); font-family: var(--sans); }
.btn {
  display: inline-block; margin-top: 1.2rem; padding: .6rem 1.1rem;
  border: 1px solid var(--accent); color: var(--accent); text-decoration: none;
  border-radius: 6px; font-size: .9rem; transition: all .2s;
}
.btn:hover { background: var(--accent); color: var(--bg); }

/* ── skills ── */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.1rem; }
.skill {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem 1.2rem; opacity: 0; transform: translateY(14px);
}
.in .skill, .skill { animation: rise .5s ease forwards; animation-delay: calc(var(--i) * 70ms); }
@keyframes rise { to { opacity: 1; transform: none; } }
.skill-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .6rem; gap: .5rem; }
.skill-name { color: var(--text); font-weight: 500; }
.skill-level { color: var(--accent); font-size: .85rem; white-space: nowrap; }
.skill-note { color: var(--text-dim); }
.bar { height: 8px; background: var(--panel-2); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.bar-fill {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent-alt), var(--accent));
  border-radius: 5px; box-shadow: 0 0 10px -1px var(--accent);
  transition: width 1.1s cubic-bezier(.2,.8,.2,1);
}
.in .bar-fill { width: var(--lvl); }

/* ── gallery ── */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.gallery-item {
  position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: var(--panel); opacity: 0; transform: translateY(14px) scale(.98);
}
.in .gallery-item { animation: rise .55s ease forwards; animation-delay: calc(var(--i) * 60ms); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1; display: block; transition: transform .45s; }
.gallery-item:hover img { transform: scale(1.06); }
.gallery-item figcaption {
  position: absolute; inset: auto 0 0 0; padding: .7rem .8rem;
  background: linear-gradient(transparent, rgba(5,8,12,.92));
  display: flex; flex-direction: column; gap: .15rem;
  transform: translateY(100%); transition: transform .3s;
}
.gallery-item:hover figcaption { transform: none; }
.g-title { color: #fff; font-weight: 500; font-size: .9rem; }
.g-caption { color: var(--text-dim); font-size: .78rem; }

/* ── contact ── */
.contact-intro { color: var(--text-dim); margin-bottom: 1.4rem; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.contact-card {
  display: flex; align-items: center; gap: .9rem; text-decoration: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem 1.1rem; color: var(--text); transition: border-color .2s, transform .2s, background .2s;
  opacity: 0; transform: translateY(12px);
}
.in .contact-card { animation: rise .5s ease forwards; animation-delay: calc(var(--i) * 70ms); }
.contact-card:hover { border-color: var(--accent); background: var(--panel-2); transform: translateY(-3px); }
.contact-icon { width: 26px; height: 26px; color: var(--accent); flex-shrink: 0; }
.contact-icon svg { width: 100%; height: 100%; }
.contact-meta { display: flex; flex-direction: column; line-height: 1.3; }
.contact-platform { font-weight: 600; font-size: .95rem; }
.contact-handle { color: var(--text-dim); font-size: .82rem; }
.contact-arrow { margin-left: auto; color: var(--text-dim); transition: transform .2s, color .2s; }
.contact-card:hover .contact-arrow { color: var(--accent); transform: translateX(4px); }

/* ── gallery zoom badge ── */
.zoomable { cursor: zoom-in; }
.zoom-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 30px; height: 30px; display: grid; place-items: center;
  background: rgba(5,8,12,.7); color: var(--accent); border: 1px solid var(--border);
  border-radius: 7px; font-size: .95rem; opacity: 0; transform: scale(.85);
  transition: opacity .2s, transform .2s; pointer-events: none;
}
.gallery-item:hover .zoom-badge { opacity: 1; transform: scale(1); }

/* ── lightbox ── */
.lightbox {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: center; justify-content: center; padding: 4vmin;
  background: rgba(4,7,11,.92); backdrop-filter: blur(6px);
}
.lightbox.open { display: flex; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; } }
.lightbox-figure { margin: 0; max-width: 92vw; max-height: 90vh; text-align: center; }
.lightbox-figure img {
  max-width: 92vw; max-height: 80vh; object-fit: contain;
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 30px 90px -20px rgba(0,0,0,.9);
  animation: zoomin .25s cubic-bezier(.2,.8,.2,1);
}
@keyframes zoomin { from { transform: scale(.92); opacity: .4; } }
.lightbox-figure figcaption { color: var(--text-dim); margin-top: .9rem; font-size: .9rem; }
.lightbox-close {
  position: absolute; top: 18px; right: 22px; z-index: 51;
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  width: 40px; height: 40px; border-radius: 9px; font-size: 1.1rem; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.lightbox-close:hover { border-color: var(--accent); color: var(--accent); }

/* ── blog list + teaser ── */
.crumb { color: var(--text-dim); margin-bottom: 1rem; font-size: .9rem; }
.crumb a { color: var(--accent-alt); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.post-list { display: grid; gap: 1rem; }
.post-card {
  display: grid; gap: .35rem; text-decoration: none;
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--accent-alt);
  border-radius: 10px; padding: 1.1rem 1.3rem; color: var(--text);
  transition: border-color .2s, transform .2s, background .2s;
  opacity: 0; transform: translateY(12px);
}
.in .post-card { animation: rise .5s ease forwards; animation-delay: calc(var(--i) * 70ms); }
.post-card:hover { border-left-color: var(--accent); background: var(--panel-2); transform: translateY(-3px); }
.post-thumb { display: block; margin: -.2rem 0 .5rem; border-radius: 8px; overflow: hidden; max-height: 200px; }
.post-thumb img { width: 100%; height: 200px; object-fit: cover; display: block; }
.post-date { color: var(--text-dim); font-size: .82rem; }
.post-title { color: #fff; font-weight: 600; font-size: 1.15rem; font-family: var(--sans); }
.post-excerpt { color: var(--text-dim); font-family: var(--sans); font-size: .92rem; }
.post-read { color: var(--accent); font-size: .85rem; margin-top: .2rem; }
.all-posts-link { color: var(--accent); text-decoration: none; }
.all-posts-link:hover { text-decoration: underline; }

/* ── post detail ── */
.post-detail { max-width: 760px; }
.post-header { margin-bottom: 1.4rem; }
.post-meta-line { margin-bottom: .4rem; }
.post-h1 {
  font-family: var(--sans); font-size: clamp(1.6rem, 5vw, 2.6rem); font-weight: 800;
  color: #fff; line-height: 1.15; letter-spacing: -.5px;
}
.post-cover { margin: 1.4rem 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.post-cover img { width: 100%; display: block; cursor: zoom-in; }
.post-body { font-family: var(--sans); font-size: 1.05rem; line-height: 1.8; color: var(--text); }
.post-body p { margin: 0 0 1.1rem; }
.post-body a { color: var(--accent); }

/* ── footer ── */
.footer {
  max-width: 980px; margin: clamp(3rem, 8vw, 6rem) auto 0; padding: 2rem clamp(1rem, 5vw, 2rem);
  border-top: 1px solid var(--border); color: var(--text-dim); font-size: .85rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .6rem;
}
.footer-prompt { color: var(--accent); }
.footer-year { color: var(--text-dim); }

/* ── reveal ── */
[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
[data-reveal].in { opacity: 1; transform: none; }
/* nested animated children should not be hidden by their own reveal parent */
.in [data-reveal] { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; }
  .bar-fill { width: var(--lvl); }
}
