/* ===== Reset & Base ===== */

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

html {
    scroll-behavior: smooth;
}

body {
    background: #ffffff;
    color: #0a0a0a;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image: radial-gradient(#d8d8d8 1px, transparent 1px);
    background-size: 24px 24px;
}

h1,
h2,
h3,
.logo,
.btn {
    font-family: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ===== Icons ===== */

h3 .fa-solid,
h3 .fa-brands {
    font-size: 0.9em;
    margin-right: 6px;
    color: #4a4a4a;
}

/* Card icons sit in their own frame above the title */
.feature-card h3 .fa-solid,
.usage-card h3 .fa-solid {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0 0 14px;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    font-size: 0.95rem;
}

.feature-card:first-child h3 .fa-solid {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
}

.logo .fa-solid {
    font-size: 0.85em;
    margin-right: 4px;
}

.btn .fa-solid,
.btn .fa-brands {
    margin-right: 8px;
    font-size: 0.9em;
}

.site-footer .fa-brands {
    margin-right: 4px;
}

/* ===== Layout ===== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Prose directly in a section stays at a readable measure */
.section > .container > p {
    max-width: 68ch;
}

.section {
    padding: 96px 0;
}

/* Offset the sticky header when jumping to a section */
section[id] {
    scroll-margin-top: 88px;
}

.section.alt-bg {
    background: #f6f6f6;
    border-top: 1px solid #e4e4e4;
    border-bottom: 1px solid #e4e4e4;
}

.section h2 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 40px;
}

.subsection-title {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 56px 0 10px;
}

.subsection-title + .section-lead {
    margin: 0 0 24px;
}

.approval-grid + .small {
    margin-top: 16px;
}

/* ===== Header ===== */

.site-header {
    padding: 20px 0;
    border-bottom: 1px solid #e4e4e4;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 10;
    transition: box-shadow 0.2s ease;
}

.site-header.is-scrolled {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.header-nav-sections {
    margin-right: auto;
    gap: 22px;
}

.header-nav-sections a {
    color: #4a4a4a;
}

.header-nav-sections a:hover {
    color: #0a0a0a;
}

@media (max-width: 760px) {
    .header-nav-sections {
        display: none;
    }
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-nav a {
    color: #0a0a0a;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.header-nav a:hover {
    text-decoration: underline;
}

.header-nav .fa-brands {
    margin-right: 6px;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
    color: #0a0a0a;
}

/* ===== Hero ===== */

.hero {
    padding: 112px 0 88px;
    text-align: left;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: #4a4a4a;
    max-width: 560px;
    margin: 0 0 36px;
}

.hero-cta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    background: #0a0a0a;
    color: #ffffff;
    text-decoration: none;
    padding: 13px 30px;
    border: 1px solid #0a0a0a;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
    background: #2a2a2a;
    border-color: #2a2a2a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

/* Secondary reads lighter: no fill, no elevation */
.btn-secondary {
    background: transparent;
    color: #0a0a0a;
    box-shadow: none;
}

.btn-secondary:hover {
    background: #0a0a0a;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.22);
}

/* ===== Demo ===== */

.hero-container {
    max-width: 1200px;
    display: flex;
    align-items: center;
    gap: 64px;
}

.hero-copy {
    flex: 1;
    min-width: 0;
}

.demo-window {
    flex: 1.7;
    min-width: 0;
    max-width: 1075px;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    overflow: hidden;
    background: #0a0a0a;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.demo-titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
}

.demo-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3a3a3a;
}

.demo-title {
    margin-left: 8px;
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.75rem;
    color: #888888;
}

.demo-window img {
    display: block;
    width: 100%;
    height: auto;
}

/* ===== Feature Grid ===== */

/* 8 cards: the first spans 2 columns, so 9 cells fill 3 rows exactly */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.feature-card {
    background: #ffffff;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    padding: 26px;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.feature-card:hover {
    border-color: #0a0a0a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
}

.feature-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 10px;
}

.feature-card p {
    color: #4a4a4a;
    font-size: 0.95rem;
}

.feature-card:first-child {
    grid-column: span 2;
}

.feature-card:first-child h3 {
    font-size: 1.45rem;
}

.feature-card:first-child p {
    font-size: 1.05rem;
    max-width: 46ch;
}

/* ===== Steps ===== */

.steps {
    list-style: none;
    counter-reset: step;
    padding-left: 0;
    max-width: 760px;
}

.steps li {
    position: relative;
    padding-left: 60px;
    margin-bottom: 40px;
}

.steps li:last-child {
    margin-bottom: 0;
}

.steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0a0a0a;
    color: #ffffff;
    font-family: "Space Grotesk", "Inter", sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
}

.steps li strong {
    display: block;
    font-size: 1.2rem;
    letter-spacing: -0.01em;
    margin-bottom: 10px;
    padding-top: 5px;
}

.steps pre {
    background: #0a0a0a;
    color: #f0f0f0;
    border-radius: 6px;
    padding: 12px 16px;
    overflow-x: auto;
    font-size: 0.875rem;
    margin: 8px 0;
}

.small {
    font-size: 0.8rem;
    color: #666666;
    margin-top: 4px;
}

/* ===== Usage Grid ===== */

.usage-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.usage-card {
    background: #ffffff;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    padding: 26px;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
}

.usage-card:hover {
    border-color: #0a0a0a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
}

.usage-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 10px;
}

.usage-card p {
    color: #4a4a4a;
    font-size: 0.95rem;
    margin-bottom: 16px;
}

.usage-card pre {
    background: #0a0a0a;
    color: #f0f0f0;
    border-radius: 4px;
    padding: 10px 14px;
    overflow-x: auto;
    font-size: 0.85rem;
    border-radius: 6px;
}

.usage-card .code-block {
    margin-top: auto;
}

/* ===== Approval Modes ===== */

.section-lead {
    max-width: 68ch;
    color: #4a4a4a;
    margin: -24px 0 40px;
}

/* Ordered strictest to loosest, so the row reads left to right as a ramp */
.approval-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.approval-card {
    background: #ffffff;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    padding: 22px 26px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.approval-card:hover {
    border-color: #0a0a0a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
}

.approval-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 14px;
    border-bottom: 1px solid #e4e4e4;
}

.approval-head h3 {
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 1.05rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    margin-right: auto;
}

.approval-risk,
.approval-default {
    padding: 2px 9px;
    border: 1px solid;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.approval-default {
    color: #4a4a4a;
    border-color: #dcdcdc;
    background: #f2f2f2;
}

/* Mirrors the risk colouring of the TUI's approval badge */
.risk-normal {
    color: #3f6212;
    border-color: #c7dca0;
    background: #f2f7e8;
}

.risk-warn {
    color: #8a5a00;
    border-color: #e8cf9a;
    background: #fdf6e7;
}

.risk-danger {
    color: #a12a20;
    border-color: #efb2ac;
    background: #fdeeec;
}

.approval-card p {
    color: #4a4a4a;
    font-size: 0.9rem;
}

/* ===== Tools Grid ===== */

/* Core spans the full row with a two-column list; the rest sit 4-up
   and stretch to a shared height so the row reads as a grid. */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* Commands & Hooks: wide slash-commands card over a two-up row */
.commands-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.tool-card-wide {
    grid-column: 1 / -1;
}

.tool-card-wide ul {
    columns: 2;
    column-gap: 40px;
}

.tool-card-wide li {
    break-inside: avoid;
}

.tool-card {
    background: #ffffff;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    padding: 22px 26px;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.tool-card:hover {
    border-color: #0a0a0a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
}

.tool-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding-bottom: 14px;
    margin-bottom: 4px;
    border-bottom: 1px solid #e4e4e4;
}

.tool-card ul {
    list-style: none;
    padding: 0;
}

.tool-card li {
    padding: 9px 0;
    font-size: 0.875rem;
    color: #4a4a4a;
    border-bottom: 1px dashed #e8e8e8;
}

.tool-card li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tool-card li code {
    background: #f2f2f2;
    color: #0a0a0a;
    font-weight: 500;
}

/* ===== Code ===== */

pre,
code {
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875rem;
}

code {
    background: #efefef;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* ===== Copy Button ===== */

.code-block {
    position: relative;
}

.code-block pre {
    padding-right: 52px;
}

.copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    background: #1e1e1e;
    color: #b4b4b4;
    border: 1px solid #333333;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.code-block:hover .copy-btn,
.copy-btn:focus-visible,
.copy-btn.is-copied,
.copy-btn.is-failed {
    opacity: 1;
}

.copy-btn:hover {
    color: #ffffff;
    border-color: #555555;
}

.copy-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.copy-btn.is-copied {
    color: #4ade80;
    border-color: #4ade80;
}

.copy-btn.is-failed {
    color: #f87171;
    border-color: #f87171;
}

@media (hover: none) {
    .copy-btn {
        opacity: 1;
    }
}

/* ===== Footer ===== */

.site-footer {
    border-top: 1px solid #e4e4e4;
    padding: 56px 0;
    text-align: center;
    font-size: 0.85rem;
    color: #666666;
}

.site-footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.site-footer a {
    font-weight: 500;
}

.site-footer a {
    color: #0a0a0a;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ===== Responsive ===== */

@media (max-width: 1000px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .hero-container {
        flex-direction: column;
        align-items: stretch;
        gap: 40px;
    }

    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .feature-card:first-child {
        grid-column: span 2;
    }

    .approval-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .section {
        padding: 72px 0;
    }
}

@media (max-width: 600px) {
    .hero {
        padding: 72px 0 56px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.05rem;
    }

    .section {
        padding: 56px 0;
    }

    .section h2 {
        font-size: 1.75rem;
        margin-bottom: 28px;
    }

    .feature-grid,
    .usage-grid,
    .tools-grid,
    .commands-grid,
    .approval-grid {
        grid-template-columns: 1fr;
    }

    .feature-card:first-child {
        grid-column: auto;
    }

    .feature-card:first-child h3 {
        font-size: 1.2rem;
    }

    .feature-card:first-child p {
        font-size: 0.95rem;
    }

    .tool-card-wide ul {
        columns: 1;
    }

    .steps li {
        padding-left: 48px;
    }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .btn:hover,
    .feature-card:hover,
    .usage-card:hover,
    .tool-card:hover,
    .approval-card:hover {
        transform: none;
    }
}
