/* ============================================================
   IANLAN — Unified Design System
   Marketing + Tools under one stylesheet.

   Contexts:
     body.page-marketing  — light content, dark header/footer
     body.page-tools      — full dark (tools aesthetic)
============================================================ */

/* --- Google Fonts loaded via <link> in layout.php --- */

:root {
    /* === Brand Core === */
    --brand-purple: #0f172a;
    --brand-indigo: #0ea5e9;
    --brand-green: #06b6d4;
    --brand-teal: #38bdf8;

    /* === Surfaces === */
    --surface-dark: #0a0f1a;
    --surface-dark-card: #0f1729;
    --surface-dark-mid: #131c2e;
    --surface-light: #f8fafc;
    --surface-white: #ffffff;

    /* === Text === */
    --text-on-dark: #e2e8f0;
    --text-on-dark-muted: #94a3b8;
    --text-on-light: #0f172a;
    --text-on-light-muted: #64748b;

    /* === Accents === */
    --accent: var(--brand-indigo);
    --accent-soft: rgba(14, 165, 233, 0.12);
    --accent-strong: rgba(56, 189, 248, 0.3);
    --gradient-brand: linear-gradient(90deg, var(--brand-purple), var(--brand-indigo));
    --gradient-accent: linear-gradient(to right, var(--brand-indigo), var(--brand-green));

    /* === Borders & Shadows === */
    --border-subtle: rgba(148, 163, 184, 0.25);
    --border-light: #e2e8f0;
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.75);
    --shadow-light: 0 1px 4px rgba(0, 0, 0, 0.05);

    /* === Layout === */
    --radius-md: 10px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-pill: 999px;
    --max-width: 1200px;
    --max-width-tools: 1120px;

    /* === Backward-compatible aliases (tools inline styles) === */
    --bg-dark: var(--surface-dark);
    --bg-card: var(--surface-dark);
    --text-main: var(--text-on-dark);
    --text-muted: var(--text-on-dark-muted);
    --teal: var(--brand-teal);
    --teal-soft: rgba(56, 189, 248, 0.18);

    /* === Marketing color aliases === */
    --purple: var(--brand-purple);
    --green: var(--brand-green);
    --gray: var(--text-on-light-muted);
    --dark-text: var(--text-on-light);
    --light-bg: var(--surface-light);
}

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

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    transition: color 0.15s;
}

img { max-width: 100%; height: auto; }

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


/* ============================================================
   SHARED LAYOUT
============================================================ */

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-tools {
    max-width: var(--max-width-tools);
    margin: 0 auto;
    padding: 0 1rem;
}


/* ============================================================
   HEADER (shared, always dark)
============================================================ */

.site-header {
    background: var(--surface-dark);
    border-bottom: 1px solid var(--surface-dark-mid);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    gap: 1.5rem;
}

.brand { display: flex; align-items: center; }
.brand-logo { height: 40px; }

.site-nav {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.site-nav a {
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-on-dark-muted);
    transition: color 0.15s, background 0.15s;
}

.site-nav a:hover {
    color: var(--text-on-dark);
    background: rgba(255, 255, 255, 0.06);
}

.site-nav a.active {
    color: var(--text-on-dark);
    background: rgba(255, 255, 255, 0.08);
}

.header-cta {
    background: var(--gradient-brand);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.header-cta:hover {
    opacity: 0.9;
    color: #fff;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-on-dark);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.mobile-menu-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }


/* ============================================================
   FOOTER (shared, always dark)
============================================================ */

.site-footer {
    background: var(--surface-dark-mid);
    color: var(--text-on-dark);
    padding: 3rem 0 1.5rem;
    margin-top: auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-footer h3 {
    color: var(--brand-teal);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.site-footer p,
.site-footer li {
    font-size: 0.9rem;
    color: var(--text-on-dark-muted);
    margin-bottom: 0.35rem;
}

.site-footer a {
    color: var(--text-on-dark-muted);
}

.site-footer a:hover {
    color: var(--text-on-dark);
}

.copyright {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-on-dark-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1rem;
    margin-top: 2rem;
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}


/* ============================================================
   PAGE CONTEXT: MARKETING (light content)
============================================================ */

.page-marketing {
    background: var(--surface-light);
    color: var(--text-on-light);
}

.page-marketing .site-main {
    min-height: 60vh;
}

/* Hero */
.page-marketing .hero {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.04), rgba(6, 182, 212, 0.06));
    padding: 4rem 0;
}

.page-marketing .hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 3rem;
    align-items: center;
}

.page-marketing .hero-text .tagline {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand-purple);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem;
}

.page-marketing .hero-text h1 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    color: var(--brand-purple);
    margin: 0 0 1rem;
    line-height: 1.15;
}

.page-marketing .hero-text .desc {
    color: var(--text-on-light-muted);
    margin-bottom: 1.5rem;
    max-width: 40rem;
}

.page-marketing .hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-marketing .note {
    font-size: 0.8rem;
    color: var(--text-on-light-muted);
    margin-top: 1rem;
}

/* Primary / Secondary buttons */
.primary-btn {
    background: var(--gradient-brand);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    display: inline-block;
    transition: opacity 0.15s;
    border: none;
    cursor: pointer;
}

.primary-btn:hover { opacity: 0.9; color: #fff; }

.secondary-btn {
    border: 2px solid var(--brand-purple);
    color: var(--brand-purple);
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    display: inline-block;
    background: transparent;
    transition: background 0.15s, color 0.15s;
}

.secondary-btn:hover {
    background: var(--brand-purple);
    color: #fff;
}

/* KPIs */
.page-marketing .kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.page-marketing .kpi {
    background: var(--surface-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-light);
}

.page-marketing .kpi .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-purple);
}

.page-marketing .kpi .title {
    font-size: 0.85rem;
    color: var(--text-on-light-muted);
}

/* Tools Preview Section */
.why-ianlan {
    padding: 4rem 0;
    background: #f1f5f9;
    text-align: center;
}

.why-ianlan h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-on-light);
    margin: 0 0 0.5rem;
}

.why-ianlan .section-subtitle {
    color: var(--text-on-light-muted);
    font-size: 1.05rem;
    margin: 0 0 2.5rem;
}

.why-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    max-width: 960px;
    margin: 0 auto;
}

.why-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.why-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1rem;
    box-shadow: 4px 4px 10px rgba(15, 23, 42, 0.1), -2px -2px 6px rgba(248, 250, 252, 0.9);
}

.why-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-on-light);
    margin: 0 0 0.5rem;
}

.why-card p {
    color: var(--text-on-light-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

@media (max-width: 768px) {
    .why-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

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

/* Peering Comparison Table */
.peering-section {
    padding: 4rem 0;
    background: var(--surface-white);
    text-align: center;
}

.peering-section h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-on-light);
    margin: 0 0 0.5rem;
}

.peering-section .section-subtitle {
    color: var(--text-on-light-muted);
    font-size: 1.05rem;
    margin: 0 0 2rem;
}

.peering-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

.peering-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: center;
}

.peering-table thead th {
    background: var(--surface-dark);
    color: var(--brand-teal);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.75rem 0.6rem;
    white-space: nowrap;
    border-bottom: 2px solid var(--surface-dark-mid);
}

.peering-table thead th:first-child {
    text-align: left;
    background: var(--surface-dark);
}

.peering-table tbody td {
    padding: 0.6rem 0.6rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-on-light);
    white-space: nowrap;
}

.peering-table tbody tr:nth-child(even) {
    background: #f1f5f9;
}

.peering-table tbody td.row-label {
    text-align: left;
    font-weight: 600;
    color: var(--text-on-light);
    white-space: nowrap;
}

.peering-table .highlight-col {
    background: rgba(34, 211, 238, 0.08);
    font-weight: 600;
}

.peering-table thead th.highlight-col {
    background: rgba(34, 211, 238, 0.15);
    color: var(--brand-teal);
}

/* Contact Section */
.page-marketing .contact {
    background: var(--gradient-brand);
    color: #fff;
    padding: 4rem 0;
    margin-bottom: 3rem;
}

.page-marketing .contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.page-marketing .contact h2 {
    color: #fff;
    margin: 0 0 0.75rem;
}

.page-marketing .contact p {
    color: rgba(255, 255, 255, 0.85);
}

.page-marketing .contact-form {
    display: grid;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.page-marketing .contact-form input,
.page-marketing .contact-form textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
}

.page-marketing .contact-form button {
    background: #fff;
    color: var(--brand-indigo);
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    transition: background 0.15s;
}

.page-marketing .contact-form button:hover {
    background: #e2e8f0;
}

.page-marketing .contact-form button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Form message feedback */
.form-message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

.form-message.success {
    background: rgba(34, 197, 94, 0.2);
    color: #dcfce7;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.form-message.error {
    background: rgba(239, 68, 68, 0.2);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.4);
}


/* ============================================================
   PAGE CONTEXT: TOOLS (full dark)
============================================================ */

.page-tools {
    background: radial-gradient(circle at top, #131c2e 0, #0a0f1a 55%, #050810 100%);
    color: var(--text-on-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-tools .site-main {
    flex: 1;
    padding: 2rem 0;
}

.page-tools a {
    color: var(--accent);
}

.page-tools a:hover {
    text-decoration: underline;
}

/* Tools Hero */
.page-tools .hero {
    margin-bottom: 32px;
}

.page-tools .hero-title {
    font-size: clamp(2.2rem, 4vw, 2.8rem);
    margin: 0 0 10px;
    letter-spacing: -0.04em;
    color: var(--text-on-dark);
}

.page-tools .hero-subtitle {
    margin: 0;
    color: var(--text-on-dark-muted);
    max-width: 40rem;
    font-size: 0.98rem;
}

/* Tool Card Grid */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 26px;
}

@media (max-width: 960px) {
    .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .tool-grid { grid-template-columns: minmax(0, 1fr); }
}

.tool-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: radial-gradient(circle at top left, var(--accent-soft), var(--bg-card));
    box-shadow: var(--shadow-soft);
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 170px;
}

.tool-card::before {
    content: "";
    position: absolute;
    inset: -40%;
    background: radial-gradient(circle at 120% -20%, var(--accent-strong), transparent 55%);
    opacity: 0.25;
    pointer-events: none;
}

.tool-card-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.tool-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-on-dark-muted);
}

.tool-tag-pill {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-pill);
    background: var(--accent);
}

.tool-title {
    margin: 0;
    font-size: 1.1rem;
}

.tool-desc {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-on-dark-muted);
}

.tool-meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-on-dark-muted);
}

/* Tool Buttons */
.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn,
a.btn,
.page-tools .btn,
.page-tools a.btn {
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    padding: 6px 12px;
    font-size: 0.82rem;
    background: #0ea5e9 !important;
    color: #fff !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none !important;
    font-family: inherit;
    transition: background 0.15s;
}

.btn:hover,
a.btn:hover,
.page-tools .btn:hover,
.page-tools a.btn:hover { background: #06b6d4 !important; }

.btn.secondary {
    background: transparent;
    border-color: var(--border-subtle);
    color: var(--text-on-dark);
}

.btn.hero {
    background: var(--gradient-accent);
}

/* Tools footer note (used by older tools pages) */
.footer-note {
    margin-top: 26px;
    font-size: 0.8rem;
    color: var(--text-on-dark-muted);
    text-align: center;
}

/* Code blocks in tools */
.page-tools code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85em;
}


/* ============================================================
   RESPONSIVE
============================================================ */

@media (max-width: 768px) {
    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface-dark);
        border-bottom: 1px solid var(--surface-dark-mid);
        flex-direction: column;
        padding: 0.5rem 1rem 1rem;
        gap: 0;
    }

    .site-nav.open {
        display: flex;
    }

    .site-nav a {
        padding: 0.6rem 0.75rem;
        width: 100%;
    }

    .header-cta {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .header-inner {
        position: relative;
    }

    .page-marketing .hero-grid {
        grid-template-columns: 1fr;
    }

    .page-marketing .contact-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .page-marketing .kpi-grid {
        grid-template-columns: 1fr;
    }
}
