/*!
 * craft-components.css - landing page and application components
 * Craft Framework - Copyright (c) 2026 Antonio Santos - MIT
 */

/* ============================================================
   Craft Framework — Premium Landing Page Styles
   Inspired by CodeIgniter's clean, professional aesthetic
   with modern gradients, glassmorphism, and micro-animations.
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
    /* Every value below resolves to a token in craft-theme.css. Retheming the
       application means editing that file — this sheet follows automatically.
       These names are kept so the existing component rules need no rewrite. */

    /* Brand palette */
    --orange-50:  var(--craft-brand-50);
    --orange-100: var(--craft-brand-100);
    --orange-200: var(--craft-brand-200);
    --orange-300: #fdba74;
    --orange-400: var(--craft-brand-400);
    --orange-500: var(--craft-brand-500);
    --orange-600: var(--craft-brand-600);
    --orange-700: var(--craft-brand-700);
    --orange-800: #9a3412;

    /* Neutrals */
    --slate-50:  var(--craft-slate-50);
    --slate-100: var(--craft-slate-100);
    --slate-200: var(--craft-slate-200);
    --slate-300: var(--craft-slate-300);
    --slate-400: var(--craft-slate-400);
    --slate-500: var(--craft-slate-500);
    --slate-600: var(--craft-slate-600);
    --slate-700: var(--craft-slate-700);
    --slate-800: var(--craft-slate-800);
    --slate-900: var(--craft-slate-900);
    --slate-950: var(--craft-slate-950);

    /* Semantic accents */
    --blue-500:   #3b82f6;
    --blue-600:   var(--craft-blue-600);
    --green-500:  var(--craft-emerald-500);
    --green-600:  var(--craft-emerald-600);
    --purple-500: #a855f7;
    --purple-600: var(--craft-purple-600);
    --pink-500:   #ec4899;
    --amber-500:  #f59e0b;

    /* Surfaces — pinned to the literal light slate steps, NOT the semantic
       `--craft-bg`/`--craft-surface` tokens, which flip dark under
       `prefers-color-scheme: dark` in craft-theme.css. Every text color on
       this page (`--slate-700/800/900` below) is a literal, never-swapping
       step too, chosen assuming a light ground — following the background
       token into dark mode without also re-deriving every text color would
       have produced dark text on a dark background. This page commits to a
       single light presentation on purpose (see the artifact-design
       principle: a deliberate single-theme choice is fine as long as it's
       explicit) rather than a half-finished dark mode with broken contrast. */
    --bg-body:    var(--craft-slate-50);
    --bg-section: #ffffff;
    --bg-glass:   rgba(255, 255, 255, 0.72);
    --border-subtle: rgba(0, 0, 0, 0.06);

    /* Typography — the system stack from the theme, so nothing is fetched. */
    --font-sans: var(--craft-font-sans);
    --font-mono: var(--craft-font-mono);

    /* Transitions */
    --ease-out-expo: var(--craft-ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-xl:  0 16px 48px rgba(0, 0, 0, 0.10);
    --shadow-glow: 0 0 60px color-mix(in srgb, var(--craft-brand-500) 15%, transparent);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--slate-700);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* `.hero-section`'s full-bleed trick (`margin-inline: calc(50% - 50vw)`)
       uses the `vw` unit, which on most browsers includes the scrollbar's
       own width — a few pixels wider than the actual visible viewport
       (`document.documentElement.clientWidth`). That mismatch is a known,
       standard side effect of any full-bleed-breakout technique, not a
       layout bug; clamping it here is the standard fix. */
    overflow-x: hidden;
}

/* ---------- Hero Section ----------
   `layouts/app.forge.py` wraps every public page's content in a
   `max-w-7xl mx-auto` box — fine for text-heavy sections, but it means a
   naively-styled hero can never actually reach the viewport edges; it's
   boxed inside a box. `.hero-section` breaks out of that ancestor
   constraint with the standard full-bleed trick (`margin-inline: calc(50%
   - 50vw)`) so its background spans the true viewport width, the same way
   a hero on a real marketing site does. `.hero-inner` is the actual content
   grid — single column below 1024px (unchanged mobile behavior), two real
   columns (copy left, code preview right) at 1024px+ — capped at a
   readable max-width and centered, same pattern every other section on
   this page already uses via `.section-container`. */
.hero-section {
    position: relative;
    /* No explicit `width: 100vw` — on most browsers `100vw` includes the
       scrollbar's own width, which this negative-margin trick doesn't need
       and which was producing a few extra pixels of horizontal overflow.
       `width: auto` (the block-level default) plus the margin pull is
       enough to reach both edges. */
    margin-inline: calc(50% - 50vw);
    padding: 5rem 2rem 4rem;
    overflow: hidden;
    background: linear-gradient(180deg, #fffbf5 0%, var(--bg-body) 100%);
}

.hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    max-width: 1120px;
    margin: 0 auto;
}

@media (min-width: 1024px) {
    .hero-inner {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
        gap: 4rem;
        text-align: left;
    }

    .hero-section {
        padding: 6rem 2rem 5rem;
    }

    .hero-content {
        max-width: none;
        margin-bottom: 0;
        text-align: left;
    }

    .hero-description {
        margin-left: 0;
        margin-right: 0;
    }

    .hero-actions,
    .hero-stats {
        justify-content: flex-start;
    }

    .hero-code-card {
        margin: 0;
    }
}

.hero-glow {
    position: absolute;
    top: -120px;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 500px;
    background: radial-gradient(ellipse at center, rgba(249, 115, 22, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 720px;
    margin-bottom: 3rem;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: 100px;
    background: var(--orange-50);
    border: 1px solid var(--orange-200);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--orange-700);
    letter-spacing: 0.02em;
    margin-bottom: 2rem;
    animation: fadeInDown 0.6s var(--ease-out-expo) both;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--orange-500);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.hero-title {
    font-size: clamp(3rem, 7vw, 5rem);
    font-weight: 300;
    color: var(--orange-600);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0 0 1rem;
    animation: fadeInDown 0.7s var(--ease-out-expo) 0.1s both;
}

.hero-version {
    font-size: 0.35em;
    font-weight: 400;
    vertical-align: super;
    color: var(--orange-400);
}

.hero-subtitle {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 400;
    color: var(--slate-600);
    letter-spacing: -0.01em;
    margin: 0 0 1.25rem;
    animation: fadeInDown 0.7s var(--ease-out-expo) 0.2s both;
}

.hero-description {
    font-size: 0.95rem;
    color: var(--slate-500);
    max-width: 560px;
    margin: 0 auto 2rem;
    line-height: 1.7;
    animation: fadeInDown 0.7s var(--ease-out-expo) 0.3s both;
}

/* Hero Buttons */
.hero-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 2.5rem;
    animation: fadeInDown 0.7s var(--ease-out-expo) 0.4s both;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 12px;
    background: var(--orange-600);
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s var(--ease-out-expo);
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
}

.btn-primary:hover {
    background: var(--orange-700);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(234, 88, 12, 0.35);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 12px;
    background: var(--bg-glass);
    color: var(--slate-700);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--slate-200);
    transition: all 0.25s var(--ease-out-expo);
    backdrop-filter: blur(8px);
}

.btn-secondary:hover {
    background: var(--slate-100);
    border-color: var(--slate-300);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Hero Stats */
.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    animation: fadeInDown 0.7s var(--ease-out-expo) 0.5s both;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--slate-800);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: var(--slate-200);
}

/* Hero Code Card */
.hero-code-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 620px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--slate-900);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    animation: fadeInUp 0.8s var(--ease-out-expo) 0.5s both;
}

.code-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--slate-800);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.code-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }

.code-filename {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--slate-400);
}

.code-block {
    margin: 0;
    padding: 20px 24px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.8;
    color: #c9d1d9;
    overflow-x: auto;
    tab-size: 4;
}

.code-keyword { color: #ff7b72; }
.code-module  { color: #79c0ff; }
.code-class   { color: #ffa657; }
.code-func    { color: #d2a8ff; }
.code-string  { color: #a5d6ff; }
.code-comment { color: #8b949e; font-style: italic; }

/* ---------- Section Commons ---------- */
.section-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section-header {
    text-align: center;
    max-width: 640px;
    margin: 0 auto 3.5rem;
}

.section-tag {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 100px;
    background: var(--orange-50);
    border: 1px solid var(--orange-200);
    color: var(--orange-700);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

.section-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--slate-900);
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin: 0 0 0.75rem;
}

.section-description {
    font-size: 0.95rem;
    color: var(--slate-500);
    line-height: 1.7;
    margin: 0;
}

/* ---------- Quick Start Section ---------- */
.section-quickstart {
    padding: 5rem 2rem;
    background: #ffffff;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.quickstart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}


@media (min-width: 1200px) {
    .quickstart-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.quickstart-step {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid var(--slate-200);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    transition: all 0.25s var(--ease-out-expo);
}

.quickstart-step:hover {
    border-color: var(--orange-400);
    box-shadow: 0 10px 25px rgba(249, 115, 22, 0.08);
    transform: translateY(-3px);
}

.step-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--orange-500), var(--orange-600));
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(249, 115, 22, 0.25);
}

.step-number.step-docker {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.25);
}

.step-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--slate-900);
    margin: 0;
}

.step-terminal {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
    min-height: 52px;
    justify-content: center;
}

.terminal-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.4;
    overflow-x: auto;
}

.terminal-prompt {
    color: #f97316;
    font-weight: 700;
    user-select: none;
    font-size: 0.85rem;
}

.terminal-line code {
    color: #f8fafc;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background: transparent;
    border: none;
    padding: 0;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.step-note {
    font-size: 0.75rem;
    color: var(--slate-500);
    margin: 10px 0 0;
}

/* ---------- Features Grid ---------- */
.section-features {
    padding: 5rem 2rem;
    background: var(--bg-body);
}

.features-grid {
    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    padding: 2rem;
    border-radius: 16px;
    background: var(--bg-section);
    border: 1px solid var(--border-subtle);
    transition: all 0.3s var(--ease-out-expo);
    cursor: default;
}

.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--orange-200);
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin-bottom: 1.25rem;
}

.feature-icon-orange  { background: var(--orange-50);  color: var(--orange-600); border: 1px solid var(--orange-200); }
.feature-icon-blue    { background: #eff6ff;           color: var(--blue-600);   border: 1px solid #bfdbfe; }
.feature-icon-green   { background: #f0fdf4;           color: var(--green-600);  border: 1px solid #bbf7d0; }
.feature-icon-purple  { background: #faf5ff;           color: var(--purple-600); border: 1px solid #e9d5ff; }
.feature-icon-pink    { background: #fdf2f8;           color: var(--pink-500);   border: 1px solid #fbcfe8; }
.feature-icon-amber   { background: #fffbeb;           color: var(--amber-500);  border: 1px solid #fde68a; }

.feature-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--slate-800);
    margin: 0 0 0.5rem;
}

.feature-card p {
    font-size: 0.85rem;
    color: var(--slate-500);
    line-height: 1.65;
    margin: 0;
}

/* ---------- Equivalence Table ---------- */
.section-equivalence {
    padding: 5rem 2rem;
    background: var(--bg-section);
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.equivalence-table-wrapper {
    max-width: 640px;
    margin: 0 auto;
    overflow-x: auto;
}

.equivalence-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    font-size: 0.875rem;
}

.equivalence-table thead th {
    background: var(--slate-50);
    padding: 12px 20px;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--slate-500);
    border-bottom: 1px solid var(--border-subtle);
}

.equivalence-table tbody td {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--slate-700);
}

.equivalence-table tbody tr:last-child td {
    border-bottom: none;
}

.equivalence-table tbody tr:hover {
    background: var(--orange-50);
}

.equivalence-table code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--orange-700);
    background: var(--orange-50);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--orange-100);
}

.arrow-cell {
    text-align: center;
    color: var(--orange-400);
    font-weight: 700;
    font-size: 1.1rem;
    width: 50px;
}

/* ---------- Action Cards ---------- */
.section-cards {
    padding: 5rem 2rem;
    background: var(--bg-body);
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 2rem;
    border-radius: 16px;
    background: var(--bg-section);
    border: 1px solid var(--border-subtle);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s var(--ease-out-expo);
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--orange-200);
}

.card-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    margin-bottom: 1.25rem;
}

.card-icon-orange { background: var(--orange-50);  color: var(--orange-600); border: 1px solid var(--orange-200); }
.card-icon-blue   { background: #eff6ff;           color: var(--blue-600);   border: 1px solid #bfdbfe; }
.card-icon-green  { background: #f0fdf4;           color: var(--green-600);  border: 1px solid #bbf7d0; }
.card-icon-purple { background: #faf5ff;           color: var(--purple-600); border: 1px solid #e9d5ff; }

.action-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--slate-800);
    margin: 0 0 0.5rem;
}

.action-card p {
    font-size: 0.85rem;
    color: var(--slate-500);
    line-height: 1.6;
    margin: 0;
}

/* ---------- Community / Discussions ---------- */
.section-community {
    padding: 5rem 2rem;
    background: var(--bg-section);
    border-top: 1px solid var(--border-subtle);
}

.discussions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.discussion-item {
    display: block;
    padding: 1.5rem;
    border-radius: 12px;
    background: var(--slate-50);
    border: 1px solid var(--border-subtle);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s var(--ease-out-expo);
}

.discussion-item:hover {
    background: #ffffff;
    border-color: var(--orange-200);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.discussion-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.discussion-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--orange-600);
    background: var(--orange-50);
    border: 1px solid var(--orange-200);
    padding: 2px 8px;
    border-radius: 6px;
}

.discussion-date {
    font-size: 0.7rem;
    color: var(--slate-400);
    font-family: var(--font-mono);
}

.discussion-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--slate-800);
    margin: 0 0 6px;
    line-height: 1.35;
}

.discussion-excerpt {
    font-size: 0.8rem;
    color: var(--slate-500);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.discussions-empty {
    text-align: center;
    padding: 3rem 2rem;
    border: 1px dashed var(--slate-200);
    border-radius: 16px;
    color: var(--slate-400);
}

.discussions-empty svg {
    color: var(--slate-300);
    margin-bottom: 1rem;
}

.discussions-empty p {
    font-size: 0.9rem;
    margin: 0;
}

.discussions-empty a {
    color: var(--orange-600);
    text-decoration: none;
    font-weight: 600;
}

.discussions-empty a:hover {
    text-decoration: underline;
}

/* ---------- Animations ---------- */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 1.5rem 2.5rem;
    }

    .hero-stats {
        gap: 1.25rem;
    }

    .stat-divider {
        display: none;
    }

    .hero-code-card {
        max-width: 100%;
    }

    .code-block {
        font-size: 0.7rem;
        padding: 16px;
    }

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

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

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

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

    .section-container {
        padding: 0 1.5rem;
    }
}

@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .hero-actions {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}
