/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

/* EdibleCSS v0.1.0
 * A primitive, classless CSS framework for developers with no design skills
 * License: MIT
 * https://github.com/svmukhin/edible-css
 */

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

/* CSS Reset/Normalize */

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

* {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

ul[class],
ol[class] {
  list-style: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

a {
  text-decoration: none;
  color: inherit;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

fieldset {
  border: none;
}

legend {
  padding: 0;
}

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

:root {
  /* Color Palette - Light Mode (GitHub-inspired) */
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #eaeef2;
  --text-primary: #24292f;
  --text-secondary: #57606a;
  --border: #d0d7de;
  --accent: #0969da;
  
  /* Button Colors - WCAG AA compliant (4.5:1 contrast with white text) */
  --button-bg: #0969da;
  --button-bg-hover: #0860ca;
  
  /* Typography Scale - Modular Scale (1.25 ratio - Major Third) */
  --font-sm: 0.8rem;      /* 12.8px - small text, captions */
  --font-md: 1rem;        /* 16px - body text, paragraphs */
  --font-lg: 1.25rem;     /* 20px - h6 */
  --font-xl: 1.563rem;    /* 25px - h5 */
  --font-2xl: 1.953rem;   /* 31.25px - h4 */
  --font-3xl: 2.441rem;   /* 39px - h3 */
  --font-4xl: 3.052rem;   /* 48.8px - h2, h1 */
  
  /* Spacing System - 8px base unit with T-shirt sizing */
  --space-xs: 0.25rem;    /* 4px - inline spacing */
  --space-sm: 0.5rem;     /* 8px - small gaps */
  --space-md: 1rem;       /* 16px - default spacing */
  --space-lg: 1.5rem;     /* 24px - larger spacing */
  --space-xl: 2rem;       /* 32px - section spacing */
  --space-2xl: 3rem;      /* 48px - major section spacing */
}

/* Color Palette - Dark Mode */

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #1c2128;
    --text-primary: #e6edf3;
    --text-secondary: #7d8590;
    --border: #30363d;
    --accent: #58a6ff;
    --button-bg: #1f6feb;
    --button-bg-hover: #388bfd;
  }
}

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

html {
  /* Base font size for mobile - will be adjusted at larger breakpoints */
  font-size: 100%; /* 16px */
  scroll-behavior: smooth;

  /* Improve text rendering */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Tablet breakpoint - slightly larger base font */

@media (min-width: 768px) {
  html {
    font-size: 106.25%; /* 17px */
  }
}

/* Desktop breakpoint - larger base font for comfortable reading */

@media (min-width: 1024px) {
  html {
    font-size: 112.5%; /* 18px */
  }
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: var(--font-md);
  line-height: 1.6;

  /* Content width constraint for optimal readability */
  max-width: 70ch;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

/* Responsive spacing - more breathing room on larger screens */

@media (min-width: 768px) {
  body {
    padding: 0 var(--space-lg);
    max-width: 90ch;
  }
}

@media (min-width: 1024px) {
  body {
    padding: 0 var(--space-xl);
    max-width: 110ch;
  }
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-lg) 0;
}

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.2;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child,
h5:first-child,
h6:first-child {
  margin-top: 0;
}

h1 {
  font-size: var(--font-4xl);
}

h2 {
  font-size: var(--font-3xl);
}

h3 {
  font-size: var(--font-2xl);
}

h4 {
  font-size: var(--font-xl);
}

h5 {
  font-size: var(--font-lg);
}

h6 {
  font-size: var(--font-lg);
  font-weight: 600;
}

p {
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

p:last-child {
  margin-bottom: 0;
}

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

a:hover {
  text-decoration-thickness: 2px;
}

a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

strong,
b {
  font-weight: 700;
}

em,
i {
  font-style: italic;
}

small {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

mark {
  background-color: #fff3cd;
  color: #856404;
  padding: 0.125rem 0.25rem;
}

@media (prefers-color-scheme: dark) {
  mark {
    background-color: #664d03;
    color: #fff3cd;
  }
}

del,
s {
  text-decoration: line-through;
  color: var(--text-secondary);
}

ins {
  text-decoration: underline;
  text-decoration-style: solid;
  text-decoration-color: currentColor;
}

sub,
sup {
  font-size: 0.75em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sub {
  bottom: -0.25em;
}

sup {
  top: -0.5em;
}

code,
kbd,
samp,
var {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875em;
  background-color: var(--bg-secondary);
  padding: 0.125rem 0.25rem;
  border-radius: 3px;
}

pre {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875em;
  background-color: var(--bg-secondary);
  padding: var(--space-md);
  border-radius: 4px;
  overflow-x: auto;
  margin: var(--space-md) 0;
  line-height: 1.5;
}

pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  font-size: 1em;
}

kbd {
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

blockquote {
  margin: var(--space-md) 0;
  padding-left: var(--space-md);
  border-left: 4px solid var(--border);
  color: var(--text-secondary);
  font-style: italic;
}

blockquote p:last-child {
  margin-bottom: 0;
}

cite {
  font-style: italic;
  color: var(--text-secondary);
}

abbr[title] {
  -webkit-text-decoration: underline dotted;
          text-decoration: underline dotted;
  cursor: help;
  border-bottom: none;
}

time {
  font-variant-numeric: tabular-nums;
}

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

ul,
ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

ul {
  list-style-type: disc;
}

ol {
  list-style-type: decimal;
}

li {
  margin: var(--space-xs) 0;
  line-height: 1.6;
}

ul ul,
ol ul {
  list-style-type: circle;
  margin: var(--space-xs) 0;
}

ul ul ul,
ol ul ul {
  list-style-type: square;
}

ol ol,
ul ol {
  list-style-type: lower-alpha;
  margin: var(--space-xs) 0;
}

ol ol ol,
ul ol ol {
  list-style-type: lower-roman;
}

li > ul,
li > ol {
  margin-top: var(--space-xs);
  margin-bottom: 0;
}

dl {
  margin: var(--space-md) 0;
}

dt {
  font-weight: 700;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-xs);
}

dt:first-child {
  margin-top: 0;
}

dd {
  margin-left: var(--space-lg);
  margin-bottom: var(--space-sm);
}

dd:last-child {
  margin-bottom: 0;
}

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  overflow-x: auto;
  display: block;
}

thead {
  background-color: var(--bg-secondary);
  border-bottom: 2px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
}

/* Zebra striping */

tbody tr:nth-child(even) {
  background-color: var(--bg-secondary);
}

tbody tr:hover {
  background-color: var(--bg-tertiary);
}

th,
td {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  vertical-align: top;
}

th {
  font-weight: 700;
  color: var(--text-primary);
}

td {
  color: var(--text-primary);
}

th[align="center"],
td[align="center"] {
  text-align: center;
}

th[align="right"],
td[align="right"] {
  text-align: right;
}

/* Responsive tables */

@media (max-width: 768px) {
  table {
    font-size: var(--font-sm);
  }
  
  th,
  td {
    padding: var(--space-xs) var(--space-sm);
  }
}

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="time"],
textarea {
  display: block;
  width: 100%;
  padding: var(--space-sm);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: var(--space-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="month"]:focus,
input[type="week"]:focus,
input[type="time"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

@media (prefers-color-scheme: dark) {
  input[type="text"]:focus,
  input[type="email"]:focus,
  input[type="password"]:focus,
  input[type="search"]:focus,
  input[type="url"]:focus,
  input[type="tel"]:focus,
  input[type="number"]:focus,
  input[type="date"]:focus,
  input[type="datetime-local"]:focus,
  input[type="month"]:focus,
  input[type="week"]:focus,
  input[type="time"]:focus,
  textarea:focus {
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
  }
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

input[type="text"]:-moz-read-only, input[type="email"]:-moz-read-only, input[type="password"]:-moz-read-only, input[type="search"]:-moz-read-only, input[type="url"]:-moz-read-only, input[type="tel"]:-moz-read-only, input[type="number"]:-moz-read-only, textarea:-moz-read-only {
  background-color: var(--bg-secondary);
  cursor: not-allowed;
  opacity: 0.6;
}

input[type="text"]:disabled,
input[type="email"]:disabled,
input[type="password"]:disabled,
input[type="search"]:disabled,
input[type="url"]:disabled,
input[type="tel"]:disabled,
input[type="number"]:disabled,
input[type="date"]:disabled,
input[type="datetime-local"]:disabled,
input[type="month"]:disabled,
input[type="week"]:disabled,
input[type="time"]:disabled,
textarea:disabled,
input[type="text"]:read-only,
input[type="email"]:read-only,
input[type="password"]:read-only,
input[type="search"]:read-only,
input[type="url"]:read-only,
input[type="tel"]:read-only,
input[type="number"]:read-only,
textarea:read-only {
  background-color: var(--bg-secondary);
  cursor: not-allowed;
  opacity: 0.6;
}

select {
  display: block;
  width: 100%;
  padding: var(--space-sm);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

@media (prefers-color-scheme: dark) {
  select:focus {
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
  }
}

select:disabled {
  background-color: var(--bg-secondary);
  cursor: not-allowed;
  opacity: 0.6;
}

select[multiple] {
  min-height: 8rem;
}

option {
  padding: var(--space-xs);
}

button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.6;
  color: #ffffff;
  background-color: var(--button-bg);
  border: 1px solid var(--button-bg);
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
  margin-bottom: var(--space-sm);
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
input[type="reset"]:hover {
  background-color: var(--button-bg-hover);
  border-color: var(--button-bg-hover);
}

button:focus,
input[type="submit"]:focus,
input[type="button"]:focus,
input[type="reset"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
}

@media (prefers-color-scheme: dark) {
  button:focus,
  input[type="submit"]:focus,
  input[type="button"]:focus,
  input[type="reset"]:focus {
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.4);
  }
}

button:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled,
input[type="reset"]:disabled {
  background-color: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-secondary);
  cursor: not-allowed;
  opacity: 0.6;
}

button:active:not(:disabled),
input[type="submit"]:active:not(:disabled),
input[type="button"]:active:not(:disabled),
input[type="reset"]:active:not(:disabled) {
  transform: translateY(1px);
}

input[type="checkbox"],
input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  margin-right: var(--space-xs);
  cursor: pointer;
  vertical-align: middle;
  accent-color: var(--accent);
}

input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: var(--space-md);
  margin: var(--space-md) 0;
}

legend {
  font-weight: 700;
  padding: 0 var(--space-xs);
  color: var(--text-primary);
}

label {
  display: inline-block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
}

label:has(+ input[type="checkbox"]),
label:has(+ input[type="radio"]) {
  display: inline;
  margin-bottom: 0;
  font-weight: normal;
}

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: var(--space-md) 0;
  border-radius: 4px;
}

video,
audio,
iframe,
embed,
object {
  max-width: 100%;
  display: block;
  margin: var(--space-md) 0;
}

video {
  border-radius: 4px;
}

svg {
  max-width: 100%;
  height: auto;
  fill: currentColor;
}

picture {
  display: block;
  margin: var(--space-md) 0;
}

picture img {
  margin: 0;
}

canvas {
  display: block;
  max-width: 100%;
  margin: var(--space-md) 0;
}

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

nav {
  background-color: var(--bg-secondary);
  padding: var(--space-md);
  margin: var(--space-md) 0;
  border-radius: 4px;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

nav li {
  margin: 0;
}

nav a {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  text-decoration: none;
  color: var(--text-primary);
  border-radius: 4px;
  transition: background-color 0.2s;
}

nav a:hover {
  background-color: var(--bg-tertiary);
}

nav a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

main {
  display: block;
  margin: var(--space-lg) 0;
}

article {
  margin: var(--space-xl) 0;
  padding: var(--space-lg);
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
}

article:first-child {
  margin-top: 0;
}

aside {
  margin: var(--space-lg) 0;
  padding: var(--space-md);
  background-color: var(--bg-secondary);
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--text-secondary);
}

section {
  margin: var(--space-xl) 0;
}

section:first-child {
  margin-top: 0;
}

header {
  margin: 0 0 var(--space-lg) 0;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

footer {
  margin: var(--space-lg) 0 0 0;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.9em;
}

address {
  font-style: italic;
  margin: var(--space-md) 0;
  color: var(--text-secondary);
}

q {
  font-style: italic;
  quotes: '"' '"' "'" "'";
}

q::before {
  content: open-quote;
}

q::after {
  content: close-quote;
}

details {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: var(--bg-primary);
}

summary {
  cursor: pointer;
  font-weight: 600;
  margin: calc(-1 * var(--space-md));
  padding: var(--space-md);
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  transition: background-color 0.2s;
}

summary:hover {
  background-color: var(--bg-secondary);
}

summary:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

details[open] summary {
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

dialog {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: var(--space-md);
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

progress,
meter {
  display: block;
  width: 100%;
  height: 1.5rem;
  margin: var(--space-sm) 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background-color: var(--bg-secondary);
}

progress::-webkit-progress-bar,
meter::-webkit-meter-bar {
  background-color: var(--bg-secondary);
  border-radius: 4px;
}

progress::-webkit-progress-value {
  background-color: var(--accent);
  border-radius: 4px;
  -webkit-transition: width 0.3s ease;
  transition: width 0.3s ease;
}

progress::-moz-progress-bar {
  background-color: var(--accent);
  border-radius: 4px;
  -moz-transition: width 0.3s ease;
  transition: width 0.3s ease;
}

meter::-webkit-meter-optimum-value {
  background-color: #2da44e;
}

meter::-webkit-meter-suboptimum-value {
  background-color: #fb8500;
}

meter::-webkit-meter-even-less-good-value {
  background-color: #cf222e;
}

meter::-moz-meter-bar {
  border-radius: 4px;
}

meter:-moz-meter-optimum::-moz-meter-bar {
  background-color: #2da44e;
}

meter:-moz-meter-sub-optimum::-moz-meter-bar {
  background-color: #fb8500;
}

meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
  background-color: #cf222e;
}

output {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.875em;
}

template {
  display: none;
}

figure {
  margin: var(--space-md) 0;
  text-align: center;
}

figcaption {
  margin-top: var(--space-sm);
  font-size: var(--font-sm);
  color: var(--text-secondary);
  font-style: italic;
}

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

/* Utility Classes (Optional) */

/* Text Alignment */

.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

/* Display Utilities */

.hidden {
  display: none;
}

.block {
  display: block;
}

.inline {
  display: inline;
}

.inline-block {
  display: inline-block;
}

/* Spacing Utilities */

.mt-0 { margin-top: 0; }

.mb-0 { margin-bottom: 0; }

.ml-0 { margin-left: 0; }

.mr-0 { margin-right: 0; }

.mt-sm { margin-top: var(--space-sm); }

.mb-sm { margin-bottom: var(--space-sm); }

.mt-md { margin-top: var(--space-md); }

.mb-md { margin-bottom: var(--space-md); }

.mt-lg { margin-top: var(--space-lg); }

.mb-lg { margin-bottom: var(--space-lg); }

/* Width Utilities */

.full-width {
  width: 100%;
}

.max-width-sm {
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}

.max-width-md {
  max-width: 60rem;
  margin-left: auto;
  margin-right: auto;
}

.max-width-lg {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
}

/* Screen Reader Only */

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

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

/* Dark Mode Overrides 
 * Core dark mode colors are defined in tokens.css using @media (prefers-color-scheme: dark)
 * This file provides element-specific adjustments for optimal dark mode appearance
 */

@media (prefers-color-scheme: dark) {
  /* Reduce brightness of images and media in dark mode */
  img, video, iframe {
    opacity: 0.9;
  }

  /* Soften borders in dark mode */
  table, th, td, hr, fieldset {
    border-color: var(--border);
    opacity: 0.8;
  }

  /* Enhance code block visibility in dark mode */
  pre {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
  }

  /* Adjust form element backgrounds for better contrast */
  input:not([type="checkbox"]):not([type="radio"]),
  textarea,
  select {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
  }

  /* Enhance focus states in dark mode */
  input:focus,
  textarea:focus,
  select:focus,
  button:focus {
    outline-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.3);
  }

  /* Adjust blockquote styling for dark mode */
  blockquote {
    border-left-color: var(--accent);
    background: rgba(255, 255, 255, 0.03);
  }

  /* Soften mark/highlight in dark mode */
  mark {
    background: rgba(255, 208, 0, 0.2);
    color: var(--text-primary);
  }
}

/*
 * SPDX-FileCopyrightText: 2026 Sergei Mukhin
 * SPDX-License-Identifier: MIT
 */

@media print {
  /* Reset page layout for print */
  body {
    max-width: 100%;
    padding: 0;
    margin: 0;
    font-size: 12pt;
    line-height: 1.5;
  }

  /* Show URLs for links */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 90%;
  }

  /* Show abbreviation titles */
  abbr[title]::after {
    content: " (" attr(title) ")";
    font-size: 90%;
  }

  /* Don't show links for fragment identifiers or javascript protocol */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  /* Page breaks */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  blockquote, pre, table, figure, ul, ol {
    page-break-inside: avoid;
  }

  /* Keep content together */
  p, li {
    orphans: 3;
    widows: 3;
  }

  /* Remove backgrounds and convert to black/white for print */
  * {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Keep borders visible but simplified */
  table, th, td {
    border: 1px solid #000 !important;
  }

  /* Keep link colors visible */
  a,
  a:visited {
    text-decoration: underline;
    color: #000 !important;
  }

  /* Enhance headings for print */
  h1 {
    font-size: 24pt;
  }

  h2 {
    font-size: 18pt;
  }

  h3 {
    font-size: 14pt;
  }

  /* Hide interactive and media elements */
  button,
  input[type="submit"],
  input[type="button"],
  input[type="reset"],
  video,
  audio,
  nav,
  aside,
  form {
    display: none;
  }

  /* Show hidden content that might be useful in print */
  details {
    display: block;
  }

  summary {
    font-weight: bold;
  }

  /* Optimize images for print */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
}
