:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #0f172a; /* slate-900 */
  --muted: #64748b; /* slate-500 */
  --border: #e5e7eb; /* gray-200 */
  --card: #ffffff;
  --accent: #2563eb; /* blue-600 */
  --accent-fg: #ffffff;
  --ring: rgba(37, 99, 235, .35);
}

[data-theme="dark"] {
  --bg: #0b0f1a;
  --fg: #e5e7eb;
  --muted: #94a3b8;
  --border: #1f2937;
  --card: #0f172a;
  --accent: #60a5fa;
  --accent-fg: #0b0f1a;
  --ring: rgba(96, 165, 250, .25);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; line-height: 1.7;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg); color: var(--fg);
}

.container { max-width: 1100px; margin-inline: auto; padding-inline: 1.25rem; }

header.site-header {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(140%) blur(8px);
  background: color-mix(in oklab, var(--bg), transparent 20%);
  border-bottom: 1px solid var(--border);
}
header .bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .875rem 0; }
header .title { margin: 0; font-size: 1.125rem; letter-spacing: .2px; }
header .nav { display: flex; align-items: center; gap: .5rem; margin-left: auto; margin-right: .75rem; }
.nav-link { color: inherit; text-decoration: none; padding: .4rem .6rem; border-radius: .5rem; border: 1px solid transparent; }
.nav-link:hover { background: color-mix(in oklab, var(--card), var(--fg) 5%); border-color: var(--border); }

main { padding-block: 1.5rem; }

footer.site-footer { margin-top: 3rem; border-top: 1px solid var(--border); }
footer .inner { padding: 2rem 0; text-align: center; }
footer img { vertical-align: middle; }

.btn { padding: .5rem .9rem; border-radius: .6rem; border: 1px solid var(--border); background: transparent; color: var(--fg); cursor: pointer; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }

/* Inputs */
.input { display: inline-block; padding: .5rem .7rem; border-radius: .5rem; border: 1px solid var(--border); background: var(--card); color: var(--fg); }
.input:focus { outline: none; box-shadow: 0 0 0 4px var(--ring); }

/* Simple tooltip compatible with [data-tip] (works for ez-tip patterns) */
.has-tip { position: relative; }
.has-tip[data-tip]:hover::after,
.has-tip[data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; inset-inline-start: 50%; transform: translateX(-50%); bottom: calc(100% + 8px); background: var(--fg); color: var(--bg); padding: .35rem .5rem; border-radius: .4rem; white-space: nowrap; font-size: .85rem; z-index: 20; }
.has-tip[data-tip]:hover::before,
.has-tip[data-tip]:focus-visible::before { content: ""; position: absolute; inset-inline-start: 50%; transform: translateX(-50%); bottom: calc(100% + 4px); border: 6px solid transparent; border-top-color: var(--fg); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.card { display: block; text-decoration: none; color: inherit; border: 1px solid var(--border); border-radius: .8rem; background: var(--card); padding: 1rem; transition: transform .12s ease, box-shadow .12s ease; }
.card:hover { transform: translateY(-1px); box-shadow: 0 6px 18px -6px rgba(0,0,0,.2); }

img { max-width: 100%; height: auto; border-radius: .6rem; }

.prose { max-width: 70ch; }
.muted { color: var(--muted); }

.box { height: 120px; border: 1px solid var(--border); border-radius: .8rem; display: flex; align-items: center; justify-content: center; margin: 1rem 0; }
.panel { border: 1px solid var(--border); border-radius: .8rem; padding: 1rem; }
