/* Site styles for cypix.cc - minimal, fast, old-school blog */

:root {
  --bg: #101216;
  --fg: #e6e6e6;
  --muted: #9aa0a6;
  --link: #8ab4f8;
  --link-hover: #b3d1ff;
  --accent: #64d2ff;
  --card: #171a1f;
  --border: #2b3038;
  --accent-border: #3a82f7;
  --shadow: rgba(0, 0, 0, 0.35);

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", "Liberation Sans", sans-serif;
}

/* Prefer light colors when user's system is set to light mode */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --fg: #0b1220;
    --muted: #475569;
    --link: #0b6bcb;
    --link-hover: #095cad;
    --accent: #0ea5e9;
    --card: #f8fafc;
    --border: #e5e7eb;
    --shadow: rgba(2, 6, 23, 0.08);
  }
}

/* Base reset and typography */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

::selection {
  background: color-mix(in oklab, var(--accent) 25%, transparent);
  color: var(--fg);
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 120ms ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

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

blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--border);
  background: color-mix(in oklab, var(--card) 92%, var(--bg));
  color: color-mix(in oklab, var(--fg) 86%, var(--muted));
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--card);
  border: 1px solid var(--border);
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.6rem;
  text-align: left;
}

thead th {
  background: color-mix(in oklab, var(--card) 92%, var(--bg));
}

/* Layout */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem;
}

@media (max-width: 480px) {
  .container {
    padding: 1rem;
  }
}

/* Header / Nav */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 1px 0 0 var(--border), 0 8px 24px -18px var(--shadow);
}

.site-title {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.2;
}

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

.site-tagline {
  color: var(--muted);
  margin: 0.25rem 0 0 0;
}

.site-nav {
  margin-top: 0.5rem;
}

.site-nav a {
  margin-right: 1rem;
  color: var(--muted);
}

.site-nav a:last-child {
  margin-right: 0;
}

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

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

/* Posts */
.post {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.post-title {
  margin: 0 0 0.25rem 0;
  line-height: 1.25;
}

.post-meta {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 0.75rem;
}

.post-content {
  overflow-wrap: anywhere;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 1.25rem;
}

.post-content img {
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
}

.excerpt {
  color: color-mix(in oklab, var(--fg) 86%, var(--muted));
}

/* Tags */
.tag {
  display: inline-block;
  background: color-mix(in oklab, var(--card) 92%, var(--bg));
  border: 1px solid var(--border);
  padding: 0.1rem 0.45rem;
  border-radius: 0.35rem;
  color: color-mix(in oklab, var(--fg) 86%, var(--muted));
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: nowrap;
}

/* Code blocks */
code,
pre {
  font-family: var(--mono);
  background: #0b0d10;
  border: 1px solid var(--border);
}

pre {
  padding: 0.75rem;
  overflow: auto;
  border-radius: 0.35rem;
}

code {
  padding: 0.12rem 0.25rem;
  border-radius: 0.25rem;
}

/* Markdown codehilite (from Python-Markdown) */
.codehilite,
.highlight {
  background: #0b0d10;
  color: #e6e6e6;
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  padding: 0.75rem;
  overflow: auto;
}

.codehilite pre,
.highlight pre {
  margin: 0;
  border: 0;
  background: transparent;
}

/* Minimal Pygments token hints (safe, generic) */
.codehilite .k,
.highlight .k { color: #c792ea; }          /* keyword */
.codehilite .s,
.highlight .s { color: #ecc48d; }          /* string */
.codehilite .n,
.highlight .n { color: #e6e6e6; }          /* name */
.codehilite .c,
.highlight .c { color: #7f8c98; font-style: italic; } /* comment */
.codehilite .o,
.highlight .o { color: #89ddff; }          /* operator */
.codehilite .p,
.highlight .p { color: #e6e6e6; }          /* punctuation */
.codehilite .nd,
.highlight .nd { color: #82aaff; }         /* decorator */
.codehilite .nf,
.highlight .nf { color: #82aaff; }         /* function */
.codehilite .nt,
.highlight .nt { color: #c3e88d; }         /* tag */

/* Forms (minimal) */
input,
textarea,
select {
  width: 100%;
  max-width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 25%, transparent);
}

/* Accessibility helpers */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Print tweaks */
@media print {
  :root {
    --bg: #ffffff;
    --fg: #000000;
    --muted: #333333;
    --card: #ffffff;
    --border: #dddddd;
  }
  a {
    color: inherit;
    text-decoration: underline;
  }
  .site-header,
  .site-footer,
  .site-nav {
    display: none;
  }
  .container {
    max-width: none;
    padding: 0;
  }
}
