* { box-sizing: border-box; }

html, body { padding: 0; margin: 0; }
body { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, Noto Sans, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; height: auto; }
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }
h1, h2, h3 { line-height: 0.8; margin: 0 0 .75rem; }
h1 { font-size: clamp(2rem, 6vw, 3rem); text-transform: uppercase; margin: 0 0 2cm; }
h2 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
h3 { font-size: clamp(1.125rem, 2.5vw, 1.25rem); }
.lede { color: var(--muted); max-width: 56ch; }
.muted { color: var(--muted); }
.flow > * + * { margin-top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip-link { position: absolute; left: -1000px; top: 0; background: var(--text); color: var(--bg); padding: .5rem 1rem; border-radius: 8px; }
.skip-link:focus { left: 1rem; z-index: 9999; }


/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .5rem; border-radius: 999px; border: 1px solid var(--border); padding: .6rem 1rem; text-decoration: none; }
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-link { padding: 0; border: 0; text-decoration: underline; border-radius: 0; }
.btn-small { padding: .4rem .8rem; font-size: .875rem; }


/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-media { position: relative; }
.card-media img { display: block; width: 100%; height: auto; }
.chip-on-image { position: absolute; left: .75rem; top: .75rem; background: rgba(0,0,0,.6); color: #fff; border: 1px solid rgba(255,255,255,.2); padding: .25rem .55rem; border-radius: 999px; font-size: .75rem; }
.card-meta { color: var(--muted); font-size: .85rem; margin-bottom: .25rem; }
.author-row { display: inline-flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.author-row .avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.author-name { font-weight: 600; font-size: .9rem; }
.card-media img { border-bottom: 1px solid var(--border); }
.card-body { padding: 1rem; }
.card-title { margin: 0 0 .25rem; }
.section { padding: 3rem 0; }
.section.alt { background: linear-gradient(180deg, rgba(0,0,0,.03), rgba(0,0,0,0)); }
.grid { display: grid; gap: 1rem; }
.cards-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }


/* Header & nav */
.site-header { position: sticky; top: 0; backdrop-filter: blur(8px); background: color-mix(in srgb, var(--bg), transparent 20%); border-bottom: 1px solid var(--border); z-index: 100; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; }
.logo, .logo-sm { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--text); color: var(--bg); font-weight: 800; }
.logo-sm { width: 32px; height: 32px; font-size: .9rem; }
.site-nav ul { display: flex; gap: 1rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { padding: .4rem .6rem; border-radius: 8px; text-decoration: none; }
.site-nav a.active { background: var(--border); }
.nav-toggle { display: none; background: transparent; border: 0; width: 44px; height: 36px; position: relative; }
.nav-toggle span { position: absolute; left: 8px; right: 8px; height: 2px; background: var(--text); transition: .2s; }
.nav-toggle span:nth-child(2) { top: 16px; } 
.nav-toggle span:nth-child(3) { top: 24px; } 
.nav-toggle span:nth-child(1) { top: 8px; }
@media (max-width: 800px) 
{
  .site-nav ul { display: none; position: absolute; right: 1rem; top: 64px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: .6rem; width: min(90vw, 320px); box-shadow: var(--shadow); }
  .site-nav ul.open { display: block; }
  .nav-toggle { display: inline-block; }
}


/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 2rem 0 .75rem; }
.footer-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.socials { display: flex; gap: .75rem; }


/* Utilities */
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; color: var(--muted); }
.pill-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill-list li { list-style: none; border: 1px solid var(--border); padding: .35rem .6rem; border-radius: 999px; }
.timeline { list-style: none; padding: 0; }
.timeline li { padding: .35rem 0; }
.timeline .time { display: inline-block; width: 64px; color: var(--muted); }
.plain { list-style: none; padding: 0; margin: 0; }
.more { color: var(--muted); }
.hp { display: none !important; }
.form { padding: 1rem; }
.form-row { display: grid; gap: .5rem; margin-bottom: 1rem; }
.form-note code { background: var(--border); padding: .15rem .35rem; border-radius: 4px; }
.filters { margin: 1rem 0; display: flex; gap: .5rem; flex-wrap: wrap; }

/* Theme toggle: fixed bottom-right */
.theme-toggle {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 200;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.theme-toggle:hover { filter: brightness(0.95); }

/* Text clamp utilities */
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 1000; }
.modal.open { display: flex; }
.modal-dialog { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); width: min(900px, 96vw); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); position: relative; padding: 1.25rem; }
.modal-close { position: absolute; right: .5rem; top: .25rem; background: transparent; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--text); }
.modal-body > * + * { margin-top: .75rem; }
