/* ─────────────────────────────────────────
   CSS VARIABLES — light theme tokens
   All --old-dark vars mapped to site palette
───────────────────────────────────────── */
:root {
    /* Brand */
    --brand:          #4eb39a;
    --brand-dark:     #3a9b83;
    --brand-deep:     #0e2d27;
    --accent-light:   #e1f5ee;
    --accent-mid:     #b3e6d8;
    /* Text */
    --text:           #1a2e2b;
    --text-muted:     #5f7a74;
    --text-subtle:    #94aaa6;
    /* Borders */
    --border-light:   rgba(78,179,154,0.15);
    --border-mid:     rgba(78,179,154,0.25);
    --border-strong:  rgba(78,179,154,0.4);
    /* Semantic colours (used by JS-rendered HTML) */
    --green:          #16a34a;
    --green-d:        rgba(22,163,74,0.08);
    --green-b:        rgba(22,163,74,0.22);
    --blue:           #2563eb;
    --blue-d:         rgba(37,99,235,0.08);
    --yellow:         #d97706;
    --yellow-d:       rgba(217,119,6,0.08);
    --red:            #dc2626;
    --red-d:          rgba(220,38,38,0.08);
    --purple:         #7c3aed;
    --purple-d:       rgba(124,58,237,0.08);
    /* Legacy aliases (used inline in JS renders) */
    --text0:          #1a2e2b;
    --text1:          #0e2d27;
    --text2:          #5f7a74;
    --text3:          #94aaa6;
    --bg0:            #f5f9f8;
    --bg1:            #ffffff;
    --bg2:            #f5f9f8;
    --bg3:            #eaf4f1;
    --bg4:            #e1f0ec;
    --border:         rgba(78,179,154,0.15);
    --border2:        rgba(78,179,154,0.3);
    --syne:           'DM Sans', sans-serif;
    --mono:           'DM Mono', monospace;
    --teal:           #0d9488;
}

/* ─────────────────────────────────────────
   PAGE WRAPPER
───────────────────────────────────────── */
.ipc-page {
    font-family: 'DM Sans', -apple-system, sans-serif;
    background: #f5f9f8;
    min-height: 100vh;
    color: var(--text);
}

/* ─────────────────────────────────────────
   HERO — dark card (consistent with other tools)
───────────────────────────────────────── */
.ipc-hero {
    background: linear-gradient(145deg, #0e2d27 0%, #1a4a3d 60%, #0e3530 100%);
    border-bottom: 1px solid rgba(78,179,154,0.2);
    padding: 2.5rem 2rem 2rem;
    position: relative;
    overflow: hidden;
}
.ipc-hero::before {
    content: '';
    position: absolute;
    top: -60px; left: 50%;
    transform: translateX(-50%);
    width: 600px; height: 320px;
    background: radial-gradient(ellipse, rgba(78,179,154,0.1) 0%, transparent 70%);
    pointer-events: none;
}
.ipc-hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2.5rem;
    align-items: center;
    position: relative;
    z-index: 1;
}
.ipc-eyebrow {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    font-weight: 500;
    color: rgba(111,209,179,0.7);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 0.55rem;
    display: flex;
    align-items: center;
    gap: 7px;
}
.ipc-eyebrow::before { content: '//'; opacity: 0.5; }
.ipc-hero h1, .ipc-hero h2 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}
.ipc-hero h1 em, .ipc-hero h2 em { font-style: normal; color: #6fd1b3; }
.ipc-hero > .ipc-hero-inner > div > p {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.55);
    line-height: 1.8;
    max-width: 480px;
}
.ipc-feat-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 0.9rem;
}
.ipc-feat {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.45);
}
.ipc-feat::before { content: '▸'; color: #6fd1b3; font-size: 8px; }

/* Hero stat panel */
.ipc-stat-panel {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(78,179,154,0.25);
    border-radius: 10px;
    padding: 1.1rem 1.2rem;
    display: none;
}
.ipc-stat-panel.show { display: block; }
.isp-title {
    font-family: 'DM Mono', monospace;
    font-size: 0.6rem;
    color: rgba(111,209,179,0.6);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.65rem;
}
.isp-rows { display: flex; flex-direction: column; gap: 4px; }
.isp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.isp-row:last-child { border-bottom: none; }
.isp-k { font-family: 'DM Mono', monospace; font-size: 0.7rem; color: rgba(255,255,255,0.4); }
.isp-v { font-family: 'DM Mono', monospace; font-size: 0.75rem; font-weight: 500; color: #fff; }
.isp-v.green  { color: #6fd1b3; }
.isp-v.blue   { color: #7eb8f4; }
.isp-v.yellow { color: #f9cb42; }
.isp-v.red    { color: #f87171; }

/* ─────────────────────────────────────────
   MAIN CONTENT AREA
───────────────────────────────────────── */
.ipc-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.75rem 2rem;
}

/* Section heading — matches site pattern */
.sec-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.sec-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(78,179,154,0.15);
}

/* ─────────────────────────────────────────
   INPUT CARD
───────────────────────────────────────── */
.input-card {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.input-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }

.ic-head {
    background: #f5f9f8;
    padding: 0.8rem 1.4rem;
    border-bottom: 1px solid rgba(78,179,154,0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.ic-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #0e2d27;
}
.ic-title svg { width: 14px; height: 14px; stroke: #3a9b83; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-body { padding: 1.25rem 1.4rem; }

/* Mode toggle */
.mode-toggle {
    display: flex;
    gap: 3px;
    background: #eaf4f1;
    border: 1px solid rgba(78,179,154,0.2);
    border-radius: 7px;
    padding: 3px;
}
.mode-btn {
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-muted);
    background: transparent;
    letter-spacing: 0.04em;
}
.mode-btn.active {
    background: #4eb39a;
    color: #fff;
    font-weight: 700;
}
.mode-btn:not(.active):hover { background: rgba(78,179,154,0.15); color: #3a9b83; }

/* Input grid */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 1rem;
    align-items: end;
}
.input-group { display: flex; flex-direction: column; gap: 5px; }
.input-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
}
.ip-input {
    background: #f5f9f8;
    border: 1px solid rgba(78,179,154,0.25);
    border-radius: 8px;
    padding: 10px 14px;
    font-family: 'DM Mono', monospace;
    font-size: 0.95rem;
    font-weight: 500;
    color: #0e2d27;
    outline: none;
    width: 100%;
    letter-spacing: 0.04em;
    transition: border-color 0.2s, background 0.2s;
}
.ip-input::placeholder { color: #94aaa6; font-size: 0.85rem; font-weight: 400; }
.ip-input:focus { border-color: #4eb39a; background: #fff; }
.ip-input.err { border-color: rgba(220,38,38,0.5); color: #dc2626; background: rgba(220,38,38,0.04); }

/* Calculate button */
.btn-calc {
    background: #4eb39a;
    border: none;
    border-radius: 9px;
    padding: 10px 22px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    color: #0e2d27;
    cursor: pointer;
    transition: background 0.15s, transform 0.14s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.btn-calc:hover { background: #3a9b83; transform: translateY(-1px); }
.btn-calc:active { transform: scale(0.98); }
.btn-calc svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.5; }

/* Presets */
.preset-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0.75rem;
}
.preset-lbl {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-subtle);
    letter-spacing: 0.06em;
    font-weight: 600;
    text-transform: uppercase;
}
.preset-btn {
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 5px;
    border: 1px solid rgba(78,179,154,0.2);
    background: #f5f9f8;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.preset-btn:hover { border-color: #4eb39a; color: #3a9b83; background: #e1f5ee; }

/* Error message */
.err-msg {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 0.4rem;
    display: none;
}
.err-msg.show { display: block; }

/* ─────────────────────────────────────────
   RESULTS SECTION
───────────────────────────────────────── */
#ipc-results { display: none; }

/* Result grid */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
    margin-bottom: 1.5rem;
}
.res-card {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-top: 2.5px solid var(--rc-accent, #4eb39a);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.res-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.07); }
.rc-lbl {
    font-family: 'DM Mono', monospace;
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
    font-weight: 600;
}
.rc-val {
    font-family: 'DM Mono', monospace;
    font-size: 0.875rem;
    font-weight: 500;
    color: #0e2d27;
    line-height: 1.3;
    word-break: break-all;
}
.rc-sub {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-subtle);
    margin-top: 2px;
}
.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #e1f5ee;
    border: 1px solid rgba(78,179,154,0.25);
    border-radius: 4px;
    padding: 2px 7px;
    font-family: 'DM Mono', monospace;
    font-size: 0.6rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    opacity: 0;
}
.res-card:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: #4eb39a; border-color: #4eb39a; color: #fff; }
.copy-btn.copied { color: #3a9b83; border-color: #4eb39a; background: #e1f5ee; }

/* ─────────────────────────────────────────
   BINARY VISUALIZER
───────────────────────────────────────── */
.binary-card {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-radius: 12px;
    padding: 1.25rem 1.4rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}
.binary-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.binary-row:last-child { margin-bottom: 0; }
.bin-lbl {
    font-family: 'DM Mono', monospace;
    font-size: 0.62rem;
    color: var(--text-muted);
    width: 65px;
    flex-shrink: 0;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 600;
}
.bit-group { display: flex; gap: 2px; }
.bit {
    width: 18px; height: 22px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s;
    flex-shrink: 0;
}
.bit-sep { width: 6px; flex-shrink: 0; }
/* Network bits — brand green */
.bit-1-net { background: rgba(78,179,154,0.18); color: #0e2d27;  border: 1px solid rgba(78,179,154,0.4); }
.bit-0-net { background: #f5f9f8;                color: #94aaa6;  border: 1px solid rgba(78,179,154,0.12); }
/* Host bits — blue tint */
.bit-1-host { background: rgba(37,99,235,0.1);   color: #1e40af;  border: 1px solid rgba(37,99,235,0.25); }
.bit-0-host { background: #f5f9f8;                color: #b3c8c4;  border: 1px solid rgba(78,179,154,0.08); }

.bit-legend { display: flex; gap: 14px; margin-top: 0.75rem; flex-wrap: wrap; }
.bleg { display: flex; align-items: center; gap: 5px; font-family: 'DM Mono', monospace; font-size: 0.65rem; color: var(--text-muted); }
.bleg-dot { width: 10px; height: 10px; border-radius: 2px; }

/* ─────────────────────────────────────────
   TYPE BADGE
───────────────────────────────────────── */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 5px;
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.tb-private   { color: #16a34a; border-color: rgba(22,163,74,0.3);    background: rgba(22,163,74,0.08); }
.tb-public    { color: #2563eb; border-color: rgba(37,99,235,0.3);    background: rgba(37,99,235,0.08); }
.tb-loopback  { color: #7c3aed; border-color: rgba(124,58,237,0.3);   background: rgba(124,58,237,0.08); }
.tb-multicast { color: #d97706; border-color: rgba(217,119,6,0.3);    background: rgba(217,119,6,0.08); }
.tb-apipa     { color: #d97706; border-color: rgba(217,119,6,0.3);    background: rgba(217,119,6,0.08); }
.tb-reserved  { color: #dc2626; border-color: rgba(220,38,38,0.3);    background: rgba(220,38,38,0.08); }

/* ─────────────────────────────────────────
   SPLIT SUBNETS TABLE
───────────────────────────────────────── */
.split-card {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.split-head {
    background: #f5f9f8;
    padding: 0.75rem 1.2rem;
    border-bottom: 1px solid rgba(78,179,154,0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.split-head-title {
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    font-weight: 600;
    color: #0e2d27;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.split-controls { display: flex; gap: 8px; align-items: center; }
.split-select {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.25);
    border-radius: 6px;
    padding: 5px 10px;
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: #0e2d27;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}
.split-select:focus { border-color: #4eb39a; }
.split-table-wrap { overflow-x: auto; max-height: 320px; overflow-y: auto; }
.split-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.split-table th {
    padding: 0.45rem 0.9rem;
    text-align: left;
    font-family: 'DM Mono', monospace;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: #eaf4f1;
    border-bottom: 1px solid rgba(78,179,154,0.15);
    position: sticky; top: 0; z-index: 1;
}
.split-table td {
    padding: 0.4rem 0.9rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: #1a2e2b;
    border-bottom: 1px solid rgba(78,179,154,0.06);
}
.split-table tr:hover td { background: rgba(78,179,154,0.04); }
.split-table tr:last-child td { border-bottom: none; }
.sn-idx { color: #94aaa6; font-size: 0.68rem; }
.sn-net { color: #3a9b83; font-weight: 600; }

/* ─────────────────────────────────────────
   CLASS INFO CARD
───────────────────────────────────────── */
.class-card {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-radius: 10px;
    padding: 1.1rem 1.2rem;
    margin-bottom: 1.5rem;
}
.class-badge { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 0.65rem; }
.class-letter {
    font-family: 'DM Sans', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: #3a9b83;
    line-height: 1;
}
.class-name { font-family: 'DM Mono', monospace; font-size: 0.72rem; color: var(--text-muted); }
.class-rows {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 4px;
}
.class-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(78,179,154,0.07);
}
.class-row:last-child { border-bottom: none; }
.cr-k { font-family: 'DM Mono', monospace; font-size: 0.7rem; color: var(--text-muted); }
.cr-v { font-family: 'DM Mono', monospace; font-size: 0.72rem; color: #0e2d27; font-weight: 500; }

/* Two-col layout */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 1.5rem;
}

/* ─────────────────────────────────────────
   REFERENCE TABLES
───────────────────────────────────────── */
.ref-table-wrap {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0;
}
.ref-table { width: 100%; border-collapse: collapse; }
.ref-table th {
    padding: 0.45rem 0.9rem;
    text-align: left;
    font-family: 'DM Mono', monospace;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: #f5f9f8;
    border-bottom: 1px solid rgba(78,179,154,0.12);
}
.ref-table td {
    padding: 0.4rem 0.9rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    color: #1a2e2b;
    border-bottom: 1px solid rgba(78,179,154,0.06);
}
.ref-table tr:last-child td { border-bottom: none; }
.ref-table tr:hover td { background: rgba(78,179,154,0.03); }

/* Inline colour overrides for JS-rendered table rows that use CSS vars */
/* These ensure var(--green), var(--red), etc. resolve correctly on light bg */

/* ─────────────────────────────────────────
   SEO / FAQ CARD
───────────────────────────────────────── */
.seo-block {
    background: #fff;
    border: 1px solid rgba(78,179,154,0.18);
    border-radius: 10px;
    padding: 1.75rem 2rem;
    margin-top: 2rem;
}
.seo-block h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0e2d27;
    margin-bottom: 0.5rem;
}
.seo-block > p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.8;
}
.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 10px;
    margin-top: 1.25rem;
}
.faq-card {
    background: #f5f9f8;
    border: 1px solid rgba(78,179,154,0.15);
    border-radius: 10px;
    padding: 1rem 1.1rem;
}
.faq-q { font-size: 0.875rem; font-weight: 600; color: #0e2d27; margin-bottom: 0.3rem; }
.faq-a { font-size: 0.82rem; color: var(--text-muted); line-height: 1.7; }

/* ─────────────────────────────────────────
   TOAST
───────────────────────────────────────── */
.ipc-toast {
    position: fixed;
    bottom: 1.75rem;
    right: 1.75rem;
    background: #0e2d27;
    border: 1px solid rgba(78,179,154,0.35);
    border-radius: 7px;
    padding: 0.55rem 1rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    color: #6fd1b3;
    z-index: 999;
    transform: translateY(50px);
    opacity: 0;
    transition: all 0.25s;
    pointer-events: none;
}
.ipc-toast.show { transform: translateY(0); opacity: 1; }

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 768px) {
    .ipc-hero-inner { grid-template-columns: 1fr; }
    .ipc-main { padding: 1rem; }
    .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .input-grid { grid-template-columns: 1fr; }
    .ipc-hero { padding: 2rem 1.25rem 1.75rem; }
    .seo-block { padding: 1.25rem; }
}
