/* CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* CSS Variables - Light Mode (default) */
:root {
    --color-base: #faf4ed;
    --color-surface: #fffaf3;
    --color-overlay: #f2e9e1;
    --color-text: #575279;
    --color-muted: #9893a5;
    --color-subtle: #797593;
    --color-emphasis: #575279;
    --color-primary: #907aa9;
    --color-secondary: #56949f;
    --color-tertiary: #286983;
    --color-error: #b4637a;
    --color-warning: #ea9d34;
    --color-success: #286983;
    --color-border: #dfdad9;
    --color-link: #d7827e;
    --color-highlight: #cecacd;

    --font-body: 'IBM Plex', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'IBM Plex Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Ioskeley Mono', 'IBM Plex Mono', 'Berkeley Mono', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

    --spacing-base: 16px;
    --spacing-line-height: 1.6;
    --spacing-scale: 1.25;
}

/* CSS Variables - Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --color-base: #191724;
        --color-surface: #1f1d2e;
        --color-overlay: #26233a;
        --color-text: #e0def4;
        --color-muted: #6e6a86;
        --color-subtle: #908caa;
        --color-emphasis: #e0def4;
        --color-primary: #c4a7e7;
        --color-secondary: #9ccfd8;
        --color-tertiary: #ebbcba;
        --color-error: #eb6f92;
        --color-warning: #f6c177;
        --color-success: #31748f;
        --color-border: #403d52;
        --color-link: #ebbcba;
        --color-highlight: #524f67;
    }
}

/* Base Styles */
html {
    font-size: var(--spacing-base);
    line-height: var(--spacing-line-height);
}

/* Scoped to notebook-content container */
.notebook-content {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-base);
    max-width: 90ch;
    margin: 0 auto;
    padding: 2rem 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    margin-top: calc(1rem * var(--spacing-scale));
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

h1 {
  font-size: 2rem;
  color: var(--color-secondary);
}
h2 {
  font-size: 1.5rem;
  color: var(--color-primary);
}
h3 {
  font-size: 1.25rem;
  color: var(--color-secondary);
}
h4 {
  font-size: 1.2rem;
  color: var(--color-tertiary);
}
h5 {
  font-size: 1.125rem;
  color: var(--color-secondary);
}
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

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

.notebook-content a:hover {
    color: var(--color-emphasis);
    text-decoration: underline;
}

/* Selection */
::selection {
    background: var(--color-highlight);
    color: var(--color-text);
}

/* Lists */
ul, ol {
    margin-left: 1rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.25rem;
}

/* Code */
code {
    font-family: var(--font-mono);
    background: var(--color-surface);
    padding: 0.125rem 0.25rem;
    border-radius: 4px;
    font-size: 0.9em;
}

pre {
    overflow-x: auto;
    margin-bottom: 1rem;
    border-radius: 5px;
    border: 1px solid var(--color-border);
    box-sizing: border-box;
}

/* Code blocks inside pre are handled by syntax theme */
pre code {
    display: block;
    width: fit-content;
    min-width: 100%;
    padding: 1rem;
    background: var(--color-surface);
}

/* Math */
.math {
    font-family: var(--font-mono);
}

.math-display {
    display: block;
    margin: 1rem 0;
    text-align: center;
}

/* Blockquotes */
blockquote {
    border-left: 2px solid var(--color-secondary);
    background: var(--color-surface);
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 0.5rem;
    padding-bottom: 0.04rem;
    margin: 1rem 0;
    font-size: 0.95em;
    border-bottom-right-radius: 5px;
    border-top-right-radius: 5px;
}
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
    display: block;
    overflow-x: auto;
    max-width: 100%;
}

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

th {
    background: var(--color-surface);
    font-weight: 600;
}

tr:hover {
    background: var(--color-surface);
}

/* Footnotes */
.footnote-reference {
    font-size: 0.8em;
    color: var(--color-subtle);
}

.footnote-definition {
    margin-top: 2rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.9em;
}

.footnote-definition-label {
    font-weight: 600;
    margin-right: 0.5rem;
    color: var(--color-primary);
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
    border-radius: 4px;
}

/* Horizontal Rule */
hr {
    border: none;
    border-top: 2px solid var(--color-border);
    margin: 2rem 0;
}

/* Tablet and mobile responsiveness */
@media (max-width: 900px) {
    .notebook-content {
        padding: 1.5rem 1rem;
        max-width: 100%;
    }

    h1 { font-size: 1.85rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }

    blockquote {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Small mobile phones */
@media (max-width: 480px) {
    .notebook-content {
        padding: 1rem 0.75rem;
    }

    h1 { font-size: 1.65rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }

    blockquote {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}
/* Syntax highlighting - Light Mode (default) */
/*
 * theme "Rosé Pine Dawn" generated by syntect
 */

.wvc-code {
 color: #575279;
 background-color: #faf4ed;
}

.wvc-comment {
 color: #797593;
font-style: italic;
}
.wvc-string, .wvc-punctuation.wvc-definition.wvc-string {
 color: #ea9d34;
}
.wvc-constant.wvc-numeric {
 color: #ea9d34;
}
.wvc-constant.wvc-language {
 color: #ea9d34;
font-weight: bold;
}
.wvc-constant.wvc-character, .wvc-constant.wvc-other {
 color: #ea9d34;
}
.wvc-variable {
 color: #575279;
font-style: italic;
}
.wvc-keyword {
 color: #286983;
}
.wvc-storage {
 color: #56949f;
}
.wvc-storage.wvc-type {
 color: #56949f;
}
.wvc-entity.wvc-name.wvc-class {
 color: #286983;
font-weight: bold;
}
.wvc-entity.wvc-other.wvc-inherited-class {
 color: #286983;
font-style: italic;
}
.wvc-entity.wvc-name.wvc-function {
 color: #d7827e;
font-style: italic;
}
.wvc-variable.wvc-parameter {
 color: #907aa9;
}
.wvc-entity.wvc-name.wvc-tag {
 color: #286983;
font-weight: bold;
}
.wvc-entity.wvc-other.wvc-attribute-name {
 color: #907aa9;
}
.wvc-support.wvc-function {
 color: #d7827e;
font-weight: bold;
}
.wvc-support.wvc-constant {
 color: #ea9d34;
font-weight: bold;
}
.wvc-support.wvc-type, .wvc-support.wvc-class {
 color: #56949f;
font-weight: bold;
}
.wvc-support.wvc-other.wvc-variable {
 color: #b4637a;
font-weight: bold;
}
.wvc-invalid {
 color: #575279;
 background-color: #b4637a;
}
.wvc-invalid.wvc-deprecated {
 color: #575279;
 background-color: #907aa9;
}
.wvc-punctuation, .wvc-keyword.wvc-operator {
 color: #797593;
}


/* Syntax highlighting - Dark Mode */
@media (prefers-color-scheme: dark) {
/*
 * theme "Rosé Pine" generated by syntect
 */

.wvc-code {
 color: #e0def4;
 background-color: #191724;
}

.wvc-comment {
 color: #908caa;
font-style: italic;
}
.wvc-string, .wvc-punctuation.wvc-definition.wvc-string {
 color: #f6c177;
}
.wvc-constant.wvc-numeric {
 color: #f6c177;
}
.wvc-constant.wvc-language {
 color: #f6c177;
font-weight: bold;
}
.wvc-constant.wvc-character, .wvc-constant.wvc-other {
 color: #f6c177;
}
.wvc-variable {
 color: #e0def4;
font-style: italic;
}
.wvc-keyword {
 color: #31748f;
}
.wvc-storage {
 color: #9ccfd8;
}
.wvc-storage.wvc-type {
 color: #9ccfd8;
}
.wvc-entity.wvc-name.wvc-class {
 color: #31748f;
font-weight: bold;
}
.wvc-entity.wvc-other.wvc-inherited-class {
 color: #31748f;
font-style: italic;
}
.wvc-entity.wvc-name.wvc-function {
 color: #ebbcba;
font-style: italic;
}
.wvc-variable.wvc-parameter {
 color: #c4a7e7;
}
.wvc-entity.wvc-name.wvc-tag {
 color: #31748f;
font-weight: bold;
}
.wvc-entity.wvc-other.wvc-attribute-name {
 color: #c4a7e7;
}
.wvc-support.wvc-function {
 color: #ebbcba;
font-weight: bold;
}
.wvc-support.wvc-constant {
 color: #f6c177;
font-weight: bold;
}
.wvc-support.wvc-type, .wvc-support.wvc-class {
 color: #9ccfd8;
font-weight: bold;
}
.wvc-support.wvc-other.wvc-variable {
 color: #eb6f92;
font-weight: bold;
}
.wvc-invalid {
 color: #e0def4;
 background-color: #eb6f92;
}
.wvc-invalid.wvc-deprecated {
 color: #e0def4;
 background-color: #c4a7e7;
}
.wvc-punctuation, .wvc-keyword.wvc-operator {
 color: #908caa;
}
}
