/* Timeless typography - turntrout.com design system with Catppuccin Latté */

/* Font faces */
@font-face {
    font-family: 'EB Garamond';
    src: url('/fonts/EBGaramond-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'EB Garamond';
    src: url('/fonts/EBGaramond-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Fira Code';
    src: url('/fonts/FiraCode-VF.ttf') format('truetype');
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

/* Catppuccin Latté color palette */
:root {
    /* Base colors */
    --base: #eff1f5;
    --mantle: #e6e9ef;
    --crust: #dce0e8;

    /* Surface colors */
    --surface0: #ccd0da;
    --surface1: #bcc0cc;
    --surface2: #acb0be;

    /* Overlay colors */
    --overlay0: #9ca0b0;
    --overlay1: #8c8fa1;
    --overlay2: #7c7f93;

    /* Text colors */
    --subtext0: #6c6f85;
    --subtext1: #5c5f77;
    --text: #4c4f69;

    /* Accent colors */
    --blue: #1e66f5;
    --sapphire: #209fb5;
    --teal: #179299;
    --green: #40a02b;
    --yellow: #df8e1d;
    --peach: #fe640b;
    --maroon: #e64553;
    --red: #d20f39;
    --mauve: #8839ef;
    --pink: #ea76cb;
    --flamingo: #dd7878;
    --rosewater: #dc8a78;
    --lavender: #7287fd;

    /* Semantic mappings */
    --background: var(--base);
    --foreground: var(--text);
    --link: var(--blue);
    --link-hover: var(--sapphire);
    --muted: var(--subtext0);
    --border: var(--surface1);

    /* Typography scale (1.2 ratio) */
    --font-size-base: 1rem;
    --font-size-sm: 0.833rem;
    --font-size-h4: 1.2rem;
    --font-size-h3: 1.44rem;
    --font-size-h2: 1.728rem;
    --font-size-h1: 2.074rem;

    /* Spacing (base unit) */
    --space: 1.5rem;
    --space-half: 0.75rem;
    --space-double: 3rem;

    /* Layout */
    --max-width: 750px;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 20px;
}

@media (max-width: 768px) {
    html {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 17px;
    }
}

body {
    font-family: 'EB Garamond', Georgia, 'Times New Roman', serif;
    line-height: 1.65;
    color: var(--foreground);
    background: var(--background);
    margin: 0;
    padding: var(--space-double) var(--space);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

main {
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Navigation */
nav {
    max-width: var(--max-width);
    margin: 0 auto var(--space-double);
    display: flex;
    gap: var(--space);
    align-items: baseline;
    font-size: var(--font-size-sm);
}

nav a {
    color: var(--muted);
}

nav a:hover {
    color: var(--link-hover);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.25;
    margin-top: var(--space-double);
    margin-bottom: var(--space);
    font-weight: 400;
    color: var(--text);
}

h1 {
    font-size: var(--font-size-h1);
    margin-top: 0;
}

h2 {
    font-size: var(--font-size-h2);
    border-bottom: 1px solid var(--surface1);
    padding-bottom: var(--space-half);
}

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

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

p {
    margin: var(--space) 0;
}

/* Links */
a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

/* Lists */
ul, ol {
    padding-left: var(--space);
    margin: var(--space) 0;
}

li {
    margin: var(--space-half) 0;
}

li::marker {
    color: var(--muted);
}

/* Emphasis */
strong {
    font-weight: 600;
}

em {
    font-style: italic;
}

/* Horizontal rule */
hr {
    border: none;
    border-top: 1px solid var(--surface1);
    margin: var(--space-double) 0;
}

/* Code */
code {
    font-family: 'Fira Code', 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 0.85em;
    background: var(--mantle);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-feature-settings: "liga" 1;
}

pre {
    background: var(--mantle);
    padding: var(--space);
    border-radius: 6px;
    overflow-x: auto;
    margin: var(--space) 0;
}

pre code {
    background: none;
    padding: 0;
    font-size: 0.9em;
}

/* Blockquote */
blockquote {
    margin: var(--space) 0;
    padding: 0 0 0 var(--space);
    border-left: 3px solid var(--surface2);
    color: var(--subtext1);
    font-style: italic;
}

blockquote p {
    margin: var(--space-half) 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space) 0;
}

th, td {
    padding: var(--space-half);
    text-align: left;
    border-bottom: 1px solid var(--surface1);
}

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

/* Images */
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Selection */
::selection {
    background: var(--lavender);
    color: var(--base);
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
        font-size: 12pt;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    h1, h2, h3 {
        page-break-after: avoid;
    }
}
