/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #000;
    --text:        #fff;
    --body-text:   oklch(0.8 0 0);
    --muted:       oklch(0.55 0 0);
    --dim:         oklch(0.6 0 0);
    --dark:        oklch(0.4 0 0);
    --surface:     oklch(0.12 0 0);
    --hairline:    rgba(255, 255, 255, 0.22);
    --hairline-md: rgba(255, 255, 255, 0.3);
    --frame-inset: clamp(16px, 4vw, 32px);
    --page-x:      clamp(20px, 6vw, 64px);
    --mono:        'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
}

html, body { height: 100%; background: var(--bg); }
body {
    color: var(--text);
    font-family: var(--mono);
    font-size: 14px;
}

::selection { background: rgba(255, 255, 255, 0.25); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: oklch(0.32 0 0); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

button, input, textarea { font-family: inherit; }
input[type="checkbox"] { accent-color: var(--text); cursor: pointer; }

/* ── Shell ────────────────────────────────────────────────── */
.frame {
    position: fixed;
    inset: var(--frame-inset);
    border: 2px solid var(--hairline-md);
    pointer-events: none;
    z-index: 1000;
    /* Opaque halo hides content scrolling through the inset gap. */
    box-shadow: 0 0 0 100vmax var(--bg);
}

.site {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    padding: var(--frame-inset);
    overflow-x: clip;
    display: flex;
    flex-direction: column;
}

/* ── Masthead: name above everything ──────────────────────── */
.masthead {
    padding: clamp(24px, 5vw, 48px) var(--page-x) 0;
}

.masthead h1 {
    font-size: clamp(26px, 3vw, 34px);
    font-weight: 400;
    margin: 0;
    letter-spacing: 0;
    line-height: 1.2;
    white-space: nowrap;
}

.masthead-name {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

/* ── Persistent layout: nav + content below the masthead ──── */
.layout {
    display: flex;
    align-items: stretch;
    gap: clamp(40px, 6vw, 96px);
    flex: 1;
    padding: clamp(40px, 8vh, 72px) var(--page-x) clamp(40px, 6vh, 64px);
}

.side {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--frame-inset) + 24px);
    align-self: flex-start;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.home-intro {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    max-width: 220px;
    margin: auto 0 0 auto;
    text-wrap: pretty;
}

/* ── Nav items ────────────────────────────────────────────── */
.nav-item {
    background: none;
    border: none;
    color: inherit;
    display: flex;
    align-items: center;
    min-height: 20px;
    cursor: pointer;
    padding: 0;
}

.nav-label {
    font-size: 13px;
    letter-spacing: 0.02em;
    color: var(--text);
}
.nav-item:hover .nav-label { text-decoration: underline; }

.nav-label.active::before { content: "> "; }

.nav-sub {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    margin: 2px 0 4px 18px;
}

.nav-sub .nav-label { font-size: 12px; color: var(--muted); }
.nav-sub .nav-item:hover .nav-label { color: var(--text); }

.page-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
}

.page-sub {
    font-size: 13px;
    color: var(--muted);
    margin: 0 0 40px;
}

/* ── Row lists (projects, contact) ────────────────────────── */
.row-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--hairline);
    border: 1px solid var(--hairline);
}

.row-item {
    background: var(--bg);
    padding: 24px;
}
.row-item.linked { cursor: pointer; }

.row-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.row-title { font-size: 16px; font-weight: 600; margin: 0; }

.row-tag {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.row-desc {
    font-size: 13.5px;
    line-height: 1.7;
    color: oklch(0.62 0 0);
    margin: 0;
}

.row-open { font-size: 12px; color: var(--text); margin: 10px 0 0; }

/* ── Contact ──────────────────────────────────────────────── */
.contact-list { max-width: 480px; margin-top: 32px; }

.contact-row {
    background: var(--bg);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.contact-kind {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin: 0 0 8px;
}

.contact-masked {
    color: var(--dark);
    font-size: 14px;
    letter-spacing: 0.1em;
    user-select: none;
    -webkit-user-select: none;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid var(--text);
    background: none;
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    min-width: 84px;
    text-decoration: none;
}

/* ── Tools page ───────────────────────────────────────────── */
.tools-sections {
    display: flex;
    flex-direction: column;
    gap: 64px;
}

.tool-section { scroll-margin-top: calc(var(--frame-inset) + 24px); }

.tool-heading {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 16px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Inputs ───────────────────────────────────────────────── */
.input-area {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--hairline);
    color: var(--text);
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 20px;
}
.input-area:focus { outline: none; border-color: var(--hairline-md); }

.split-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.split-inputs .input-area { margin-bottom: 0; }

.split-pane label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 6px;
}

/* ── Toolbar (JSON formatter options) ─────────────────────── */
.toolbar {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 13px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.indent-input {
    width: 52px;
    margin-left: 6px;
    padding: 4px 6px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    color: var(--text);
    font-size: 13px;
}

/* ── Stats grid ───────────────────────────────────────────── */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--hairline);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 130px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
    text-align: center;
}

/* ── Diff & formatter output ──────────────────────────────── */
.diff-block, .output-block {
    background: var(--surface);
    border: 1px solid var(--hairline);
    padding: 16px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre;
    margin: 0;
}
.output-block { line-height: 1.6; }

.diff-del {
    background: rgba(255, 255, 255, 0.06);
    color: oklch(0.5 0 0);
    text-decoration: line-through;
}
.diff-ins {
    background: rgba(255, 255, 255, 0.16);
    color: var(--text);
    font-weight: 600;
}
.diff-eq { color: var(--muted); }
.diff-prefix { user-select: none; }

.diff-placeholder {
    color: var(--muted);
    padding: 2rem;
    text-align: center;
    border: 1px dashed var(--hairline);
    font-size: 13px;
}

.diff-identical { color: var(--text); }

.error {
    color: var(--text);
    padding: 0.75rem 1rem;
    background: oklch(0.14 0 0);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 13px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 700px) {
    .layout { flex-direction: column; gap: 40px; padding-top: 32px; }
    .side { width: auto; position: static; }
    .home-intro { margin: 24px 0 0; }
    .split-inputs { grid-template-columns: 1fr; }
}
