/* CSS Variables */
:root {
    --pine-resin: #4C6B3A;
    --dune-sand-top: #F6E1B8;
    --dune-sand-bottom: #E8C89A;
    --accent-text: #402A15;
}

/* Base styles from newdesign.html */
body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #1A1A1A;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0 2.5rem;
    background: linear-gradient(to bottom, var(--dune-sand-top), var(--dune-sand-bottom));
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 0;
    background: transparent;
}

.header-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin: 0;
    font-family: 'Fraunces', serif;
}

.header-title a {
    color: var(--pine-resin);
    text-decoration: none;
}

.header-title a:hover {
    color: var(--pine-resin);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    color: var(--accent-text);
    font-family: 'Fraunces', serif;
}

/* Main content heading styles */
.content h1 {
    font-size: 1.5rem;
}

.content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--accent-text);
}

/* don't duplicate heading */
h1#treebark {
    display: none;
}

h1#treebark + blockquote {
    border-left: none;
    padding-left: 0;
    font-size: 1.5rem;
    font-style: normal;
    font-weight: bold;
    color: var(--accent-text);
}

h1#treebark + blockquote p {
    font-family: 'Fraunces', serif;
}

.github-link {
    color: var(--pine-resin);
    text-decoration: none;
    transition: all 0.3s;
    font-family: 'Inter', sans-serif;
}

.github-link:hover {
    text-decoration: underline;
}

.header-nav {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--pine-resin);
}

.nav-link {
    color: var(--pine-resin);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-link:hover, .nav-link.active {
    text-decoration: underline;
}

.content {
    flex-grow: 1;
    max-width: 64rem;
    margin: 0 auto;
}

.content p {
    margin-bottom: 1.5rem;
    line-height: 1.625;
    font-family: 'Inter', sans-serif;
}

/* Links */
a {
    color: var(--pine-resin);
    transition: color 0.2s;
}

a:hover {
    color: #3d5a2e;
}

a:visited {
    color: #5a7c47;
}

code {
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Monaco', 'Courier New', monospace;
    color: #111;
    font-size: 0.875rem;
}

/* Basic pre elements (not inside highlight containers) */
pre:not(.highlight) {
    background: rgba(255, 255, 255, 0.85);
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    color: #111;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Jekyll syntax highlighting containers */
.highlight {
    background: rgba(255, 255, 255, 0.85);
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Remove styling from pre inside highlight to avoid conflicts */
.highlight pre {
    background: transparent;
    padding: 0;
    border-radius: 0;
    border-left: none;
    margin: 0;
    box-shadow: none;
}

.highlight code {
    background: transparent;
}

p code, table code, ul code {
    background: rgba(255, 255, 255, 0.25);
}

/* Syntax highlighting colors - Rouge/Pygments */
.highlight .c { color: #6a737d; font-style: italic; } /* Comment */
.highlight .err { color: #d73a49; } /* Error */
.highlight .k { color: #d73a49;  } /* Keyword */
.highlight .o { color: #6b4423; } /* Operator */
.highlight .cm { color: #6a737d; font-style: italic; } /* Comment.Multiline */
.highlight .cp { color: #6a737d;  } /* Comment.Preproc */
.highlight .c1 { color: #6a737d; font-style: italic; } /* Comment.Single */
.highlight .cs { color: #6a737d;  font-style: italic; } /* Comment.Special */
.highlight .gd { color: #d73a49; background-color: #ffeef0; } /* Generic.Deleted */
.highlight .ge { font-style: italic; } /* Generic.Emph */
.highlight .gr { color: #d73a49; } /* Generic.Error */
.highlight .gh { color: #005cc5;  } /* Generic.Heading */
.highlight .gi { color: #22863a; background-color: #f0fff4; } /* Generic.Inserted */
.highlight .go { color: #6b6b6b; } /* Generic.Output */
.highlight .gp { color: #6b6b6b; } /* Generic.Prompt */
.highlight .gs {  } /* Generic.Strong */
.highlight .gu { color: #6b4423;  } /* Generic.Subheading */
.highlight .gt { color: #d73a49; } /* Generic.Traceback */
.highlight .kc { color: #005cc5;  } /* Keyword.Constant */
.highlight .kd { color: #d73a49;  } /* Keyword.Declaration */
.highlight .kn { color: #d73a49;  } /* Keyword.Namespace */
.highlight .kp { color: #d73a49;  } /* Keyword.Pseudo */
.highlight .kr { color: #d73a49;  } /* Keyword.Reserved */
.highlight .kt { color: #d73a49;  } /* Keyword.Type */
.highlight .m { color: #005cc5; } /* Literal.Number */
.highlight .s { color: #22863a; } /* Literal.String */
.highlight .na { color: #6b4423; } /* Name.Attribute */
.highlight .nb { color: #005cc5; } /* Name.Builtin */
.highlight .nc { color: #6b4423;  } /* Name.Class */
.highlight .no { color: #005cc5; } /* Name.Constant */
.highlight .nd { color: #6b4423; } /* Name.Decorator */
.highlight .ni { color: #6b4423; } /* Name.Entity */
.highlight .ne { color: #d73a49;  } /* Name.Exception */
.highlight .nf { color: #6f42c1;  } /* Name.Function */
.highlight .nl { color: #6b4423;  } /* Name.Label */
.highlight .nn { color: #6b4423; } /* Name.Namespace */
.highlight .nt { color: #22863a;  } /* Name.Tag */
.highlight .nv { color: #005cc5; } /* Name.Variable */
.highlight .ow { color: #d73a49;  } /* Operator.Word */
.highlight .w { color: #6b6b6b; } /* Text.Whitespace */
.highlight .mf { color: #005cc5; } /* Literal.Number.Float */
.highlight .mh { color: #005cc5; } /* Literal.Number.Hex */
.highlight .mi { color: #005cc5; } /* Literal.Number.Integer */
.highlight .mo { color: #005cc5; } /* Literal.Number.Oct */
.highlight .sb { color: #22863a; } /* Literal.String.Backtick */
.highlight .sc { color: #22863a; } /* Literal.String.Char */
.highlight .sd { color: #22863a; font-style: italic; } /* Literal.String.Doc */
.highlight .s2 { color: #22863a; } /* Literal.String.Double */
.highlight .se { color: #d73a49; } /* Literal.String.Escape */
.highlight .sh { color: #22863a; } /* Literal.String.Heredoc */
.highlight .si { color: #005cc5; } /* Literal.String.Interpol */
.highlight .sx { color: #22863a; } /* Literal.String.Other */
.highlight .sr { color: #22863a; } /* Literal.String.Regex */
.highlight .s1 { color: #22863a; } /* Literal.String.Single */
.highlight .ss { color: #005cc5; } /* Literal.String.Symbol */
.highlight .bp { color: #005cc5; } /* Name.Builtin.Pseudo */
.highlight .vc { color: #005cc5; } /* Name.Variable.Class */
.highlight .vg { color: #005cc5; } /* Name.Variable.Global */
.highlight .vi { color: #005cc5; } /* Name.Variable.Instance */
.highlight .il { color: #005cc5; } /* Literal.Number.Integer.Long */

blockquote {
    border-left: 4px solid var(--accent-text);
    margin: 0;
    padding-left: 1rem;
    color: #6b6b6b;
    font-style: italic;
}

.footer {
    text-align: center;
    font-size: 0.875rem;
    opacity: 0.8;
    color: #2A2A2A;
    margin: 4rem 0;
}

.footer strong {
    font-weight: 600;
}

/* Playground-specific styles */
.playground-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1rem;
    height: 80vh;
    margin: 2rem 0;
}

.editor-panel {
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.editor-header {
    background: transparent;
    color: var(--accent-text);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px 8px 0 0;
    font-weight: 700;
    font-family: 'Fraunces', serif;
    font-size: 1.125rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-textarea {
    flex: 1;
    border: none;
    padding: 1rem;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    background: #fff;
    outline: none;
    border-radius: 0 0 8px 8px;
}

.editor-textarea:focus {
    box-shadow: 0 0 0 2px var(--pine-resin);
}

.output-panel {
    grid-row: 1 / 3;
    grid-column: 2;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    background: #fff;
    display: flex;
    flex-direction: column;
    min-width: 0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.output-header {
    background: transparent;
    color: var(--accent-text);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px 8px 0 0;
    font-weight: 700;
    font-family: 'Fraunces', serif;
    font-size: 1.125rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.output-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
}

.output-controls label {
    font-weight: 600;
    color: #1A1A1A;
}

.output-controls select,
.output-controls input {
    padding: 0.25rem 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    font-size: 0.875rem;
    background: white;
}

.output-content {
    flex: 1;
    padding: 1rem;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    overflow: auto;
    background: rgba(255, 255, 255, 0.85);
    white-space: pre;
    overflow-x: auto;
    min-width: 0;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.control-group label {
    font-weight: 600;
    color: #1A1A1A;
}

.control-group select,
.control-group input {
    padding: 0.25rem 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    font-size: 0.9rem;
}

.examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.example-btn {
    padding: 0.5rem 1rem;
    background: var(--pine-resin);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.example-btn:hover {
    background: #3d5a2e;
}

.error-display {
    background: #ffe6e6;
    border: 1px solid #ff6b6b;
    border-radius: 4px;
    padding: 1rem;
    margin: 1rem 0;
    color: #d00;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    display: none;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    body {
        padding: 0 1rem;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        height: auto;
        padding: 1rem 0;
        gap: 0.5rem;
    }
    
    .header-title {
        font-size: 1.5rem;
    }
    
    .header-nav {
        align-self: flex-start;
        gap: 0.75rem;
        font-size: 0.875rem;
        flex-wrap: wrap;
    }
    
    .content h1 {
        font-size: 1.25rem;
    }
    
    .content h2 {
        font-size: 1.125rem;
    }
    
    /* Hero tagline blockquote - matches h1 size as it replaces the hidden h1#treebark */
    h1#treebark + blockquote {
        font-size: 1.25rem;
    }
    
    /* Constrain content width to prevent horizontal scrolling */
    .content {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Reduce code block font size on mobile */
    code {
        font-size: 0.75rem;
    }
    
    pre:not(.highlight),
    .highlight {
        font-size: 0.75rem;
        padding: 0.5rem;
        overflow-x: auto;
        max-width: 100%;
    }
    
    .playground-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        height: auto;
    }
    
    .output-panel {
        grid-row: auto;
        grid-column: 1;
        min-height: 300px;
    }
    
    .editor-textarea {
        min-height: 200px;
    }
}
