/* ==========================================================================
   linhvu.net — handcrafted, no frameworks
   ========================================================================== */

/* ---------- Theme tokens ---------- */

:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --container: 1080px;
  --header-h: 64px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #fbfaf9;
  --bg-soft: #f4f2f0;
  --surface: #ffffff;
  --text: #1c1917;
  --text-soft: #57534e;
  --muted: #79716b;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --accent: #ea580c;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(234, 88, 12, 0.1);
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.05), 0 8px 24px rgba(28, 25, 23, 0.06);
  --shadow-lift: 0 2px 4px rgba(28, 25, 23, 0.06), 0 14px 36px rgba(28, 25, 23, 0.1);
  --grid-line: rgba(28, 25, 23, 0.05);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0a09;
  --bg-soft: #12100e;
  --surface: #171412;
  --text: #f5f5f4;
  --text-soft: #d6d3d1;
  --muted: #a8a29e;
  --border: #292524;
  --border-strong: #44403c;
  --accent: #fb923c;
  --accent-contrast: #1c1917;
  --accent-soft: rgba(251, 146, 60, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.5), 0 14px 36px rgba(0, 0, 0, 0.45);
  --grid-line: rgba(245, 245, 244, 0.045);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.5em;
  font-weight: 700;
}

h1 { font-size: clamp(2.1rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; color: var(--text-soft); }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--accent-soft);
  color: var(--text);
  padding: 0.15em 0.45em;
  border-radius: 5px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 72px 0; }
.section-alt { background: var(--bg-soft); }

.section-head {
  max-width: 620px;
  margin-bottom: 40px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.kicker::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.section-head p { font-size: 1.05rem; margin: 0; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease, border-color 0.15s ease;
  text-decoration: none !important;
}

.btn svg { flex: none; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ---------- Badges & chips ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
  background: var(--surface);
  white-space: nowrap;
}

.badge-accent {
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
}

.wordmark {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none !important;
}

.wordmark .dot { color: var(--accent); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none !important;
  transition: color 0.15s ease, background 0.15s ease;
}

.site-nav a:hover { color: var(--text); background: var(--accent-soft); }

.site-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease,
    border-color 0.15s ease;
}

.icon-link:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.icon-link svg { width: 20px; height: 20px; }

/* Theme toggle icon swap */
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 96px 0 84px;
  overflow: hidden;
}

.hero::before {
  /* faint blueprint grid */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, #000 30%, transparent 75%);
  pointer-events: none;
}

.hero::after {
  /* warm glow */
  content: "";
  position: absolute;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  height: 420px;
  background: radial-gradient(ellipse at center,
    var(--accent-soft), transparent 68%);
  pointer-events: none;
}

.hero .container { position: relative; z-index: 1; }

.hero-inner { max-width: 720px; }

.hero .kicker { margin-bottom: 18px; }

.hero h1 { margin-bottom: 20px; }

.hero h1 .accent {
  color: var(--accent);
  position: relative;
  white-space: nowrap;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--text-soft);
  max-width: 560px;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 44px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.hero-meta .sep { opacity: 0.5; }

/* ---------- Extension cards ---------- */

.ext-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

.ext-card {
  --ext: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none !important;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease,
    border-color 0.18s ease;
  overflow: hidden;
}

.ext-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--ext), transparent 80%);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.ext-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: color-mix(in srgb, var(--ext) 45%, var(--border));
}

.ext-card:hover::before { opacity: 1; }

.ext-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--ext);
  background: color-mix(in srgb, var(--ext) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ext) 25%, transparent);
}

.ext-icon svg { width: 28px; height: 28px; }

.ext-card h3 {
  margin: 0 0 6px;
  font-size: 1.12rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ext-card p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--text-soft);
  flex: 1;
}

.ext-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
}

.ext-arrow {
  position: absolute;
  top: 24px;
  right: 22px;
  color: var(--muted);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.ext-card:hover .ext-arrow {
  opacity: 1;
  transform: translateX(0);
  color: var(--ext);
}

/* ---------- Value / feature cards ---------- */

.value-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.value-card {
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.value-card .ext-icon {
  width: 44px;
  height: 44px;
  margin-bottom: 16px;
}

.value-card .ext-icon svg { width: 22px; height: 22px; }

.value-card h3 { margin-bottom: 8px; font-size: 1.05rem; }

.value-card p { margin: 0; font-size: 0.92rem; }

/* ---------- Extension detail pages ---------- */

.page-hero {
  position: relative;
  padding: 64px 0 56px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(560px 280px at 12% 0%, var(--accent-soft), transparent 70%),
    var(--bg);
  overflow: hidden;
}

.backlink {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none !important;
  margin-bottom: 26px;
  transition: color 0.15s ease;
}

.backlink:hover { color: var(--accent); }

.ext-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 22px;
}

.ext-hero .ext-icon {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.ext-hero .ext-icon svg { width: 42px; height: 42px; }

.ext-hero-main { flex: 1; min-width: 260px; }

.ext-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.ext-hero .tagline {
  font-size: 1.1rem;
  color: var(--text-soft);
  max-width: 620px;
  margin: 0 0 18px;
}

.ext-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.fact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

/* Screenshot frame */

.shot {
  margin: 8px 0 28px;
}

.shot-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
  overflow: hidden;
}

.shot-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.shot-bar i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--border-strong);
}

.shot-bar i:nth-child(1) { background: #f87171; }
.shot-bar i:nth-child(2) { background: #fbbf24; }
.shot-bar i:nth-child(3) { background: #34d399; }

.shot-bar span {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
}

.shot-frame img { width: 100%; }

.shot + .shot-caption,
.shot-caption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 10px;
}

/* Feature list */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.feature-card {
  display: flex;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.feature-card svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 3px;
  color: var(--accent);
}

.feature-card h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.feature-card p {
  margin: 0;
  font-size: 0.9rem;
}

/* Two-column detail layout */

.detail-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
  align-items: start;
}

.detail-side {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.side-card {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.side-card h3 {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
}

.side-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 0.88rem;
}

.side-card dt { color: var(--muted); }

.side-card dd {
  margin: 0;
  color: var(--text);
  font-weight: 500;
  text-align: right;
}

.side-card .btn { width: 100%; }

/* Tables (shortcuts, config) */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

th {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  background: var(--bg-soft);
}

tr:last-child td { border-bottom: none; }

td kbd {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--text);
  white-space: nowrap;
}

/* ---------- Prose (about page) ---------- */

.prose { max-width: 680px; }

.prose p, .prose li { font-size: 1.02rem; }

.prose h2 {
  margin-top: 1.8em;
  font-size: 1.45rem;
}

.stack-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 20px 0 0;
  list-style: none;
}

.stack-list li {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 6px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--surface);
}

/* ---------- Contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  max-width: 900px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.contact-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.contact-card .ext-icon {
  width: 46px;
  height: 46px;
}

.contact-card .ext-icon svg { width: 22px; height: 22px; }

.contact-card h3 { margin: 0; }

.contact-card p { margin: 0; font-size: 0.92rem; flex: 1; }

.contact-value {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--text);
  word-break: break-all;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

.copy-btn.copied { border-color: #34d399; color: #34d399; }

/* ---------- CTA band ---------- */

.cta-band {
  text-align: center;
  padding: 80px 24px;
  border-top: 1px solid var(--border);
  background:
    radial-gradient(640px 300px at 50% 100%, var(--accent-soft), transparent 70%),
    var(--bg-soft);
}

.cta-band h2 { margin-bottom: 12px; }

.cta-band p {
  max-width: 480px;
  margin: 0 auto 28px;
  color: var(--text-soft);
}

.cta-band .btn { margin: 0 6px 10px; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.footer-inner p { margin: 0; color: var(--muted); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links a { color: var(--muted); }

.footer-links a:hover { color: var(--accent); }

/* ---------- 404 ---------- */

.error-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--header-h) - 120px);
  text-align: center;
  padding: 48px 24px;
}

.error-page .code {
  font-family: var(--font-mono);
  font-size: clamp(4rem, 14vw, 7rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -0.04em;
}

.error-page .path { font-family: var(--font-mono); color: var(--muted); }

/* ---------- Reveal on scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.revealed { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .detail-cols { grid-template-columns: 1fr; }
  .detail-side { position: static; }
}

@media (max-width: 640px) {
  .section { padding: 56px 0; }
  .hero { padding: 64px 0 60px; }
  .header-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; }
  .site-header { height: auto; }
  .site-nav { order: 3; width: 100%; justify-content: center; }
  .hero-actions .btn { flex: 1; }
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
