/* ============================================================
   PHP-Coder Playground — design tokens
   Palette: charcoal-blue base, PHP-elephant purple as primary
   accent, amber as the "terminal cursor" secondary accent.
   Type: IBM Plex Mono (display/code), IBM Plex Sans (body/UI).
   ============================================================ */

:root {
    --bg-void: #14171d;
    --panel: #1b1f27;
    --panel-alt: #232834;
    --line: #2c3240;

    --php-purple: #8993be;
    --php-purple-deep: #6a74a0;
    --amber: #f2c572;

    --text-primary: #e8eaf0;
    --text-muted: #8b93a6;
    --success: #7ec699;
    --error: #e5707a;

    --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
    --font-sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;

    --radius: 10px;
    --wrap: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg-void);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 24px;
}

/* faint grain so the flat dark background doesn't feel like a template default */
.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- topbar ---------- */

.topbar {
    position: relative;
    z-index: 2;
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.brand {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.brand-mark {
    color: var(--php-purple);
    margin-right: 2px;
}

.nav-link {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--line);
    padding: 8px 14px;
    border-radius: 999px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover, .nav-link:focus-visible { color: var(--text-primary); border-color: var(--php-purple-deep); }

/* ---------- hero ---------- */

.hero { position: relative; z-index: 1; padding: 80px 0 96px; }

.hero-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 56px;
    align-items: center;
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--amber);
    letter-spacing: 0.02em;
    margin: 0 0 14px;
}

.eyebrow em { font-style: normal; color: var(--php-purple); }

.hero-copy h1 {
    font-family: var(--font-mono);
    font-size: clamp(2.1rem, 4vw, 3.1rem);
    line-height: 1.12;
    letter-spacing: -0.02em;
    margin: 0 0 22px;
}

.hero-copy h1 .accent { color: var(--php-purple); }

.lede {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 46ch;
    margin: 0 0 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    padding: 13px 22px;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--php-purple);
    color: #10121a;
}

.btn-primary:hover { background: #9aa3ca; }

.btn-primary:disabled {
    background: var(--panel-alt);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-block { width: 100%; justify-content: center; margin-top: 18px; }

/* ---------- hero terminal (signature element) ---------- */

.hero-terminal {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 30px 80px -30px rgba(0,0,0,0.6);
}

.terminal-chrome {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-alt);
}

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-red { background: var(--error); }
.dot-amber { background: var(--amber); }
.dot-green { background: var(--success); }

.terminal-title {
    margin-left: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.terminal-body {
    margin: 0;
    padding: 22px 20px 28px;
    font-family: var(--font-mono);
    font-size: 0.92rem;
    color: var(--text-primary);
    min-height: 220px;
    white-space: pre-wrap;
    word-break: break-word;
}

.cursor {
    color: var(--amber);
    animation: blink 1s step-end infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ---------- playground ---------- */

.playground { position: relative; z-index: 1; padding: 40px 0 100px; }

.section-head { margin-bottom: 28px; }

.section-head h2 {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    margin: 0;
    letter-spacing: -0.01em;
}

.notice {
    background: rgba(242, 197, 114, 0.08);
    border: 1px solid rgba(242, 197, 114, 0.35);
    color: var(--text-primary);
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 0.92rem;
    margin-bottom: 24px;
}

.notice code {
    background: rgba(255,255,255,0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

.panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}

.panel-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

#prompt {
    width: 100%;
    background: var(--panel-alt);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 14px;
    resize: vertical;
}

#prompt:focus-visible { outline: 2px solid var(--php-purple); outline-offset: 2px; }

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 18px 0 4px;
}

.control {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 140px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.control input[type="range"] { accent-color: var(--php-purple); }

.control output { color: var(--text-primary); }

.status {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 10px 0 0;
}

.status.is-error { color: var(--error); }
.status.is-success { color: var(--success); }

.panel-output { display: flex; flex-direction: column; }

.output-code {
    margin: 0;
    flex: 1;
    background: var(--panel-alt);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 260px;
    overflow: auto;
}

/* ---------- footer ---------- */

.site-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--line);
    padding: 28px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.site-footer code {
    background: rgba(255,255,255,0.06);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
    .hero-grid { grid-template-columns: 1fr; }
    .panel-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .cursor { animation: none; }
    html { scroll-behavior: auto; }
}
