/* ==========================================================================
   blindwiz.com — design system
   Light theme is default; [data-theme="dark"] overrides.
   ========================================================================== */

:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas,
    monospace;

  --bg: #ffffff;
  --surface: #f5f6f8;
  --surface-2: #eceef2;
  --text: #191c23;
  --muted: #525b6b;
  --border: #dde1e8;
  --accent: #3538cd;
  --accent-hover: #2a2da6;
  --accent-contrast: #ffffff;
  --mark: #fff3c4;
  --danger: #b3261e;

  --code-bg: #f0f1f4;
  --code-text: #24292f;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 4px 6px rgba(16, 24, 40, 0.07), 0 10px 24px rgba(16, 24, 40, 0.1);

  --container: 68rem;
}

[data-theme="dark"] {
  --bg: #0e1014;
  --surface: #161a21;
  --surface-2: #1e242e;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --border: #2a3140;
  --accent: #93a5ff;
  --accent-hover: #b3c0ff;
  --accent-contrast: #0b0d12;
  --mark: #4d4000;

  --code-bg: #1a1f27;
  --code-text: #d6dae2;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.45), 0 10px 24px rgba(0, 0, 0, 0.55);
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  padding-block: 2.5rem 4rem;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 700;
  margin: 0 0 0.75em;
  text-wrap: balance;
}

h1 { font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 1.15rem + 0.7vw, 1.65rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

img { max-width: 100%; height: auto; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

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

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

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

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding-block: 0.9rem;
}

.site-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

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

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

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

.site-nav a[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-contrast);
}

.header-search {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}

.header-search input[type="search"] {
  width: 11rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.header-search button,
.theme-toggle,
.button {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.header-search button:hover,
.theme-toggle:hover,
.button:hover {
  background: var(--surface-2);
}

.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  text-decoration: none;
  display: inline-block;
}

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

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.theme-icon { font-size: 1rem; line-height: 1; }

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

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-block: 2rem;
  margin-top: auto;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}

.footer-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

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

.hero {
  padding-block: 3rem 2.5rem;
}

.hero h1 { margin-bottom: 0.35em; }

.hero .tagline {
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  color: var(--muted);
  max-width: 46ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.section {
  margin-top: 3rem;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-header h2 { margin: 0; }

.view-all { font-size: 0.95rem; white-space: nowrap; }

/* --- Cards & lists ------------------------------------------------------------ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.25rem;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-screenshot {
  display: block;
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.1rem 1.15rem;
  flex: 1;
}

.card-title {
  margin: 0;
  font-size: 1.1rem;
}

.card-title a {
  color: var(--text);
  text-decoration: none;
}

.card-title a:hover { color: var(--accent); }

.card-summary {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
  flex: 1;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.item-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.item-list h3 { margin: 0 0 0.35rem; }

.item-list h3 a { text-decoration: none; }
.item-list h3 a:hover { text-decoration: underline; }

.item-meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0;
}

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

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  text-transform: uppercase;
}

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

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
}

.chip {
  font-size: 0.8rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  text-decoration: none;
}

a.chip:hover {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* --- Filter nav (projects) ----------------------------------------------------- */

.filter-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.filter-nav a {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}

.filter-nav a:hover { background: var(--surface-2); }

.filter-nav a[aria-current="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* --- Article / prose ----------------------------------------------------------- */

.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.article-header h1 { margin-bottom: 0.4rem; }

.article-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.prose {
  max-width: 72ch;
}

.prose > * + * { margin-top: 1.1em; }

.prose h2, .prose h3, .prose h4 { margin-top: 2em; }

.prose ul, .prose ol { padding-left: 1.4em; }

.prose li + li { margin-top: 0.3em; }

.prose blockquote {
  margin-inline: 0;
  padding: 0.4rem 1.2rem;
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  overflow-x: auto;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1.55;
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

.prose th, .prose td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.8rem;
  text-align: left;
}

.prose th { background: var(--surface); }

.prose mark { background: var(--mark); color: inherit; }

.prose kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.1em 0.4em;
  background: var(--surface);
}

/* --- Series box ------------------------------------------------------------------ */

.series-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.series-box h2 { font-size: 1.05rem; margin-bottom: 0.5rem; }

.series-box ol { margin: 0; padding-left: 1.4rem; }

.series-box li + li { margin-top: 0.25rem; }

/* --- Pagination --------------------------------------------------------------------- */

.pagination ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  margin: 2.5rem 0 0;
  padding: 0;
}

.pagination a, .pagination .current {
  display: inline-block;
  min-width: 2.4rem;
  text-align: center;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
}

.pagination .current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
}

.pagination a:hover { background: var(--surface-2); }

/* --- Search results --------------------------------------------------------------------- */

.search-form-large {
  display: flex;
  gap: 0.5rem;
  max-width: 34rem;
  margin-bottom: 2rem;
}

.search-form-large input[type="search"] {
  flex: 1;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.results-section { margin-top: 2rem; }

.results-section > h2 {
  font-size: 1.15rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.result-type {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.no-results {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}

/* --- Breadcrumbs --------------------------------------------------------------------- */

.breadcrumb {
  margin: 0 0 1.5rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.92rem;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--muted);
}

/* --- Error pages --------------------------------------------------------------------- */

.error-page {
  text-align: center;
  padding-block: 4rem;
}

.error-page .error-code {
  font-size: clamp(4rem, 3rem + 8vw, 7rem);
  font-weight: 800;
  color: var(--border);
  line-height: 1;
  margin: 0;
}

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

@media (max-width: 720px) {
  .header-inner { gap: 0.6rem 1rem; }
  .header-search { order: 3; margin-left: 0; width: 100%; }
  .header-search input[type="search"] { flex: 1; width: auto; }
  .site-nav { order: 2; width: 100%; }
  main { padding-block: 1.75rem 3rem; }
}

@media (max-width: 420px) {
  .theme-label { display: none; }
}

/* --- Footer grid & social navbar ---------------------------------------------- */

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  margin-bottom: 1.5rem;
}

.footer-heading {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0.3rem 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.social-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.social-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}

.social-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.social-icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
  flex-shrink: 0;
}

/* --- Flash messages ------------------------------------------------------------- */

.messages {
  margin-top: 1.25rem;
}

.message {
  margin: 0 0 0.5rem;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

.message-success {
  border-left: 4px solid #2e7d32;
}

.message-error {
  border-left: 4px solid var(--danger);
}

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

.contact-form {
  max-width: 34rem;
  display: grid;
  gap: 1.1rem;
  margin-top: 1.5rem;
}

.form-field {
  display: grid;
  gap: 0.3rem;
}

.form-field label {
  font-weight: 600;
}

.form-field input[type="text"],
.form-field input[type="email"],
.form-field textarea {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.form-field textarea {
  resize: vertical;
}

.form-field ul.errorlist {
  margin: 0;
  padding-left: 0;
  list-style: none;
  color: var(--danger);
  font-size: 0.9rem;
}

.form-errors {
  color: var(--danger);
}

/* Honeypot: off-screen but not display:none, so naive bots still fill it. */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
