/* Gastro — a file-based component framework for Go */

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

:root {
    --color-bg: #fffbf7;
    --color-text: #2c2418;
    --color-text-muted: #7a6e5d;
    --color-text-subtle: #a89f90;
    --color-accent: #e8722a;
    --color-accent-hover: #d15f1a;
    --color-accent-light: #fef3eb;
    --color-accent-warm: #f5a623;
    --color-border: #e8e0d4;
    --color-border-light: #f2ece4;
    --color-surface: #f7f2ec;
    --color-code-bg: #2a2520;
    --color-code-text: #e0d6c8;
    --color-header-bg: #2c2418;
    --color-header-text: #f7f2ec;
    --color-hero-bg: #2c2418;
    --font-display: "Source Serif 4", "Georgia", serif;
    --font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;
    --max-width: 1120px;
    --radius: 6px;
    --radius-lg: 10px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--color-accent-hover);
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
}

p code,
li code,
td code,
h1 code,
h2 code,
h3 code {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.84em;
    color: var(--color-accent-hover);
}

/* Skip link for keyboard/screen-reader users */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    padding: 0.5rem 1rem;
    background: var(--color-accent);
    color: white;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 200;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 0.5rem;
    color: white;
}

.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;
}

/* -------------------------------------------------------
   Site Header
   ------------------------------------------------------- */

.site-header {
    background: var(--color-header-bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    color: var(--color-header-text);
}

.nav-logo img {
    height: 26px;
}

.nav-links {
    display: flex;
    gap: 1.75rem;
    align-items: center;
}

.nav-links a {
    color: var(--color-text-subtle);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.15s ease;
}

.nav-links a:hover {
    color: var(--color-header-text);
}

/* -------------------------------------------------------
   Hero Section
   ------------------------------------------------------- */

.hero-wrapper {
    background: var(--color-hero-bg);
}

.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: clamp(2rem, 4vw, 5rem);
    max-width: var(--max-width);
    margin: 0 auto;
    padding: clamp(3rem, 6vw, 6rem) 2rem clamp(3.5rem, 7vw, 7rem);
    align-items: center;
}

.hero-content {
    display: flex;
    flex-direction: column;
}

.hero-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--color-accent-warm);
    letter-spacing: 0.04em;
    margin-bottom: 1rem;
    font-weight: 500;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    color: var(--color-header-text);
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
}

.hero-accent {
    color: var(--color-accent);
}

.hero-description {
    font-size: clamp(1rem, 1.5vw, 1.1rem);
    color: var(--color-text-subtle);
    line-height: 1.7;
    margin-bottom: 2rem;
    max-width: 480px;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* -------------------------------------------------------
   Buttons
   ------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.4rem;
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
    cursor: pointer;
    font-family: var(--font-sans);
}

.btn-primary {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: white;
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text-subtle);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.35);
    color: var(--color-header-text);
}

/* -------------------------------------------------------
   Code Window (Hero)
   ------------------------------------------------------- */

.hero-code {
    min-width: 0;
}

.code-window {
    background: var(--color-code-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow:
        0 20px 40px -12px rgba(44, 36, 24, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.04);
}

.code-window-bar {
    display: flex;
    align-items: center;
    padding: 0.7rem 1rem;
    background: rgba(0, 0, 0, 0.25);
    gap: 0.5rem;
}

.code-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.code-dot.red { background: #e85c4a; }
.code-dot.yellow { background: #e8a73e; }
.code-dot.green { background: #5eb86c; }

.code-window-title {
    margin-left: 0.5rem;
    font-size: 0.78rem;
    color: var(--color-text-subtle);
    font-family: var(--font-mono);
}

.code-window pre,
.code-window pre[class*="language-"] {
    margin: 0;
    padding: 1.25rem;
    overflow-x: auto;
    background: var(--color-code-bg);
}

.code-window pre code {
    font-size: 0.84rem;
    line-height: 1.65;
}

.code-window code[class*="language-"] {
    background: transparent;
}

/* -------------------------------------------------------
   Features Section
   ------------------------------------------------------- */

.features-section {
    padding: clamp(3.5rem, 6vw, 5.5rem) 2rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.features-header {
    margin-bottom: clamp(2rem, 4vw, 3.5rem);
    max-width: 520px;
}

.features-header h2 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.features-header p {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 1.25rem;
}

/* Featured card spans the left column fully */
.feature-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: clamp(1.5rem, 2.5vw, 2rem);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    border-color: var(--color-accent);
    box-shadow: 0 2px 12px rgba(232, 114, 42, 0.06);
}

.feature-card--featured {
    grid-row: 1 / 3;
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 3vw, 2.5rem);
}

.feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.feature-card--featured h3 {
    font-size: clamp(1.2rem, 2vw, 1.4rem);
    margin-bottom: 0.6rem;
}

.feature-card p {
    color: var(--color-text-muted);
    font-size: 0.93rem;
    line-height: 1.6;
}

.feature-card--featured p {
    font-size: 1rem;
}

.feature-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-accent);
    background: var(--color-accent-light);
    padding: 0.15em 0.5em;
    border-radius: 3px;
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

/* -------------------------------------------------------
   Quick Start Section
   ------------------------------------------------------- */

.quickstart-section {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
    padding: clamp(3.5rem, 6vw, 5.5rem) 2rem;
}

.quickstart-container {
    max-width: var(--max-width);
    margin: 0 auto;
}

.quickstart-header {
    margin-bottom: clamp(2rem, 3vw, 3rem);
    max-width: 480px;
}

.quickstart-header h2 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.quickstart-header p {
    color: var(--color-text-muted);
    font-size: 1.05rem;
}

.quickstart-steps {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.quickstart-step:first-child {
    grid-column: 1 / -1;
}

.quickstart-step {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.quickstart-step h3 {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--color-accent);
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}

/* -------------------------------------------------------
   Docs Layout
   ------------------------------------------------------- */

.docs-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 3rem;
    min-height: calc(100vh - 56px - 100px);
}

.docs-sidebar {
    position: sticky;
    top: 72px;
    align-self: start;
    padding-top: 0.75rem;
}

.docs-sidebar-toggle {
    display: none;
}

.docs-sidebar h3 {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-subtle);
    margin-bottom: 0.6rem;
    margin-top: 1.5rem;
}

.docs-sidebar-nav h3:first-child {
    margin-top: 0;
}

.docs-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.docs-sidebar li {
    margin-bottom: 0.15rem;
}

.docs-sidebar a {
    display: block;
    padding: 0.3rem 0.7rem;
    border-radius: 5px;
    color: var(--color-text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.docs-sidebar a:hover {
    color: var(--color-text);
    background: var(--color-surface);
}

.docs-sidebar a.active {
    color: var(--color-accent);
    background: var(--color-accent-light);
    font-weight: 600;
}

/* -------------------------------------------------------
   Docs Content
   ------------------------------------------------------- */

.docs-content {
    padding-top: 0.75rem;
    padding-bottom: 4rem;
    max-width: 720px;
}

.docs-content h1 {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3vw, 2.1rem);
    font-weight: 700;
    margin-bottom: 0.4rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.docs-content h1 + p {
    font-size: 1.05rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.docs-content h2 {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2vw, 1.35rem);
    font-weight: 700;
    margin-top: 2.75rem;
    margin-bottom: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border-light);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.docs-content h2:first-of-type {
    margin-top: 1.75rem;
    border-top: none;
    padding-top: 0;
}

.docs-content h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 1.75rem;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.docs-content p {
    margin-bottom: 1rem;
    color: var(--color-text);
}

.docs-content ul,
.docs-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.docs-content li {
    margin-bottom: 0.35rem;
    color: var(--color-text);
}

.docs-content strong {
    font-weight: 600;
}

.docs-content blockquote {
    border-left: 3px solid var(--color-accent);
    margin: 1.5rem 0;
    padding: 0.7rem 1.2rem;
    background: var(--color-accent-light);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.docs-content blockquote p {
    margin: 0;
    color: var(--color-text);
}

/* -------------------------------------------------------
   Code Blocks (Docs)
   ------------------------------------------------------- */

.code-block {
    margin: 1.25rem 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid rgba(42, 37, 32, 0.08);
}

.code-block pre,
.code-block pre[class*="language-"] {
    margin: 0;
    padding: 1.2rem;
    overflow-x: auto;
    background: var(--color-code-bg);
}

.code-block pre code {
    font-size: 0.84rem;
    line-height: 1.65;
    color: var(--color-code-text);
}

.code-block code[class*="language-"] {
    background: transparent;
}

/* -------------------------------------------------------
   Tables (Docs)
   ------------------------------------------------------- */

.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.9rem;
}

.docs-content th {
    text-align: left;
    padding: 0.6rem 0.85rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-weight: 600;
    font-size: 0.84rem;
}

.docs-content td {
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--color-border);
    vertical-align: top;
}

/* -------------------------------------------------------
   Live Demo
   ------------------------------------------------------- */

.demo-section {
    text-align: center;
    padding: 2.5rem 0;
}

.demo-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 2.5rem 3.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.demo-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}

.demo-count {
    font-size: 3.5rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--color-accent);
    line-height: 1;
    min-width: 100px;
}

.demo-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.8rem;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    font-family: var(--font-sans);
}

.demo-button:hover {
    background: var(--color-accent-hover);
    transform: translateY(-1px);
}

.demo-button:active {
    transform: translateY(0);
}

.demo-explanation {
    margin-top: 2rem;
    text-align: left;
}

.demo-explanation h3 {
    margin-bottom: 1rem;
}

/* -------------------------------------------------------
   Next/Prev Navigation (Docs)
   ------------------------------------------------------- */

.docs-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3.5rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--color-border);
    gap: 1rem;
}

.docs-nav a {
    display: block;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    transition: border-color 0.2s ease;
    min-width: 170px;
}

.docs-nav a:hover {
    border-color: var(--color-accent);
}

.docs-nav-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--color-text-subtle);
    font-weight: 500;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.docs-nav-title {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.95rem;
}

.docs-nav .next {
    text-align: right;
    margin-left: auto;
}

/* -------------------------------------------------------
   Footer
   ------------------------------------------------------- */

.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 2rem;
    background: var(--color-surface);
}

.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
}

.site-footer p {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
}

.site-footer a {
    color: var(--color-text-muted);
    font-weight: 500;
}

.site-footer a:hover {
    color: var(--color-accent);
}

/* -------------------------------------------------------
   Entrance Animations
   ------------------------------------------------------- */

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-content {
    animation: fade-up 0.5s ease-out both;
}

.hero-code {
    animation: fade-up 0.5s ease-out 0.15s both;
}

.feature-card {
    animation: fade-up 0.4s ease-out both;
}

.feature-card:nth-child(1) { animation-delay: 0.05s; }
.feature-card:nth-child(2) { animation-delay: 0.1s; }
.feature-card:nth-child(3) { animation-delay: 0.15s; }
.feature-card:nth-child(4) { animation-delay: 0.2s; }
.feature-card:nth-child(5) { animation-delay: 0.25s; }
.feature-card:nth-child(6) { animation-delay: 0.3s; }

/* -------------------------------------------------------
   Responsive
   ------------------------------------------------------- */

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        padding: 2.5rem 1.5rem 3rem;
    }

    .hero-code {
        max-width: 520px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .feature-card--featured {
        grid-row: auto;
    }

    .quickstart-steps {
        grid-template-columns: 1fr;
    }

    .docs-container {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        gap: 1.25rem;
    }

    .docs-sidebar {
        position: static;
        border-bottom: 1px solid var(--color-border);
        padding-bottom: 0;
    }

    .docs-sidebar-menu {
        display: block;
    }

    .docs-sidebar-toggle {
        display: block;
        padding: 0.6rem 0;
        font-size: 0.88rem;
        font-weight: 600;
        color: var(--color-text);
        cursor: pointer;
        list-style: none;
    }

    .docs-sidebar-toggle::-webkit-details-marker {
        display: none;
    }

    .docs-sidebar-toggle::before {
        content: "\25B6";
        display: inline-block;
        margin-right: 0.5rem;
        font-size: 0.65rem;
        transition: transform 0.15s ease;
    }

    .docs-sidebar-menu[open] > .docs-sidebar-toggle::before {
        transform: rotate(90deg);
    }

    .docs-sidebar-nav {
        padding-bottom: 1rem;
    }

    .hero-title {
        font-size: clamp(1.75rem, 5vw, 2.2rem);
    }
}

@media (max-width: 600px) {
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn {
        text-align: center;
    }

    .demo-container {
        padding: 2rem 1.5rem;
    }

    .demo-count {
        font-size: 2.75rem;
    }

    .docs-nav {
        flex-direction: column;
    }

    .docs-nav .next {
        text-align: left;
    }
}

/* -------------------------------------------------------
   Reduced motion
   ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}
