:root {
    --bg: #100f0d;
    --surface: #1c1915;
    --surface-2: #252119;
    --border: rgba(255, 255, 255, 0.11);
    --border-strong: rgba(255, 255, 255, 0.18);
    --text: #f6f1ea;
    --text-muted: rgba(246, 241, 234, 0.74);
    --text-dim: rgba(246, 241, 234, 0.52);
    --accent: #d39866;
    --accent-soft: rgba(211, 152, 102, 0.18);
    --accent-strong: #e0a874;
    --accent-glow: rgba(211, 152, 102, 0.08);
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font-sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
    --font-mono: "DM Mono", ui-monospace, "SF Mono", monospace;
    --nav-height: 64px;
    --content-max: 1100px;
}

@supports (color: oklch(0% 0 0)) {
    :root {
        --accent: oklch(74% 0.13 55);
        --accent-soft: oklch(74% 0.13 55 / 0.18);
        --accent-strong: oklch(79% 0.13 55);
        --accent-glow: oklch(74% 0.13 55 / 0.08);
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-weight: 400;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; border: 0; background: none; color: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }

::selection {
    background: var(--accent-soft);
    color: var(--text);
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
    border-radius: inherit;
}

/* Reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
}

/* Nav */
#nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-height);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}

#nav.scrolled {
    background: rgba(17, 15, 13, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom-color: var(--border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.brand .mark { color: var(--accent); }

.brand-name {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-links a {
    font-size: 14px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

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

.nav-links .btn-sm {
    padding: 8px 17px;
    font-size: 14px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 16px;
    border-radius: var(--radius-sm);
    padding: 13px 28px;
    transition: opacity 0.2s ease, transform 0.15s ease, color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

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

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

.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: 500;
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

/* Hero */
.hero {
    position: relative;
    padding: calc(var(--nav-height) + 80px) 24px 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}

.hero-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 100%);
}

.hero-glow {
    position: absolute;
    top: 12%;
    left: 50%;
    width: 640px;
    height: 320px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: var(--accent-glow);
    filter: blur(90px);
    pointer-events: none;
}

.badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin-bottom: 40px;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: var(--surface);
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.hero h1 {
    position: relative;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 56px;
    line-height: 1.08;
    letter-spacing: 0;
    color: var(--text);
    max-width: 1100px;
    margin-bottom: 28px;
}

.hero-sub {
    position: relative;
    font-weight: 400;
    font-size: 20px;
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 650px;
    margin-bottom: 40px;
}

.hero-ctas {
    position: relative;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 48px;
}

/* Terminal */
.terminal-wrap {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
}

.terminal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.terminal-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

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

.terminal-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0.7;
}

.terminal-dots span:nth-child(1) { background: #e05252; }
.terminal-dots span:nth-child(2) { background: #e0a952; }
.terminal-dots span:nth-child(3) { background: #52d652; }

.terminal-tabs {
    display: flex;
    gap: 2px;
    padding: 2px;
    background: var(--bg);
    border-radius: var(--radius-xs);
}

.terminal-tabs button {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 5px;
    color: var(--text-muted);
    transition: background 0.15s ease, color 0.15s ease;
}

.terminal-tabs button[aria-selected="true"] {
    background: var(--surface);
    color: var(--text);
}

.terminal-spacer { width: 60px; }

.terminal-body {
    padding: 20px 24px;
    min-height: 220px;
    text-align: left;
    overflow-x: auto;
}

.snippet {
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 23px;
    white-space: pre;
    color: var(--text-muted);
}

.snippet .t-dim    { color: var(--text-dim); }
.snippet .t-cmd    { color: rgba(246, 241, 234, 0.86); }
.snippet .t-out    { color: var(--text-dim); }
.snippet .t-accent { color: var(--accent-strong); }
.snippet .t-kw     { color: var(--accent-strong); }
.snippet .t-str    { color: #d4be94; color: oklch(78% 0.08 80); }

/* Section heads */
.section-head {
    text-align: center;
    margin-bottom: 64px;
}

.section-head h2 {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 44px;
    line-height: 1.15;
    letter-spacing: 0;
    color: var(--text);
}

/* Features */
.features {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 40px 24px 100px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.feature-card:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.feature-icon {
    color: var(--accent);
    margin-bottom: 18px;
}

.feature-icon svg {
    width: 24px;
    height: 24px;
}

.feature-card h3 {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 18px;
    color: var(--text);
    margin-bottom: 12px;
}

.feature-card p {
    font-weight: 400;
    font-size: 15.5px;
    line-height: 1.7;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 860px) {
    #nav { padding: 0 20px; }
    .nav-links { gap: 18px; }
    .hero { padding: calc(var(--nav-height) + 56px) 20px 36px; }
    .hero h1 { font-size: 46px; }
    .hero-sub { font-size: 18px; }
    .section-head h2 { font-size: 36px; }
    .features { padding: 32px 20px 80px; }
}

@media (max-width: 480px) {
    .nav-links a[href="https://github.com/saeid/pingd"] { display: none; }
    .terminal-body { padding: 16px; }
    .snippet { font-size: 12px; line-height: 20px; }
    .btn { padding: 12px 22px; font-size: 14px; }
    .hero h1 { font-size: 38px; }
    .hero-sub { font-size: 17px; }
    .section-head { margin-bottom: 40px; }
    .section-head h2 { font-size: 31px; }
    .feature-card { padding: 26px; }
    .feature-card p { font-size: 15px; }
}
