@import url('https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;500&display=swap');

:root {
  --font-family: "Fira Mono", monospace;
  --font-size: 16px;
  --line-height: 1.7rem;
  --content-width: 72ch;
  --border-thickness: 2px;

  --bg: #0b0b0a;
  --bg-alt: #12110f;
  --text: #f2f1ed;
  --text-muted: #b7b2a8;
  --accent: #d6b16e;

  --callout-warning: #c9a227;
  --callout-tip: #6a9955;
  --callout-important: #d16969;

  /* Brand semantic colors */
  --risk-high: #d16969;
  --risk-medium: #c9a227;
  --risk-low: #6a9955;
  --info: #6b9dc7;
  
  /* Extended brand colors */
  --accent-hover: #e4c48a;
  --accent-subtle: rgba(214, 177, 110, 0.125);
  --border: #2a2824;
  --border-strong: #3a3630;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold: 600;

  /* Modular font size scale (1.125 ratio) */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.125rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
}

:root[data-theme="light"] {
  --bg: #f8f6f1;
  --bg-alt: #efede7;
  --text: #141210;
  --text-muted: #6f6a62;
  --accent: #c47f1f;

  --callout-warning: #b8941f;
  --callout-tip: #5a8545;
  --callout-important: #c45a5a;
}

* {
  box-sizing: border-box;
}

html {
  font-family: var(--font-family);
  font-size: var(--font-size);
  line-height: var(--line-height);
  background: var(--bg);
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  margin: 0;
  padding: calc(var(--line-height) * 2) 2ch;
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 720px) {
  html {
    font-size: 15px;
  }
  body {
    padding: var(--line-height) 1ch;
  }
  .header-top {
    flex-wrap: wrap;
  }
  .logo-mark {
    font-size: var(--text-xl);
  }
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--bg);
  color: var(--text);
  border: var(--border-thickness) solid var(--text);
  padding: 0.4em 0.8ch;
}

.skip-link:focus-visible {
  left: 1ch;
  top: 1ch;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: var(--border-thickness);
  text-underline-offset: 0.2em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  transition: outline-offset 0.15s ease;
}

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

.site-header {
  margin-bottom: calc(var(--line-height) * 2);
}

.header-top {
  display: flex;
  align-items: baseline;
  gap: 0 2ch;
  flex-wrap: wrap;
}

.logo-mark {
  text-decoration: none;
  font-family: "Fira Code", var(--font-family);
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-bold);
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.logo-hash {
  color: var(--text-muted);
}

.logo-ai {
  color: var(--accent);
}

.logo-mark:hover .logo-hash,
.logo-mark:hover .logo-ai {
  color: var(--accent-hover);
}

.header-identity {
  margin-top: calc(var(--line-height) * 0.25);
}

.site-name-link {
  font-weight: var(--font-weight-medium);
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.05em;
}

.site-name-link:hover {
  color: var(--accent);
}

.site-tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1ch;
  margin-left: auto;
}

.site-nav a,
.theme-toggle {
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-sm);
  background: none;
  border: none;
  padding: 0.3em 0;
  cursor: pointer;
  text-decoration: none;
}

.site-nav a:hover,
.theme-toggle:hover {
  color: var(--accent);
}

.content > * + * {
  margin-top: calc(var(--line-height) * 2);
}

.page-header {
  margin-bottom: calc(var(--line-height) * 2);
}

.page-header h1 {
  margin: 0 0 var(--line-height);
}

.article-body > * + * {
  margin-top: var(--line-height);
}

.article-body a {
  color: var(--accent);
}

.intro p {
  margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-weight-bold);
  font-feature-settings: "ss01", "ss02";
}

h1 {
  font-size: var(--text-2xl);
  line-height: calc(var(--line-height) * 2);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--text-xl);
  line-height: calc(var(--line-height) * 1.5);
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--text-lg);
  line-height: calc(var(--line-height) * 1.3);
}

h4,
h5,
h6 {
  font-size: var(--text-base);
  line-height: var(--line-height);
}

p {
  margin: 0;
}

.meta-line {
  color: var(--text-muted);
  margin: 0;
}

.meta-label {
  color: var(--text-muted);
}

.dek {
  margin: var(--line-height) 0 0;
  color: var(--text-muted);
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: var(--line-height) 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1ch;
}

.tag-list li {
  margin: 0;
}

.tag-link {
  color: var(--accent);
  opacity: 0.7;
  text-decoration-color: transparent;
}

.tag-link:hover {
  opacity: 1;
  text-decoration-color: var(--accent);
}

ul,
ol {
  margin: 0;
  padding-left: 2ch;
}

ul {
  list-style: square;
}

li + li {
  margin-top: 0.35em;
}

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 1ch;
  align-items: baseline;
  padding: calc(var(--line-height) * 0.5) 0;
}

.post-list li + li {
  border-top: 1px solid var(--bg-alt);
}

.post-date {
  color: var(--text-muted);
}

.post-desc {
  color: var(--text-muted);
}

.post-desc::before {
  content: " ";
}

.post-link {
  text-decoration-color: var(--accent-subtle);
}

.post-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.post-sep {
  color: var(--text-muted);
}

.post-feed {
  margin: 0;
}

/* Featured Posts Section */
.featured-posts {
  margin: calc(var(--line-height) * 2) 0;
  padding: calc(var(--line-height) * 1.5) 0;
  border-top: var(--border-thickness) solid var(--text);
  border-bottom: var(--border-thickness) solid var(--text);
}

.featured-posts h2 {
  margin: 0 0 var(--line-height);
  font-size: var(--text-md);
}

.featured-grid {
  display: grid;
  gap: calc(var(--line-height) * 0.75);
}

.featured-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2ch;
}

@media (max-width: 600px) {
  .featured-secondary {
    grid-template-columns: 1fr;
  }
}

.featured-card {
  padding: calc(var(--line-height) * 0.75) 1ch;
  border: var(--border-thickness) solid var(--text);
  background: var(--bg-alt);
}

.featured-card.primary {
  border-left-width: 4px;
  border-left-color: var(--accent);
}

.featured-card.secondary {
  border-width: 1px;
}

.featured-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: calc(var(--line-height) * 0.25);
}

.featured-card h3 {
  font-size: var(--text-md);
  margin: 0 0 calc(var(--line-height) * 0.4);
  line-height: calc(var(--line-height) * 1.1);
}

.featured-card h3 a {
  text-decoration: underline;
  text-decoration-color: var(--text-muted);
}

.featured-card h3 a:hover {
  text-decoration-color: var(--accent);
}

.featured-card p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0 0 calc(var(--line-height) * 0.5);
  line-height: calc(var(--line-height) * 0.9);
}

.featured-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.page-intro {
  color: var(--text-muted);
  margin-bottom: calc(var(--line-height) * 2);
}

.pagination {
  display: flex;
  gap: 1ch;
}

.term-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.term-list li {
  display: flex;
  gap: 1ch;
  align-items: baseline;
}

.term-count {
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
}

hr {
  border: none;
  border-top: var(--border-thickness) solid var(--text);
  margin: calc(var(--line-height) * 2) 0;
}

blockquote {
  margin: 0;
  padding-left: 2ch;
  border-left: var(--border-thickness) solid var(--text);
}

.callout {
  border: var(--border-thickness) solid var(--text);
  border-left-width: 4px;
  padding: var(--line-height) 1ch;
}

.callout-title {
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--line-height);
}

.callout-title::before {
  margin-right: 1ch;
}

/* Callout type: note (default) */
.callout-note {
  border-left-color: var(--accent);
}

.callout-note .callout-title::before {
  content: "[i]";
  color: var(--accent);
}

/* Callout type: warning */
.callout-warning {
  border-left-color: var(--callout-warning);
}

.callout-warning .callout-title::before {
  content: "[!]";
  color: var(--callout-warning);
}

/* Callout type: tip */
.callout-tip {
  border-left-color: var(--callout-tip);
}

.callout-tip .callout-title::before {
  content: "[*]";
  color: var(--callout-tip);
}

/* Callout type: important */
.callout-important {
  border-left-color: var(--callout-important);
}

.callout-important .callout-title::before {
  content: "[!!]";
  color: var(--callout-important);
}

figure {
  margin: 0;
}

figcaption {
  color: var(--text-muted);
  margin-top: var(--line-height);
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
  border: var(--border-thickness) solid var(--text);
  margin: 0;
  display: block;
  overflow-x: auto;
}

th,
td {
  border: var(--border-thickness) solid var(--text);
  padding: calc(var(--line-height) / 2) 1ch;
  text-align: left;
  vertical-align: top;
}

pre {
  margin: 0;
  padding: var(--line-height);
  overflow-x: auto;
  background: var(--bg-alt);
  border: var(--border-thickness) solid var(--text);
}

.highlight {
  border: var(--border-thickness) solid var(--text);
  background: var(--bg-alt);
  padding: var(--line-height);
  overflow-x: auto;
}

.highlight pre {
  border: none;
  padding: 0;
  background: transparent;
}

.highlight table {
  border: none;
  margin: 0;
}

.highlight td {
  border: none;
  padding: 0;
}

code {
  font-family: var(--font-family);
  font-size: var(--text-sm);
  font-variant-ligatures: none;
}

p code,
li code {
  padding: 0.1em 0.3em;
  border: var(--border-thickness) solid var(--text);
  background: var(--bg-alt);
}

details {
  border: var(--border-thickness) solid var(--text);
  padding: calc(var(--line-height) - var(--border-thickness)) 1ch;
}

summary {
  cursor: pointer;
  font-weight: var(--font-weight-medium);
}

summary + * {
  margin-top: var(--line-height);
}

input,
textarea,
select,
button {
  font-family: var(--font-family);
  font-size: var(--text-base);
  color: inherit;
  background: transparent;
  border: var(--border-thickness) solid var(--text);
  padding: 0.4em 0.6ch;
}

textarea,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"] {
  width: 100%;
}

.site-footer {
  margin-top: calc(var(--line-height) * 3);
  color: var(--text-muted);
  display: flex;
  gap: 1ch;
  flex-wrap: wrap;
}

.footer-sep {
  color: var(--text-muted);
}

.chroma {
  background: transparent;
  color: inherit;
}

.chroma .lntd {
  vertical-align: top;
}

.chroma .ln {
  color: var(--text-muted);
  padding-right: 1ch;
}

.chroma .k,
.chroma .kd,
.chroma .kn,
.chroma .kp,
.chroma .kr,
.chroma .kt {
  color: var(--text);
}

.chroma .c,
.chroma .cm,
.chroma .c1,
.chroma .cs {
  color: var(--text-muted);
}

/* Visited links - subtle desaturation */
a:visited {
  color: var(--text-muted);
}

a:visited:hover {
  color: var(--accent);
}

/* Enhanced mobile visibility for touch devices */
@media (hover: none) {
  .tag-link,
  .post-link,
  .featured-card h3 a {
    text-decoration-color: var(--accent);
    text-decoration-thickness: var(--border-thickness);
  }
}

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

/* Tools Used Shortcode - Terminal aesthetic matching 404 page */
.tools-used {
  font-family: "Fira Code", "Fira Mono", monospace;
  margin: var(--line-height) 0;
}

.tools-used-section {
  color: var(--accent);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tools-used-entry {
  display: block;
  white-space: nowrap;
}

.tools-used-perms {
  color: var(--text-muted);
  display: inline-block;
  width: 11ch;
}

.tools-used-name {
  color: var(--text);
  display: inline-block;
  width: 18ch;
}

.tools-used-vendor {
  color: var(--text-muted);
  display: inline-block;
  width: 14ch;
}

.tools-used-cost {
  color: var(--text-muted);
  display: inline-block;
  width: 14ch;
}

.tools-used-cost-free {
  color: var(--risk-low);
}

.tools-used-role {
  color: var(--text-muted);
  font-style: italic;
}

.tools-used-divider {
  color: var(--text-muted);
  letter-spacing: 0;
}

@media (max-width: 720px) {
  .tools-used-perms {
    width: 9ch;
  }
  
  .tools-used-name {
    width: 14ch;
  }
  
  .tools-used-vendor {
    width: 11ch;
  }
  
  .tools-used-cost {
    width: 11ch;
  }
  
  .tools-used .prompt-line::before {
    content: "ai$ ";
  }
}

/* =============================================
   SIMPLIFIED TOOLS BADGES
   Lightweight inline tool listing
   ============================================= */

.tools-badges {
  margin: calc(var(--line-height) * 0.5) 0 var(--line-height);
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.tool-badge {
  font-family: var(--font-family);
  white-space: nowrap;
}

.tools-separator {
  margin: 0 0.75ch;
  opacity: 0.4;
  user-select: none;
}
