/* ============================================================
   MikroTik-RouterOS.com — Beige Box theme
   Warm retro-computing reskin. Imports the design-system tokens,
   then styles the static site's components.
   ============================================================ */

@import url('./tokens/fonts.css');
@import url('./tokens/colors.css');
@import url('./tokens/typography.css');
@import url('./tokens/spacing.css');
@import url('./tokens/elevation.css');
@import url('./tokens/base.css');

/* ---- layout containers --------------------------------------------------- */
.wrap { width: 100%; max-width: var(--container-wide); margin: 0 auto; padding: 0 var(--space-6); }
.wrap--prose { max-width: var(--container-prose); }
.muted { color: var(--text-muted); }

/* inline svg icons (self-hosted, currentColor) */
.ic { display: inline-block; vertical-align: -0.18em; flex: 0 0 auto; }
.notice-icon { flex: 0 0 auto; margin-top: 2px; color: var(--warning); display: inline-flex; }
.eyebrow.eyebrow--mono::before { content: "// "; }

/* ============================================================ HEADER */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-height);
  display: flex; align-items: center; gap: var(--space-6);
  padding: 0 var(--space-6);
  background: color-mix(in srgb, var(--surface-card) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: var(--border-2) solid var(--border);
  box-shadow: var(--shadow-xs);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; display: block; }
.brand-name {
  font-family: var(--font-display); font-weight: 800; font-size: 19px;
  letter-spacing: -0.02em; color: var(--text-strong);
}
.brand-name b { color: var(--accent); font-weight: 800; }

.site-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: var(--space-4); }
.site-nav a {
  font-family: var(--font-sans); font-size: var(--text-sm); font-weight: 600;
  color: var(--text-muted); text-decoration: none;
  padding: 8px 12px; border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.site-nav a:hover { background: var(--surface-sunken); color: var(--text-strong); text-decoration: none; }
.site-nav a.is-active { color: var(--accent); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--surface-raised); border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); box-shadow: var(--bezel-raised); cursor: pointer;
  color: var(--text-muted);
}
.icon-btn:hover { background: var(--surface-sunken); }
.nav-toggle { display: none; }

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; font-family: var(--font-sans); font-size: var(--text-base);
  font-weight: var(--fw-semibold); line-height: 1; letter-spacing: 0.01em;
  border-radius: var(--radius-md); cursor: pointer; text-decoration: none;
  white-space: nowrap; border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: var(--bezel-inset); }
.btn--sm { padding: 6px 12px; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn--primary {
  background: var(--accent); color: var(--text-on-accent);
  border-color: var(--accent-press); box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,252,244,0.28);
}
.btn--primary:hover { background: var(--accent-hover); color: var(--text-on-accent); }
.btn--secondary {
  background: var(--surface-raised); color: var(--text-strong);
  border-color: var(--border-strong); box-shadow: var(--shadow-xs), var(--bezel-raised);
}
.btn--secondary:hover { background: var(--surface-sunken); }

/* ============================================================ AD ZONES */
.ad-zone { margin: var(--space-5) auto; text-align: center; }
.ad-zone:empty { display: none; }
.ad-slot { margin: var(--space-6) 0; }

/* ============================================================ HOME */
main.wrap { padding-top: var(--space-8); padding-bottom: var(--space-6); }

.hero-grid {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--space-7);
  align-items: stretch; margin-bottom: var(--space-10);
}
.hero-feature {
  background: var(--surface-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: var(--space-8);
  box-shadow: var(--shadow-md), var(--bezel-raised);
  display: flex; flex-direction: column; justify-content: center; cursor: pointer;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.hero-feature:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg), var(--bezel-raised); }
.hero-feature h1 { font-size: var(--text-2xl); margin: 0 0 16px; line-height: 1.1; }
.hero-feature h1 a { color: var(--text-strong); text-decoration: none; }
.hero-feature:hover h1 a { color: var(--accent); }
.hero-feature .excerpt { font-size: var(--text-base); color: var(--text-muted); max-width: 46ch; margin-bottom: 22px; }
.hero-feature .excerpt p { margin: 0; }
.hero-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.post-meta-mono { display: flex; gap: 12px; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }

/* terminal panel (decorative) */
.terminal {
  background: var(--surface-inset); border-radius: var(--radius-xl); overflow: hidden;
  box-shadow: var(--shadow-lg), var(--bezel-inset); display: flex; flex-direction: column;
}
.terminal-bar {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  border-bottom: 1px solid rgba(244,238,223,0.1);
}
.terminal-dot { width: 11px; height: 11px; border-radius: 50%; }
.terminal-dot--r { background: var(--clay-500); }
.terminal-dot--a { background: var(--amber-500); }
.terminal-dot--o { background: var(--olive-500); }
.terminal-title { margin-left: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--term-dim); }
.terminal pre {
  margin: 0; padding: var(--space-5); background: none; box-shadow: none;
  font-size: 13px; line-height: 1.7; flex: 1; overflow-x: auto;
}
.t-dim { color: var(--term-dim); } .t-green { color: var(--term-green); }
.t-amber { color: var(--term-amber); } .t-sand { color: var(--sand-200); }

.home-layout { display: grid; grid-template-columns: 1fr 304px; gap: var(--space-8); align-items: start; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: var(--space-5); }
.section-head h2 { margin: 0; font-size: var(--text-xl); }
.section-head a { font-family: var(--font-mono); font-size: 13px; }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.see-all { margin-top: var(--space-6); }

/* ============================================================ CARDS */
.card {
  display: flex; flex-direction: column;
  background: var(--surface-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm), var(--bezel-raised);
  overflow: hidden; cursor: pointer;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg), var(--bezel-raised); }
.card:hover .card-title a { color: var(--accent); }
.card-thumb { display: block; max-height: 168px; overflow: hidden; border-bottom: 1px solid var(--border); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: var(--space-5); }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.card-title { margin: 0 0 10px; font-size: var(--text-lg); }
.card-title a { color: var(--text-strong); text-decoration: none; }
.card-title a:hover { color: var(--accent); }
.card-excerpt { color: var(--text-muted); font-size: var(--text-sm); margin: 0 0 16px; }
.card-excerpt p { margin: 0 0 8px; }

/* ============================================================ BADGE / TAG / EYEBROW */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: var(--fw-semibold);
  letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.4; white-space: nowrap;
  color: var(--text-muted); background: var(--surface-sunken);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: var(--fw-medium);
  letter-spacing: 0.02em; border-radius: var(--radius-pill); border: 1px solid var(--border-strong);
  background: var(--surface-raised); color: var(--text-muted); text-decoration: none; white-space: nowrap;
  transition: all var(--dur-fast) var(--ease-out);
}
.tag::before { content: "#"; opacity: 0.7; }
a.tag:hover { background: var(--surface-sunken); color: var(--text-strong); text-decoration: none; }
.tag--active { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent-press); }
.tag--active::before { opacity: 1; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ============================================================ SIDEBAR */
.sidebar { position: sticky; top: calc(var(--header-height) + 16px); display: grid; gap: var(--space-5); }
.panel {
  background: var(--surface-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm), var(--bezel-raised);
}
.panel .eyebrow { display: block; margin-bottom: 14px; }
.panel--podcast {
  background: var(--olive-700); color: var(--sand-100); border: none; box-shadow: var(--shadow-md);
}
.panel--podcast .eyebrow { color: var(--amber-300); }
.panel--podcast h3 { color: var(--sand-50); margin: 0 0 8px; font-size: var(--text-lg); }
.panel--podcast p { font-size: var(--text-sm); color: var(--olive-200); margin: 0 0 16px; }
.panel--podcast .btn--amber {
  background: var(--amber-400); color: var(--sand-900); border: none; font-weight: 700;
}
.panel--terminal { background: var(--surface-inset); box-shadow: var(--bezel-inset); }
.panel--terminal .prompt { font-family: var(--font-mono); font-size: 12px; color: var(--term-green); margin-bottom: 12px; }
.panel--terminal p { font-size: var(--text-sm); color: var(--sand-300); margin: 0 0 14px; }
.panel--terminal .feed-links { display: grid; gap: 8px; }
.panel--terminal a { color: var(--term-amber); font-family: var(--font-mono); font-size: 13px; text-decoration: none; }
.panel--terminal a:hover { color: var(--amber-300); text-decoration: underline; }
.cat-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.cat-list li { display: flex; justify-content: space-between; }
.cat-list a { text-decoration: none; color: var(--text-body); }
.cat-list a:hover { color: var(--accent); }
.cat-list .count { color: var(--text-faint); font-family: var(--font-mono); font-size: 13px; }

/* ============================================================ ARTICLE / PAGE */
.post-header { margin-bottom: var(--space-5); }
.back-link {
  display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted);
  font-family: var(--font-mono); font-size: 13px; text-decoration: none; margin-bottom: 24px;
}
.back-link:hover { color: var(--accent); }
.post-title { font-size: var(--text-3xl); margin: 0 0 20px; }
.post-byline { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.author-chip { display: flex; align-items: center; gap: 10px; }
.author-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--clay-300);
  border: 2px solid var(--clay-500); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; color: var(--clay-800);
}
.author-meta .who { font-weight: 600; font-size: 14px; color: var(--text-strong); }
.author-meta .when { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.byline-tags { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.post-rule { border: 0; border-top: var(--border-2) solid var(--border); margin: 0 0 var(--space-6); }
.post-feature { margin: 0 0 var(--space-6); }
.post-feature img { width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--border); display: block; }

.post-content { font-size: var(--text-md); line-height: var(--leading-relaxed); color: var(--text-body); }
.post-content > p:first-of-type { font-size: var(--text-lg); color: var(--text-strong); font-weight: 500; }
.post-content img { max-width: 100%; height: auto; border-radius: var(--radius-md); }
.post-content figure { margin: var(--space-5) 0; }
.post-content figcaption { color: var(--text-faint); font-size: var(--text-sm); text-align: center; margin-top: 6px; }
.post-content h2 { margin-top: var(--space-7); font-size: var(--text-2xl); }
.post-content h3 { margin-top: var(--space-6); font-size: var(--text-xl); }
.post-content blockquote {
  border-left: 3px solid var(--accent); margin: var(--space-5) 0; padding: var(--space-2) var(--space-4);
  color: var(--text-muted); background: var(--surface-raised); border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.post-content table { width: 100%; border-collapse: collapse; margin: var(--space-5) 0; font-size: var(--text-sm); }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.post-content th { background: var(--surface-raised); font-family: var(--font-mono); }

/* code blocks: dark amber-phosphor terminal (base.css styles <pre>; this is the
   wrapper added by site.js for the header bar + copy button) */
.code-block { position: relative; margin: var(--space-5) 0; }
.code-block__bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--sand-900); border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 8px 14px; border-bottom: 1px solid rgba(244,238,223,0.1);
}
.code-block__label { font-family: var(--font-mono); font-size: 12px; color: var(--term-dim); }
.code-block__copy {
  font-family: var(--font-mono); font-size: 12px; color: var(--sand-400);
  background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.code-block__copy:hover { color: var(--term-amber); }
.code-block > pre { margin: 0; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.post-content pre { font-size: 13.5px; line-height: 1.6; }
.post-content pre code { white-space: pre; }

/* callout / notice */
.notice {
  display: flex; gap: var(--space-3); background: var(--warning-soft);
  border: 1px solid var(--border); border-left: 3px solid var(--warning);
  border-radius: var(--radius-md); padding: var(--space-4); box-shadow: var(--shadow-xs);
  margin: 0 0 var(--space-6);
}
.notice .notice-label {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--amber-700); margin-bottom: 4px;
}
.notice .notice-body { color: var(--text-body); font-size: var(--text-sm); }
.notice .notice-body p:last-child { margin-bottom: 0; }

.post-tags { margin-top: var(--space-7); }
.preserved-links { margin-top: var(--space-7); border-top: var(--border-2) solid var(--border); padding-top: var(--space-5); }
.preserved-links ul { word-break: break-all; }

/* copy-script card (article) */
.script-card {
  margin: var(--space-7) 0; background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm), var(--bezel-raised); padding: var(--space-5);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.script-card .fname { font-family: var(--font-display); font-weight: 700; color: var(--text-strong); }

/* ============================================================ COMMENTS */
.comments { margin-top: var(--space-8); border-top: var(--border-2) solid var(--border); padding-top: var(--space-6); }
.comments h2 { font-size: var(--text-xl); }
.comment-list { list-style: none; padding-left: 0; margin: var(--space-4) 0 0; }
.comment-list .comment-list { padding-left: var(--space-5); border-left: 1px solid var(--border); margin-top: 12px; }
.comment {
  margin-bottom: 18px; background: var(--surface-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 16px; box-shadow: var(--shadow-xs);
}
.comment-meta { font-size: 13px; margin-bottom: 4px; }
.comment-author { font-weight: 600; color: var(--text-strong); }
.comment-date { color: var(--text-faint); margin-left: 8px; font-family: var(--font-mono); font-size: 12px; }
.comment-body { font-size: var(--text-sm); }
.comment-body p { margin: 6px 0; }
.comments-note { margin-top: 18px; font-family: var(--font-mono); font-size: 12px; }

/* ============================================================ ARCHIVE */
.archive-header { margin-bottom: var(--space-6); }
.archive-header h1 { font-size: var(--text-2xl); }
.archive-desc { color: var(--text-muted); }

/* ============================================================ FOOTER */
.site-footer { background: var(--sand-900); color: var(--text-on-dark); margin-top: var(--space-12); }
.footer-grid {
  max-width: var(--container-wide); margin: 0 auto;
  padding: var(--space-10) var(--space-6) var(--space-6);
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: var(--space-7);
}
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer-brand img { width: 32px; height: 32px; }
.footer-brand span { font-family: var(--font-display); font-weight: 800; font-size: 17px; }
.footer-about { color: var(--sand-400); font-size: var(--text-sm); max-width: 34ch; margin: 0; }
.footer-social { display: flex; gap: 10px; margin-top: 18px; }
.footer-social a {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--border-ondark); border-radius: var(--radius-md); color: var(--sand-300);
}
.footer-col h4 {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--term-amber); margin: 0 0 14px; font-weight: 600;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.footer-col a { color: var(--sand-300); text-decoration: none; font-size: var(--text-sm); }
.footer-col a:hover { color: var(--sand-50); }
.footer-bottom { border-top: 1px solid var(--border-ondark); padding: var(--space-4) var(--space-6); }
.footer-bottom-inner {
  max-width: var(--container-wide); margin: 0 auto; display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 11px; color: var(--sand-500); gap: 12px; flex-wrap: wrap;
}

/* ============================================================ RESPONSIVE */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .home-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .card-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .nav-toggle {
    display: grid; margin-left: auto; place-items: center; width: 38px; height: 38px;
    background: var(--surface-raised); border: 1px solid var(--border-strong);
    border-radius: var(--radius-md); box-shadow: var(--bezel-raised); cursor: pointer; color: var(--text-strong);
  }
  .site-nav {
    display: none; position: fixed; top: var(--header-height); left: 0; right: 0;
    flex-direction: column; gap: 4px; margin: 0; padding: var(--space-4) var(--space-6);
    background: var(--surface-card); border-bottom: 2px solid var(--border); box-shadow: var(--shadow-lg);
  }
  body.nav-open .site-nav { display: flex; }
  .header-actions .btn--secondary { display: none; }
  .byline-tags { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
