/* ═══════════════════════════════════════════════════
   VK2JNA Outback Expedition Tracker
   Theme: cluttered HAM radio desk, handwritten notes
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;700&family=Special+Elite&display=swap');

:root {
    --paper:        #f5e6c0;
    --paper-mid:    #edda9e;
    --paper-dark:   #d4b878;
    --desk:         #1e1008;
    --desk-mid:     #2c1810;
    --ink:          #1a0e08;
    --ink-mid:      #3a2318;
    --ink-light:    #6b4e37;
    --amber:        #c47d0a;
    --amber-light:  #e8a030;
    --rust:         #c04020;
    --olive:        #4a6741;
    --tape:         #e8d378;
    --tape-border:  #c4b040;
    --ruled-line:   rgba(160, 120, 70, 0.28);
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Caveat', cursive;
    color: var(--ink);
}

/* ── Desk surface ─────────────────────────────────── */

.desk-surface {
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background-color: var(--desk);
    /* subtle wood-grain lines */
    background-image:
        repeating-linear-gradient(
            93deg,
            transparent,
            transparent 80px,
            rgba(255, 255, 255, 0.012) 80px,
            rgba(255, 255, 255, 0.012) 82px
        ),
        repeating-linear-gradient(
            180deg,
            transparent,
            transparent 60px,
            rgba(0, 0, 0, 0.04) 60px,
            rgba(0, 0, 0, 0.04) 61px
        );
    display: flex;
    align-items: stretch;
    padding: 14px;
    gap: 14px;
}

/* ── Overall layout ───────────────────────────────── */

.radio-desk {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 14px;
}

/* ── Logbook panel ────────────────────────────────── */

.logbook-panel {
    position: relative;
    flex-shrink: 0;
    width: 290px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;

    background-color: var(--paper);
    /* lined paper ruled lines */
    background-image: repeating-linear-gradient(
        transparent,
        transparent calc(2.2rem - 1px),
        var(--ruled-line) calc(2.2rem - 1px),
        var(--ruled-line) 2.2rem
    );
    background-size: 100% 2.2rem;
    background-position: 0 3.5rem;

    border-radius: 1px;
    transform: rotate(-0.6deg);
    transform-origin: top center;

    box-shadow:
        4px 4px 14px rgba(0, 0, 0, 0.65),
        -1px -1px 4px rgba(0, 0, 0, 0.25),
        inset 40px 0 0 rgba(200, 150, 100, 0.12);   /* margin line tint */

    padding: 1.6rem 1.2rem 1.4rem 1.4rem;
}

/* red margin line */
.logbook-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 36px;
    width: 1.5px;
    height: 100%;
    background: rgba(180, 60, 40, 0.2);
    pointer-events: none;
}

/* coffee ring stain */
.coffee-ring {
    position: absolute;
    bottom: 28px;
    right: 18px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 11px solid rgba(110, 65, 30, 0.09);
    pointer-events: none;
}

/* ── Tape decoration ──────────────────────────────── */

.tape {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%) rotate(-1.5deg);
    width: 68px;
    height: 20px;
    background: rgba(232, 211, 120, 0.78);
    border-top: 1px solid var(--tape-border);
    border-bottom: 1px solid var(--tape-border);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* ── Station header ───────────────────────────────── */

.station-header {
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.2rem;
}

.callsign {
    font-family: 'Special Elite', monospace;
    font-size: 2.6rem;
    line-height: 1.05;
    color: var(--ink);
    letter-spacing: 0.08em;
    text-shadow: 1px 2px 0 rgba(0, 0, 0, 0.12);
}

.expedition-title {
    font-family: 'Caveat', cursive;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--ink-mid);
    margin-top: 0.1rem;
    letter-spacing: 0.02em;
}

.expedition-year {
    font-family: 'Caveat', cursive;
    font-size: 0.95rem;
    color: var(--ink-light);
    opacity: 0.8;
    margin-top: 0.1rem;
}

/* ── Dividers ─────────────────────────────────────── */

.ruled-divider {
    border: none;
    border-top: 1.5px dashed var(--paper-dark);
    margin: 0.85rem 0;
    opacity: 0.7;
}

/* ── Field labels ─────────────────────────────────── */

.field-label {
    font-family: 'Caveat', cursive;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--amber);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

/* ── QTH / coordinates block ─────────────────────── */

.qth-block {
    margin-bottom: 0.4rem;
}

.coord-line {
    font-family: 'Courier New', monospace;
    font-size: 1.35rem;
    font-weight: bold;
    color: var(--ink);
    line-height: 1.4;
    letter-spacing: 0.04em;
}

.heard-time {
    font-family: 'Caveat', cursive;
    font-size: 0.95rem;
    color: var(--ink-light);
    font-style: italic;
    margin-top: 0.3rem;
}

/* ── Status / awaiting signal ─────────────────────── */

.signal-block {
    margin-bottom: 0.4rem;
}

.signal-waiting {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    color: var(--ink-light);
    font-style: italic;
}

/* ── Route stops ──────────────────────────────────── */

.route-section {
    margin-top: 0.2rem;
}

.route-stops {
    position: relative;
    padding-left: 0.85rem;
    border-left: 1.5px dashed var(--paper-dark);
    margin-left: 0.3rem;
    margin-top: 0.4rem;
}

.stop-item {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    padding: 0.22rem 0;
    font-family: 'Caveat', cursive;
    font-size: 0.95rem;
    line-height: 1.25;
}

/* Circle on the route line */
.stop-item::before {
    content: '';
    position: absolute;
    left: calc(-0.85rem - 0.3rem);  /* centre on the border */
    top: 50%;
    transform: translateY(-50%);
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    border: 1.5px solid var(--ink-mid);
    background: var(--paper);
    box-sizing: border-box;
    z-index: 1;
}

.stop-item.visited::before {
    background: var(--olive);
    border-color: var(--olive);
}

.stop-name {
    color: var(--ink-mid);
    flex: 1;
}

.stop-item.visited .stop-name {
    color: var(--ink-light);
    text-decoration: line-through;
    text-decoration-color: rgba(74, 103, 65, 0.6);
    opacity: 0.72;
}

.stop-note {
    font-size: 0.8rem;
    color: var(--ink-light);
    font-style: italic;
    white-space: nowrap;
    opacity: 0.8;
}

.stop-tick {
    font-size: 0.82rem;
    color: var(--olive);
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Log entries ──────────────────────────────────── */

.log-section {
    margin-top: 0.2rem;
}

.log-entries {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 0.3rem;
    max-height: 46vh;
    overflow-y: auto;
    padding-right: 2px;
}

.log-entries::-webkit-scrollbar {
    width: 3px;
}

.log-entries::-webkit-scrollbar-track {
    background: var(--paper-mid);
}

.log-entries::-webkit-scrollbar-thumb {
    background: var(--paper-dark);
    border-radius: 2px;
}

.log-row {
    display: grid;
    grid-template-columns: 2.8rem 2.6rem 1fr;
    gap: 0.3rem;
    padding: 0.18rem 0;
    border-bottom: 1px dotted rgba(160, 120, 70, 0.22);
    align-items: baseline;
    font-size: 0.92rem;
}

.log-time {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    color: var(--amber);
    font-weight: bold;
}

.log-date {
    font-family: 'Caveat', cursive;
    font-size: 0.85rem;
    color: var(--ink-light);
}

.log-pos {
    font-family: 'Caveat', cursive;
    font-size: 0.9rem;
    color: var(--ink-mid);
}

.log-empty {
    font-style: italic;
    color: var(--ink-light);
    font-size: 0.95rem;
    margin-top: 0.3rem;
}

/* ── Logbook footer ───────────────────────────────── */

.logbook-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.2rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--paper-dark);
    font-family: 'Caveat', cursive;
    font-size: 0.8rem;
    color: var(--ink-light);
    opacity: 0.65;
}

/* ── Map panel ────────────────────────────────────── */

.map-panel {
    position: relative;
    flex: 1;
    height: 100%;
    border-radius: 1px;
    overflow: hidden;
    box-shadow:
        3px 3px 14px rgba(0, 0, 0, 0.7),
        -1px -1px 4px rgba(0, 0, 0, 0.3);
}

.map-label-tape {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) rotate(0.4deg);
    background: rgba(232, 211, 120, 0.88);
    border-top: 1px solid var(--tape-border);
    border-bottom: 1px solid var(--tape-border);
    padding: 0.15rem 2rem;
    font-family: 'Caveat', cursive;
    font-size: 1.05rem;
    color: var(--ink-mid);
    z-index: 800;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

#leaflet-map {
    width: 100%;
    height: 100%;
}

/* ── Leaflet overrides ────────────────────────────── */

.leaflet-control-attribution {
    font-family: 'Caveat', cursive;
    font-size: 0.75rem;
    background: rgba(245, 230, 192, 0.85) !important;
    color: var(--ink-light) !important;
}

.leaflet-control-attribution a {
    color: var(--amber) !important;
}

.leaflet-popup-content-wrapper {
    font-family: 'Caveat', cursive;
    font-size: 1rem;
    background: var(--paper);
    border: 1px solid var(--paper-dark);
    border-radius: 2px;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.3);
}

.leaflet-popup-tip {
    background: var(--paper);
}

/* ── Blazor error boundary ────────────────────────── */

.blazor-error-boundary {
    background: #3d1a00;
    padding: 1rem 1.5rem;
    color: var(--paper);
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
}

/* ── Validation (Blazor defaults, kept minimal) ───── */

.valid.modified:not([type=checkbox]) { outline: 1px solid #4a6741; }
.invalid { outline: 1px solid var(--rust); }
.validation-message { color: var(--rust); font-family: 'Caveat', cursive; }