/* ==========================================================================
   Piotr Mankowski — Personal Site Stylesheet (v1: L4 Minimalist Routing Index)
   Light Mode = Design B (Swiss Technical Grid)
   Dark Mode  = Design C (Nordic Studio Dark)
   ========================================================================== */

:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #f1f5f9;
  --card: #ffffff;
  --fg: #0f172a;
  --muted: #334155;
  --subtle: #64748b;
  --border: #cbd5e1;
  --border-subtle: #e2e8f0;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #dbeafe;
  --secondary: #0f766e;
  --radius: 3px;
  --shadow: none;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f17;
  --surface: #111827;
  --card: #161f30;
  --fg: #f1f5f9;
  --muted: #cbd5e1;
  --subtle: #94a3b8;
  --border: #1e293b;
  --border-subtle: #172033;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --secondary: #34d399;
  --radius: 6px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* Layout Shell (L4 Minimalist Index) */
.shell {
  max-width: 44rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 4.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .shell {
    padding: 4.5rem 2rem 5rem;
  }
}

/* Header & Navigation */
.site-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
}

.header-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

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

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

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.domain-badge {
  color: var(--subtle);
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--surface);
}

.theme-toggle {
  appearance: none;
  background-color: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.2rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.role-line {
  margin: 0.45rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
}

.role-line strong {
  color: var(--fg);
  font-weight: 600;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 0.15rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

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

.site-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* Main Content Typography */
main {
  flex: 1;
}

.lead {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--fg);
  margin: 0 0 1rem;
}

.prose-muted {
  font-size: 0.9375rem;
  line-height: 1.68;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

a.inline-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--subtle);
  margin: 2.25rem 0 0.75rem;
}

.page-heading {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 0.5rem;
  color: var(--fg);
}

/* Directory Routing Table (L4 Index) */
.directory-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border);
}

.directory-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.25rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

@media (min-width: 560px) {
  .directory-item {
    flex-direction: row;
    align-items: baseline;
    gap: 1rem;
  }
}

.directory-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.directory-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.directory-desc {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

.directory-tag {
  color: var(--subtle);
  font-size: 0.75rem;
  white-space: nowrap;
}

/* Subpage Artifact Cards */
.card-stack {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-top: 1.25rem;
}

.card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.card-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fg);
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--subtle);
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border-radius: var(--radius);
  background-color: var(--accent-soft);
  color: var(--accent);
}

.card-body {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted);
}

.card-footer {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background-color: var(--surface);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  border: 1px solid var(--border-subtle);
}

/* Footer */
.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--subtle);
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  color: var(--subtle);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}
