/* =============================================================
   STARTPROBE — Midnight Study with Brand Mark
   Fraunces (serif): for thinking — questions, headlines
   Inter (sans):     for interface — buttons, labels, metadata
   JetBrains Mono:   for marginalia — depth tags, tiny labels
   ============================================================= */

:root {
    /* Midnight palette — warm charcoal, not cold black */
    --bg:           #1a1814;
    --bg-deep:      #131110;
    --bg-elevated:  #221f18;
    --bg-soft:      #2a2620;

    --text:         #f4ede0;
    --text-soft:    #d4cab2;
    --text-muted:   #a89b80;
    --text-faint:   #8a7d68;
    --text-ghost:   #6f6451;

    --line:         #3a3428;
    --line-soft:    #2a2520;
    --line-strong:  #4a4234;

    --amber:        #d4a556;
    --amber-warm:   #e0b46c;
    --amber-deep:   #a07c33;
    --amber-glow:   rgba(212, 165, 86, 0.18);

    --layer-0-bg:   #0e0c08;
    --layer-0-border: #2a2520;
    --layer-1-bg:   #221f18;
    --layer-1-border: #3a3428;
    --layer-2-bg:   #26221a;
    --layer-2-border: #443c2a;
    --layer-3-bg:   #2b2519;
    --layer-3-border: #524728;
    --layer-4-bg:   #312816;
    --layer-4-border: #5d4f24;
    --layer-5-bg:   #382c14;
    --layer-5-border: #6a591f;

    --serif:    'Fraunces', 'Iowan Old Style', Georgia, serif;
    --sans:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono:     'JetBrains Mono', 'SF Mono', Menlo, monospace;

    --radius:     6px;
    --radius-lg:  10px;
}

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

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--amber);
    color: var(--bg-deep);
}

/* Subtle warm radial — like a desk lamp pool of light */
.lamp-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 70% 50% at 50% 30%, rgba(212, 165, 86, 0.045) 0%, transparent 65%),
        radial-gradient(ellipse 90% 60% at 50% 100%, rgba(212, 165, 86, 0.025) 0%, transparent 70%);
}

/* =============================================================
   BRAND — wordmark + logo, used in masthead and tree header
   ============================================================= */

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--text);
    transition: opacity 0.15s ease;
}

.brand:hover {
    opacity: 0.85;
}

/* Logo mark: minimal calipers/probe instrument abstraction */
.brand-mark {
    flex-shrink: 0;
    color: var(--amber);
    width: 22px;
    height: 22px;
}

.brand-mark.large {
    width: 30px;
    height: 30px;
}

.brand-wordmark {
    font-family: var(--serif);
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--text);
}

.brand-wordmark.large {
    font-size: 1.6rem;
    font-variation-settings: 'opsz' 30;
}

.brand-wordmark.small {
    font-size: 1.05rem;
}

/* Highlight the "probe" half slightly via opacity, so the wordmark has rhythm */
.brand-wordmark .probe {
    color: var(--amber);
}

/* =============================================================
   HOME PAGE
   ============================================================= */

.home-body {
    min-height: 100vh;
    position: relative;
}

/* Top bar — small persistent brand presence on home */
.home-topbar {
    position: relative;
    z-index: 2;
    padding: 1.4rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.home-container {
    position: relative;
    z-index: 1;
    max-width: 660px;
    margin: 0 auto;
    padding: 3rem 1.75rem 2rem;
    min-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}

/* Masthead — the larger brand presence above the prompt */
.masthead {
    text-align: center;
    margin-bottom: 3.75rem;
}

.masthead .brand {
    margin-bottom: 0.85rem;
}

.masthead-tagline {
    font-family: var(--serif);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 2.75rem;
}

.hero-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(1.85rem, 4.2vw, 2.3rem);
    letter-spacing: -0.02em;
    line-height: 1.16;
    color: var(--text);
    margin-bottom: 0.85rem;
    font-variation-settings: 'opsz' 90, 'SOFT' 50;
}

.hero-subtitle {
    font-family: var(--serif);
    font-style: italic;
    color: var(--text-muted);
    font-size: 1.02rem;
    max-width: 460px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Form */
.decision-form {
    background: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.5rem 1.1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.decision-form:focus-within {
    border-color: var(--amber-deep);
    box-shadow:
        0 0 0 3px rgba(212, 165, 86, 0.12),
        0 0 24px -4px var(--amber-glow);
}

#decision-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--serif);
    font-size: 1.1rem;
    color: var(--text);
    line-height: 1.55;
    resize: vertical;
    min-height: 110px;
    caret-color: var(--amber);
}

#decision-input::placeholder {
    color: var(--text-ghost);
    font-style: italic;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--line-soft);
}

.char-count {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--text-ghost);
    letter-spacing: 0.04em;
}

#submit-btn {
    background: var(--amber);
    color: var(--bg-deep);
    border: none;
    padding: 0.65rem 1.2rem 0.65rem 1.4rem;
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.2s ease;
}

#submit-btn:hover:not(:disabled) {
    background: var(--amber-warm);
    box-shadow: 0 0 18px var(--amber-glow);
}

#submit-btn:active:not(:disabled) {
    transform: scale(0.98);
}

#submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-arrow {
    font-family: var(--serif);
    font-size: 1.05rem;
    transition: transform 0.2s ease;
}

#submit-btn:hover:not(:disabled) .btn-arrow {
    transform: translateX(3px);
}

/* Loading */
.loading {
    margin-top: 3.5rem;
    text-align: center;
}

.loading-mark {
    display: inline-flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.loading-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--amber);
    animation: pulse-dot 1.4s ease-in-out infinite;
    box-shadow: 0 0 8px var(--amber-glow);
}

.loading-dot:nth-child(2) { animation-delay: 0.18s; }
.loading-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes pulse-dot {
    0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
    40% { opacity: 1; transform: scale(1); }
}

#loading-message {
    font-family: var(--serif);
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.98rem;
    transition: opacity 0.3s ease;
}

/* Error */
.error {
    margin-top: 2rem;
    padding: 1.1rem 1.3rem;
    background: rgba(180, 70, 50, 0.08);
    border: 1px solid rgba(180, 70, 50, 0.4);
    border-left: 3px solid #c25538;
    border-radius: var(--radius);
    text-align: center;
}

#error-message {
    color: #e8a796;
    margin-bottom: 0.85rem;
    font-size: 0.95rem;
}

.ghost-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--line-strong);
    padding: 0.45rem 1rem;
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ghost-btn:hover {
    border-color: var(--text-muted);
    color: var(--text);
    background: var(--bg-elevated);
}

/* Footer */
.footer {
    margin-top: auto;
    padding-top: 4rem;
    text-align: center;
}

.footer-text {
    font-family: var(--serif);
    font-style: italic;
    color: var(--text-faint);
    font-size: 0.85rem;
    letter-spacing: 0.01em;
}

.hidden { display: none !important; }

@media (max-width: 540px) {
    .home-topbar { padding: 1rem 1.25rem; }
    .masthead { margin-bottom: 2.75rem; }
    .brand-wordmark.large { font-size: 1.4rem; }
}
