/* ===========================================================================
   ruza.eu — unified stylesheet
   Shared by: /index.html, /articles/index.html, /articles/*.html
   =========================================================================== */

/* ---- Design tokens (dark mode by default, light mode via media query) ---- */
:root {
  --bg: #000000;
  --surface: #0d0d0d;
  --surface-2: #161616;
  --border: #262626;
  --border-hover: #3d3d3d;
  --text: #f0f0f0;
  --text-muted: #909090;
  --text-dim: #505050;
  --accent: #ffff00;
  --accent-soft: #cccc00;
  --accent-dim: #888800;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f7f7f7;
    --border: #e0e0e0;
    --border-hover: #c0c0c0;
    --text: #1a1a1a;
    --text-muted: #606060;
    --text-dim: #a0a0a0;
    --accent: #808000;
    --accent-soft: #999900;
    --accent-dim: #b0b050;
  }
}

/* Explicit theme overrides (via data-theme attribute on <html>, set by JS) */
/* These win over media queries because of attribute specificity */
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #0d0d0d;
  --surface-2: #161616;
  --border: #262626;
  --border-hover: #3d3d3d;
  --text: #f0f0f0;
  --text-muted: #909090;
  --text-dim: #505050;
  --accent: #ffff00;
  --accent-soft: #cccc00;
  --accent-dim: #888800;
}

:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --border: #e0e0e0;
  --border-hover: #c0c0c0;
  --text: #1a1a1a;
  --text-muted: #606060;
  --text-dim: #a0a0a0;
  --accent: #808000;
  --accent-soft: #999900;
  --accent-dim: #b0b050;
}

/* ---- Reset & base ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}
.wrap-wide { max-width: 720px; }

/* ---- Shared divider ---- */
.divider {
  height: 1px;
  margin: 2.5rem 0;
  background: linear-gradient(to right, transparent, var(--border) 20%, var(--border) 80%, transparent);
}

/* ---- Shared footer ---- */
footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
}
footer .blink {
  display: inline-block;
  width: 8px;
  height: 2px;
  background: var(--text-muted);
  vertical-align: baseline;
  margin-left: 4px;
  animation: blink 1.3s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

/* ===========================================================================
   Homepage (/index.html)
   =========================================================================== */

.prompt {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}
.prompt .cmd { color: var(--text-dim); }

.hero { text-align: center; margin-bottom: 2rem; }

.yinyang {
  display: block;
  margin: 0 auto 1.5rem;
  width: 120px;
  height: 120px;
  cursor: pointer;
  transition: transform 20s linear, opacity 0.2s;
  opacity: 0.95;
}
.yinyang:hover {
  transform: rotate(360deg);
  opacity: 1;
}
.yinyang:active { opacity: 0.7; }

.theme-indicator {
  display: block;
  text-align: center;
  margin: -0.75rem auto 1.5rem;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: lowercase;
  cursor: pointer;
  transition: color 0.15s;
  user-select: none;
}
.theme-indicator:hover { color: var(--text-muted); }

h1 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 8px;
}

/* Social links grid */
.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.link-card {
  display: block;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.link-card:hover {
  border-color: var(--border-hover);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.link-card:active { transform: translateY(0); }

.link-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.chip {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 0.5px solid var(--border);
}

.label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.handle {
  color: var(--accent);
  font-size: 13px;
  word-break: break-all;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,0,0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}
.link-card:hover .handle { text-decoration-color: var(--accent); }

/* GPG section */
.gpg { margin-top: 0.5rem; }
.gpg-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.gpg-title svg { flex-shrink: 0; }
.gpg-box {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.gpg-key {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  user-select: all;
}
.gpg-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}
.gpg-actions a,
.gpg-actions button {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 11px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.gpg-actions a:hover,
.gpg-actions button:hover { opacity: 0.7; }
.gpg-note {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-dim);
}
.gpg-note a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Mastodon feed */
.toots-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.toots-title svg { flex-shrink: 0; }

.toots-status {
  color: var(--text-dim);
  font-size: 11px;
  text-align: center;
  padding: 0.5rem 0;
}
.toots-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toot {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.toot-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  gap: 8px;
}
.toot-date { color: var(--text-muted); }
.toot-link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,0,0.35);
  text-underline-offset: 3px;
  font-size: 10px;
  white-space: nowrap;
}
.toot-link:hover { text-decoration-color: var(--accent); }
.toot-content {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  word-break: break-word;
}
.toot-content p { margin: 0 0 8px; }
.toot-content p:last-child { margin-bottom: 0; }
.toot-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,0,0.35);
  text-underline-offset: 2px;
  word-break: break-all;
}
.toot-content a:hover { text-decoration-color: var(--accent); }
.toot-content .invisible { display: none; }
.toot-content .ellipsis::after { content: "…"; }

/* ===========================================================================
   Writing section (shared by homepage + /articles/index.html)
   =========================================================================== */

.posts-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.posts-title svg { flex-shrink: 0; }

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.post {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 14px;
  align-items: baseline;
}
.post-date {
  color: var(--text-dim);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.post-title {
  color: var(--accent);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,0,0.35);
  text-underline-offset: 3px;
  word-break: break-word;
}
.post-title:hover { text-decoration-color: var(--accent); }
.post-desc {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
}
.posts-all {
  margin-top: 14px;
  font-size: 11px;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,0,0.35);
  text-underline-offset: 3px;
  display: inline-block;
}
.posts-all:hover { text-decoration-color: var(--accent); }

/* ===========================================================================
   Article index (/articles/index.html)
   =========================================================================== */

.breadcrumb {
  margin-bottom: 2.5rem;
  font-size: 12px;
}
.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb a:hover { color: var(--accent); }

.page-header { margin-bottom: 2rem; }
.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text);
  margin-bottom: 6px;
}
.page-title svg { flex-shrink: 0; color: var(--text-muted); }
.page-desc {
  color: var(--text-muted);
  font-size: 13px;
}

.year-heading {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 2rem 0 1rem;
}
.year-group:first-child .year-heading { margin-top: 0; }

/* ===========================================================================
   Individual article (/articles/*.html)
   =========================================================================== */

.article-header { margin-bottom: 2rem; }

.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}
.article-meta .dot {
  width: 3px;
  height: 3px;
  background: var(--text-dim);
  border-radius: 50%;
}

.article-title {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 10px;
}
.article-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

/* --- Article body (prose) --- */
.article-body {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
}
.article-body > * + * { margin-top: 1.25rem; }
.article-body p { color: var(--text); }
.article-body h2 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-top: 2.5rem;
}
.article-body h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-top: 2rem;
}
.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,0,0.35);
  text-underline-offset: 3px;
}
.article-body a:hover { text-decoration-color: var(--accent); }
.article-body strong { font-weight: 500; color: var(--text); }
.article-body em { font-style: italic; color: var(--text); }
.article-body ul, .article-body ol { padding-left: 1.5rem; }
.article-body ul { list-style: none; }
.article-body ul > li { position: relative; }
.article-body ul > li::before {
  content: '·';
  position: absolute;
  left: -1.1rem;
  color: var(--text-dim);
  font-weight: 500;
}
.article-body ol {
  list-style-type: decimal;
  font-variant-numeric: tabular-nums;
}
.article-body li + li { margin-top: 0.5rem; }
.article-body blockquote {
  padding: 0.5rem 0 0.5rem 1.25rem;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
}
.article-body code {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.9em;
  color: var(--accent);
}
.article-body pre {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 13px;
}
.article-body pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text);
  font-size: inherit;
}
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 0.5px solid var(--border);
  display: block;
  margin: 1.5rem auto;
}
.article-body figure img { margin-bottom: 0.5rem; }
.article-body figcaption {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}
.article-body hr {
  border: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border) 20%, var(--border) 80%, transparent);
  margin: 2rem 0;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.article-body th, .article-body td {
  padding: 8px 10px;
  border-bottom: 0.5px solid var(--border);
  text-align: left;
}
.article-body th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 12px;
  flex-wrap: wrap;
}
.article-nav a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(255,255,0,0.35);
  text-underline-offset: 3px;
}
.article-nav a:hover { text-decoration-color: var(--accent); }

/* ===========================================================================
   Responsive
   =========================================================================== */

@media (max-width: 480px) {
  .wrap { padding: 2rem 1rem 3rem; }
  h1 { font-size: 26px; }
  .yinyang { width: 100px; height: 100px; }
}

@media (max-width: 420px) {
  .post {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
