/* PulseCore Variable Details (restyled 2026-11-11 to match the site: home.css's
   tokens, flat cards, cyan accents, sentence-case labels). Every class the
   page and details.js use is kept. */

:root {
    --bg:        #0a0b0d;
    --bg-raise:  #111318;
    --bg-card:   #14161c;
    --line:      #23262e;
    --text:      #e8eaef;
    --text-dim:  #9aa1ad;
    --text-mute: #6b7280;
    --phase-0:   #ff3366;
    --phase-mid: #b05cc4;
    --phase-1:   #35e8e0;
    --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "PC Glyphs", monospace;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, "PC Glyphs", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    overflow-x: clip;
    min-height: 100vh;
}

/* Page */
.details-container { max-width: 1120px; margin: 0 auto; padding: 28px 16px 64px; }

.details-header { padding: 0 0 18px; }
.header-content { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.details-header h1 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); font-weight: 700; line-height: 1.15; color: var(--text); }
.details-header h1::before {
    content: "Calculator · Variable";
    display: block; margin-bottom: 6px;
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--phase-1);
}
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-back, .btn-edit, .btn-export, .btn-save, .btn-cancel {
    padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line);
    background: transparent; color: var(--text-dim);
    font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn-back:hover, .btn-edit:hover, .btn-export:hover, .btn-cancel:hover { color: var(--text); border-color: var(--phase-1); }
.btn-export, .btn-edit { color: var(--phase-1); border-color: rgba(53, 232, 224, 0.45); }
.btn-save { background: var(--phase-1); border-color: var(--phase-1); color: var(--bg); font-weight: 600; }
.btn-save:hover { filter: brightness(1.08); }
.btn-cancel:hover { color: var(--phase-0); border-color: var(--phase-0); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(53, 232, 224, 0.35); }

.details-content { padding: 0; }

/* Primary card */
.primary-card {
    display: flex; align-items: center; gap: 24px;
    background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px;
    padding: 22px 24px; margin-bottom: 16px;
}
.symbol-display {
    flex: none; min-width: 96px; height: 96px; padding: 0 14px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-raise); border: 1px solid rgba(53, 232, 224, 0.35); border-radius: 14px;
}
.symbol-text { font-size: 2.6rem; line-height: 1; color: var(--phase-1); font-family: "PC Glyphs", -apple-system, sans-serif; }
.primary-info { flex: 1; min-width: 0; }
.variable-name { font-size: 1.7rem; font-weight: 700; line-height: 1.2; color: var(--text); }
.variable-long-form { margin-top: 2px; color: var(--text-dim); font-size: 0.95rem; }
.value-section { display: flex; flex-wrap: wrap; gap: 10px 32px; margin-top: 14px; }
.value-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.value-label { font-size: 0.8rem; color: var(--text-mute); }
.value-content { font-family: var(--mono); font-size: 1.05rem; color: var(--phase-1); overflow-wrap: anywhere; }
.primary-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }

.badge, .badge-like {
    display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line);
    font-size: 0.78rem; font-weight: 500; color: var(--text-dim); white-space: nowrap; text-transform: none; letter-spacing: 0;
}
.badge-quality     { color: #d39be0; border-color: rgba(176, 92, 196, 0.55); }
.badge-category    { color: var(--phase-1); border-color: rgba(53, 232, 224, 0.45); }
.badge-complexity  { color: #ff7d9b; border-color: rgba(255, 51, 102, 0.5); }
.badge-fundamental { color: #e8c85a; border-color: rgba(232, 200, 90, 0.5); }

/* Card grids */
.text-content-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }
.details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }

.detail-card, .text-card {
    background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px;
    transition: border-color 0.15s ease;
}
.detail-card:hover, .text-card:hover { border-color: rgba(53, 232, 224, 0.3); }
.detail-card h3, .text-card h3 {
    font-size: 1rem; font-weight: 600; color: var(--text-dim);
    margin-bottom: 12px; padding: 0; border: 0; background: none; -webkit-text-fill-color: currentColor;
}
.text-content { color: var(--text); font-size: 0.95rem; overflow-wrap: anywhere; }

/* Property rows */
.property-list { display: flex; flex-direction: column; }
.property-item {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 9px 0; border-bottom: 1px solid var(--line);
}
.property-item:last-child { border-bottom: 0; }
.property-label { font-size: 0.88rem; color: var(--text-mute); min-width: 120px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.property-value { color: var(--text); text-align: right; overflow-wrap: anywhere; font-weight: 400; }
.code-style { font-family: var(--mono); color: var(--phase-1); font-size: 0.92rem; }
.code-block {
    font-family: var(--mono); font-size: 0.88rem; color: var(--text-dim);
    background: var(--bg-raise); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
    white-space: pre-wrap; overflow-wrap: anywhere;
}

/* Usage statistics */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: var(--bg-raise); border: 1px solid var(--line); border-radius: 10px; padding: 14px 10px;
}
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--phase-1); font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-label { font-size: 0.82rem; color: var(--text-mute); text-transform: none; letter-spacing: 0; }

/* On/off options: a dot, cyan when on */
.checkbox-grid { display: flex; flex-direction: column; gap: 8px; }
.checkbox-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; background: var(--bg-raise); border: 1px solid var(--line); border-radius: 10px;
}
.checkbox-status {
    flex: none; width: 10px; height: 10px; border-radius: 50%;
    border: 1px solid var(--text-mute); font-size: 0; line-height: 0; overflow: hidden;
}
.checkbox-status[data-on="1"] { background: var(--phase-1); border-color: var(--phase-1); box-shadow: 0 0 8px rgba(53, 232, 224, 0.5); }
.checkbox-status:has(input) { width: auto; height: auto; border: 0; font-size: inherit; line-height: inherit; overflow: visible; }
.checkbox-label { font-size: 0.9rem; color: var(--text); }

/* Loading */
.loading-overlay {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    background: rgba(10, 11, 13, 0.92);
}
.loading-overlay.hidden { display: none; }
.loading-spinner { text-align: center; color: var(--text); }
.spinner {
    width: 44px; height: 44px; margin: 0 auto 14px;
    border: 3px solid rgba(53, 232, 224, 0.18); border-top-color: var(--phase-1); border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-spinner p { font-size: 1rem; color: var(--text-dim); }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.7); transition: opacity 0.2s ease;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-container {
    width: calc(100% - 32px); max-width: 500px; overflow: hidden;
    background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 1.15rem; font-weight: 600; color: var(--text); }
.modal-close {
    width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--line); color: var(--text-dim); font-size: 1rem;
}
.modal-close:hover { color: var(--phase-0); border-color: var(--phase-0); }
.modal-body { padding: 20px; }
.modal-body p { color: var(--text); line-height: 1.6; }

/* Edit mode */
.editable-field, .editable-select {
    width: 100%; padding: 8px 10px; border-radius: 8px;
    background: var(--bg-raise); border: 1px solid var(--line); color: var(--text);
    font: inherit; transition: border-color 0.15s ease;
}
.editable-field:focus, .editable-select:focus { outline: none; border-color: var(--phase-1); box-shadow: 0 0 0 3px rgba(53, 232, 224, 0.15); }
.editable-textarea { min-height: 100px; resize: vertical; }
.edit-mode .text-content, .edit-mode .property-value { transition: all 0.2s ease; }
.editable-field.editable-stat {
    display: block; width: 100%; max-width: 9ch; margin: 0 auto; text-align: center;
    font-size: 1.4rem; font-weight: 700; color: var(--phase-1); font-family: var(--mono);
    -moz-appearance: textfield;
}
.editable-field.editable-stat::-webkit-outer-spin-button,
.editable-field.editable-stat::-webkit-inner-spin-button { margin: 0; }

/* Function editor */
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-header h3 { margin: 0; }
.btn-function-edit, .btn-add-arg, .btn-clear-args, .btn-remove-row {
    padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
    background: transparent; color: var(--text-dim); font: inherit; font-size: 0.85rem; cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.btn-function-edit, .btn-add-arg { color: var(--phase-1); border-color: rgba(53, 232, 224, 0.45); }
.btn-function-edit:hover, .btn-add-arg:hover { color: var(--text); border-color: var(--phase-1); }
.btn-clear-args, .btn-remove-row { color: #ff7d9b; border-color: rgba(255, 51, 102, 0.45); }
.btn-clear-args:hover, .btn-remove-row:hover { color: var(--text); border-color: var(--phase-0); }
.function-edit-panel { background: var(--bg-raise); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.function-editor { display: flex; flex-direction: column; gap: 16px; }
.function-editor h4 { font-size: 0.95rem; font-weight: 600; color: var(--text-dim); margin-bottom: 8px; }
.argument-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.argument-row { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px; }
.argument-row select {
    flex: 1; padding: 7px 10px; border-radius: 8px;
    background: var(--bg-raise); border: 1px solid var(--line); color: var(--text); font: inherit;
}
.argument-row select:focus { outline: none; border-color: var(--phase-1); }
.argument-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.hidden { display: none !important; }

/* Tablets and phones */
@media (max-width: 768px) {
    .primary-card { flex-direction: column; align-items: flex-start; gap: 16px; padding: 18px; }
    .primary-badges { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .text-content-section, .details-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .property-item { flex-direction: column; align-items: flex-start; gap: 2px; }
    .property-value { text-align: left; }
    .property-label { min-width: 0; }
    input, select, textarea { font-size: 16px; }
}
