@import url("https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700&family=DM+Sans:wght@300;400;500;700&family=DM+Mono:wght@400;500&display=swap");

:root {
  --site-navy: #0d1b2a;
  --site-navy-mid: #1a2d45;
  --site-bg: #faf8f4;
  --site-bg-card: #ffffff;
  --site-text: #0d1b2a;
  --site-text-soft: #4a5568;
  --site-muted: #718096;
  --site-border: #d4cbbe;
  --site-border-soft: #e8e2d6;
  --site-accent: #c9a84c;
  --site-accent-soft: #e8c97a;
  --site-success: #2d9b6f;
  --site-danger: #c0392b;
  --site-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --site-shadow-md: 0 6px 20px rgba(13, 27, 42, 0.10);
  --site-radius: 12px;
  --site-radius-sm: 8px;
  --site-font-head: "Syne", sans-serif;
  --site-font-body: "DM Sans", sans-serif;
  --site-font-mono: "DM Mono", monospace;

  /* legacy aliases reused by existing pages */
  --navy: var(--site-navy);
  --navy-mid: var(--site-navy-mid);
  --cream: #f5f0e8;
  --cream-dark: #ece5d8;
  --gold: var(--site-accent);
  --gold-light: var(--site-accent-soft);
  --green: var(--site-success);
  --red: var(--site-danger);
  --text: var(--site-text);
  --text-sec: var(--site-text-soft);
  --muted: var(--site-muted);
  --text-primary: var(--site-text);
  --text-secondary: var(--site-text-soft);
  --text-muted: var(--site-muted);
  --border: var(--site-border);
  --border-lt: var(--site-border-soft);
  --border-light: var(--site-border-soft);
  --bg: var(--site-bg);
  --bg-card: var(--site-bg-card);
  --shadow: var(--site-shadow);
  --shadow-md: var(--site-shadow-md);
  --radius: var(--site-radius);
  --radius-sm: var(--site-radius-sm);
  --font-head: var(--site-font-head);
  --font-body: var(--site-font-body);
  --font-mono: var(--site-font-mono);

  color-scheme: light;
}

[data-theme="dark"],
:root[data-theme="dark"],
html[data-theme="dark"],
body[data-theme="dark"] {
  --site-bg: #07101c;
  --site-bg-card: #0c1927;
  --site-text: #ede7db;
  --site-text-soft: rgba(237, 231, 219, 0.70);
  --site-muted: rgba(237, 231, 219, 0.42);
  --site-border: rgba(201, 168, 76, 0.24);
  --site-border-soft: rgba(201, 168, 76, 0.12);
  --site-shadow: 0 2px 12px rgba(0, 0, 0, 0.45), 0 1px 4px rgba(0, 0, 0, 0.35);
  --site-shadow-md: 0 8px 26px rgba(0, 0, 0, 0.50);
  --cream: #0f1b2a;
  --cream-dark: #142538;
  color-scheme: dark;
}

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

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-body, var(--fb, var(--site-font-body)));
  color: var(--text, var(--text-primary, var(--site-text)));
  background-color: var(--bg, var(--site-bg));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-head, var(--fh, var(--site-font-head)));
  color: inherit;
}

.container {
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: #ffffff;
  padding: 38px 24px 30px;
  margin: -32px -24px 28px;
  border-radius: 0 0 var(--radius) var(--radius);
  position: relative;
  overflow: hidden;
}

.header::before {
  content: "";
  position: absolute;
  top: -72px;
  right: -72px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(201, 168, 76, 0.10);
  pointer-events: none;
}

.header h1 {
  margin: 0 0 8px;
  color: #ffffff;
  font-size: clamp(1.5rem, 3.8vw, 2rem);
  line-height: 1.2;
}

.header p,
.subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.70);
}

.main-content {
  background: var(--bg-card);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.links a {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.links a:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

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

a:hover {
  color: var(--gold-light, var(--site-accent-soft));
}

code,
pre,
kbd,
samp {
  font-family: var(--font-mono, var(--fm, var(--site-font-mono)));
}

pre,
.code-block {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

code {
  background: rgba(13, 27, 42, 0.06);
  color: var(--navy);
  padding: 2px 6px;
  border-radius: 4px;
}

[data-theme="dark"] code {
  background: rgba(232, 201, 122, 0.12);
  color: var(--gold-light);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border: 1px solid var(--border-lt);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}

th,
td {
  border-bottom: 1px solid var(--border-lt);
  padding: 10px 14px;
  text-align: left;
  color: var(--text-sec);
}

th {
  background: color-mix(in srgb, var(--bg), white 15%);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: color-mix(in srgb, var(--bg), white 8%);
}

button,
input,
select,
textarea {
  font: inherit;
  border-radius: var(--radius-sm, var(--site-radius-sm));
}

input,
textarea,
select {
  background: color-mix(in srgb, var(--bg) 80%, white 20%);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
}

button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  cursor: pointer;
  border: 1px solid rgba(13, 27, 42, 0.24);
  background: var(--cream);
  color: var(--navy);
  padding: 10px 18px;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(201, 168, 76, 0.55);
  outline-offset: 2px;
}

.theme-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.78);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.theme-btn:hover {
  background: rgba(201, 168, 76, 0.22);
  border-color: rgba(201, 168, 76, 0.44);
  color: var(--gold-light);
}

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

.ico-sun {
  display: none;
}

[data-theme="dark"] .ico-moon {
  display: none;
}

[data-theme="dark"] .ico-sun {
  display: inline-block;
}

.footer {
  margin-top: 28px;
  background: var(--navy);
  color: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 0.82rem;
  text-align: center;
}

::selection {
  background: rgba(201, 168, 76, 0.24);
  color: var(--text, var(--text-primary, var(--site-text)));
}

:root {
  scrollbar-color: rgba(201, 168, 76, 0.55) transparent;
}

@media (max-width: 700px) {
  .container {
    padding: 20px 14px 42px;
  }

  .header {
    margin: -20px -14px 20px;
    padding: 28px 16px 22px;
  }

  .main-content {
    padding: 14px;
  }
}
