/* ------------------------------------------------------------------
   dmi03.com — minimal theme
   Light palette on :root, dark overrides for both the system setting
   and the explicit [data-theme] switch.
   ------------------------------------------------------------------ */

:root {
  --bg: #fdfdfc;
  --bg-soft: #f5f5f3;
  --surface: #ffffff;
  --text: #17171a;
  --text-muted: #6a6a73;
  --text-faint: #8e8e96;
  --border: #e4e4e1;
  --border-strong: #cfcfca;
  --accent: #2f61d5;
  --accent-soft: rgba(47, 97, 213, 0.09);
  --selection: rgba(47, 97, 213, 0.18);

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter,
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --wrap: 46rem;
  --radius: 10px;
  --step: clamp(1rem, 0.9rem + 0.4vw, 1.0625rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f11;
    --bg-soft: #16181b;
    --surface: #14161a;
    --text: #e9e9ec;
    --text-muted: #9b9ba4;
    --text-faint: #75757e;
    --border: #24272c;
    --border-strong: #3a3e45;
    --accent: #7ea6ff;
    --accent-soft: rgba(126, 166, 255, 0.12);
    --selection: rgba(126, 166, 255, 0.22);
  }
}

:root[data-theme="dark"] {
  --bg: #0e0f11;
  --bg-soft: #16181b;
  --surface: #14161a;
  --text: #e9e9ec;
  --text-muted: #9b9ba4;
  --text-faint: #75757e;
  --border: #24272c;
  --border-strong: #3a3e45;
  --accent: #7ea6ff;
  --accent-soft: rgba(126, 166, 255, 0.12);
  --selection: rgba(126, 166, 255, 0.22);
}

/* ------------------------------------------------------------------ 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; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--step);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

::selection { background: var(--selection); }

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

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

a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  z-index: 20;
}

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

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
}

.brand {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-right: auto;
}

.brand:hover { text-decoration: none; color: var(--accent); }

.site-nav {
  display: flex;
  gap: 1.15rem;
  font-size: 0.9375rem;
}

.site-nav a { color: var(--text-muted); }
.site-nav a:hover { color: var(--text); text-decoration: none; }
.site-nav a.active { color: var(--text); font-weight: 500; }

.search-open,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.search-open:hover,
.theme-toggle:hover { color: var(--text); border-color: var(--border); }

.search-open svg,
.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 30rem) {
  .wrap { padding-inline: 1.15rem; }
  .header-inner { gap: 0.6rem; }
  .site-nav { gap: 0.75rem; font-size: 0.875rem; overflow-x: auto; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
}

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ------------------------------------------------------------------ hero */

main { flex: 1 0 auto; }

.hero { padding: 4.5rem 0 2.5rem; }

.hero-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.hero-avatar {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  flex: none;
}

.hero-text h1 {
  margin: 0;
  font-size: clamp(1.85rem, 1.4rem + 2vw, 2.6rem);
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.hero-tagline {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.hero-links {
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hero-links a {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.28rem 0.85rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.hero-links a:hover {
  text-decoration: none;
  color: var(--text);
  border-color: var(--border-strong);
}

@media (max-width: 34rem) {
  .hero { padding-top: 3rem; }
  .hero-inner { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .hero-avatar { width: 104px; height: 104px; }
}

/* ------------------------------------------------------------- page head */

.page-head { padding: 3.25rem 0 0.5rem; }

.page-head h1 {
  margin: 0;
  font-size: clamp(1.7rem, 1.35rem + 1.4vw, 2.2rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-summary {
  margin: 0.6rem 0 0;
  color: var(--text-muted);
}

.back-link {
  display: inline-block;
  margin-bottom: 0.9rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.back-link::before { content: "← "; }

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

.prose { padding-bottom: 4rem; }

.prose > h2 {
  margin: 3.25rem 0 1.1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 1.3rem;
  letter-spacing: -0.015em;
}

.prose > h2:first-child,
.prose > .entry-meta + h2 { border-top: 0; padding-top: 0; margin-top: 1.75rem; }

.prose h3 { margin: 2rem 0 0.75rem; font-size: 1.075rem; letter-spacing: -0.01em; }
.prose h4 { margin: 1.5rem 0 0.5rem; font-size: 0.98rem; }

.prose p, .prose ul, .prose ol { margin: 0 0 1.05rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin-bottom: 0.35rem; }
.prose li::marker { color: var(--text-faint); }

.prose blockquote {
  margin: 1.25rem 0;
  padding: 0.15rem 0 0.15rem 1rem;
  border-left: 2px solid var(--border-strong);
  color: var(--text-muted);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08em 0.34em;
}

.prose pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  line-height: 1.55;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.855rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 0 0 1.25rem;
  display: block;
  overflow-x: auto;
}

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

.prose th { font-weight: 600; color: var(--text-muted); font-size: 0.85rem; letter-spacing: 0.02em; text-transform: uppercase; }

.prose .headerlink {
  margin-left: 0.4rem;
  color: var(--text-faint);
  opacity: 0;
  text-decoration: none;
  font-weight: 400;
}

.prose h2:hover .headerlink,
.prose h3:hover .headerlink,
.prose h4:hover .headerlink { opacity: 1; }

.prose .admonition {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 1.25rem 0;
  background: var(--surface);
}

.prose .admonition-title { margin: 0 0 0.4rem; font-weight: 600; }
.prose .admonition > :last-child { margin-bottom: 0; }

/* ----------------------------------------------------------- section bar */

.section-note {
  margin: -0.4rem 0 1.4rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.section-more {
  margin-top: 1.25rem;
  font-size: 0.9375rem;
}

/* ----------------------------------------------------------------- cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 0.85rem;
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding: 1rem 1.05rem 1.05rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

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

.card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

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

.card-summary {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9125rem;
  line-height: 1.55;
  flex: 1 0 auto;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-faint);
}

.card-meta a { position: relative; z-index: 1; color: var(--text-faint); }
.card-meta a:hover { color: var(--accent); }

/* ----------------------------------------------------------------- chips */

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

.tag {
  font-size: 0.75rem;
  line-height: 1.7;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--bg);
  white-space: nowrap;
}

.status {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.05rem 0.45rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.stars::before { content: "★ "; color: var(--text-faint); }

/* ------------------------------------------------------------ meta strip */

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.75rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------- contributions */

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

.contrib {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.contrib:first-child { padding-top: 0.25rem; }

.contrib-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem;
}

.contrib-repo { font-weight: 600; color: var(--text); }
.contrib-repo:hover { color: var(--accent); text-decoration: none; }

.contrib-desc {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  font-size: 0.9125rem;
}

.contrib-prs {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9125rem;
}

.contrib-prs li {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.12rem 0;
  color: var(--text-muted);
}

.contrib-prs .pr-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  flex: none;
}

.contrib-prs a { color: var(--text); }
.contrib-prs a:hover { color: var(--accent); }

/* ---------------------------------------------------------------- skills */

.skill-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1.25rem 1.75rem;
  margin: 0;
}

.skill-group h3 {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}

/* -------------------------------------------------------------- data box */

.empty {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9125rem;
}

.updated {
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ---------------------------------------------------------------- search */

.filter {
  display: none;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1.25rem;
}

.filter--ready { display: flex; }

/* Cards and contribution rows set their own display, which would otherwise
   beat the browser default for [hidden] and keep filtered-out items on screen. */
[data-search][hidden] { display: none; }

.filter-input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.75rem;
}

.filter-input::placeholder { color: var(--text-faint); }
.filter-input:focus { border-color: var(--border-strong); outline: none; }
.filter-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.filter-count {
  flex: none;
  font-size: 0.8rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(2rem, 12vh, 8rem) 1rem 2rem;
}

/* The display above would otherwise beat the browser default for [hidden],
   leaving the closed dialog on top of the page and swallowing every click. */
.search-modal[hidden] { display: none; }

body.search-lock { overflow: hidden; }

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 12, 0.42);
  backdrop-filter: blur(2px);
}

.search-panel {
  position: relative;
  width: min(38rem, 100%);
  max-height: min(32rem, 76vh);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.search-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  fill: none;
  stroke: var(--text-faint);
  stroke-width: 1.6;
  stroke-linecap: round;
}

#search-input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: none;
  border: 0;
  outline: none;
  padding: 0.15rem 0;
}

#search-input::placeholder { color: var(--text-faint); }

/* The native clear button sits awkwardly next to the esc affordance. */
.filter-input::-webkit-search-cancel-button,
#search-input::-webkit-search-cancel-button { display: none; }

.search-close {
  flex: none;
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
}

.search-close:hover { color: var(--text); border-color: var(--border-strong); }

.search-results {
  overflow-y: auto;
  padding: 0.4rem;
}

.search-group {
  margin: 0.6rem 0 0.25rem;
  padding: 0 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}

.search-hit {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  color: var(--text);
}

.search-hit:hover { text-decoration: none; background: var(--bg-soft); }
.search-hit.is-active { background: var(--accent-soft); }

.search-hit-title { display: block; font-weight: 600; font-size: 0.9375rem; }

.search-hit-summary,
.search-hit-meta {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-hit-meta { color: var(--text-faint); font-size: 0.78rem; margin-top: 0.1rem; }

.search-empty {
  margin: 0;
  padding: 1.25rem 0.75rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9125rem;
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}

.footer-inner p { margin: 0; }
.site-footer a { color: var(--text-muted); }
.site-footer .sep { margin: 0 0.35rem; }
