/* Set a Course (compass.js): the compass rose on the dashboard's home page, as on the front
   page of 1stroyalmarines.com. Chart on the left, the chosen page on the right; stacked on
   narrow screens. */

.course-layout {
    display: grid;
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    gap: 22px;
    align-items: center;
}

@media (max-width: 720px) {
    .course-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

.course-svg {
    display: block;
    width: 100%;
    max-width: 360px;
    height: auto;
    margin: 0 auto;
    cursor: crosshair;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.course-svg:focus { outline: none; }
.course-svg:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; border-radius: 50%; }

.course-face { fill: rgba(22, 39, 68, 0.7); }
.course-ring { fill: none; stroke: var(--gold); stroke-width: 1; stroke-opacity: 0.55; }
.course-ring.inner { stroke-opacity: 0.25; }
.course-svg .rhumb { stroke: var(--gold); stroke-width: 0.6; stroke-opacity: 0.08; }
.course-svg .rhumb.main { stroke-opacity: 0.16; }
.course-svg .tick { stroke: var(--gold); stroke-width: 0.8; stroke-opacity: 0.35; }
.course-svg .tick.major { stroke-width: 1.3; stroke-opacity: 0.75; }

.course-rose polygon { stroke: var(--gold); stroke-width: 0.6; stroke-linejoin: round; }
.course-rose .rose-light { fill: var(--gold); }
.course-rose .rose-dark { fill: var(--navy-700); }
.course-rose .quarter { stroke-opacity: 0.45; fill-opacity: 0.45; }
.course-rose .by { stroke-opacity: 0.65; fill-opacity: 0.7; }

.course-line { stroke: var(--gold); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 0.1 5; }
.course-ship { opacity: 0; transition: opacity 0.25s ease; }
.course-ship.sailing { opacity: 1; }
.course-ship .hull { fill: var(--cream); }
.course-ship .sails { fill: var(--white); }

.course-port { cursor: pointer; }
.course-port .hit { fill: transparent; }
.course-port .mark { fill: var(--navy-800); stroke: var(--gold); stroke-width: 1.5; transition: fill 0.2s ease; }
.course-port.selected .mark { fill: var(--gold); }
.course-port .halo { fill: none; stroke: var(--gold); stroke-width: 1; opacity: 0; transform-box: fill-box; transform-origin: center; }
.course-port.arrived .halo { animation: coursePortHalo 0.9s ease-out; }
.port-label {
    font-family: var(--sans); font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
    text-anchor: middle; fill: var(--faint); transition: fill 0.2s ease;
}
.course-port.selected .port-label { fill: var(--gold); }

.course-needle { transform-box: view-box; transform-origin: 200px 200px; transition: transform 0.9s cubic-bezier(0.34, 1.45, 0.5, 1); }
.course-needle .needle-n { fill: var(--white); stroke: var(--navy-800); stroke-width: 0.8; }
.course-needle .needle-s { fill: var(--navy-800); stroke: var(--white); stroke-width: 1; }
.course-needle .needle-pin { fill: var(--gold); stroke: var(--navy-800); stroke-width: 1.2; }

.course-details { min-width: 0; text-align: center; }
.course-card { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) 2.25rem; align-items: center; gap: 8px; }
.course-text { min-width: 0; }
.course-bearing {
    margin: 0; font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--gold-dim); font-variant-numeric: tabular-nums;
}
.course-name { margin: 6px 0 4px; font-family: var(--serif); font-size: 24px; color: var(--white); text-wrap: balance; }
.course-desc { margin: 0; font-size: 14px; color: var(--muted); }
.course-step {
    width: 2.25rem; height: 2.25rem; border-radius: 50%;
    border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--gold);
    font-size: 20px; line-height: 1; cursor: pointer; transition: border-color 0.2s ease, background 0.2s ease;
}
.course-go {
    display: block; width: fit-content; margin: 18px auto 0; padding: 9px 26px;
    border: 1px solid var(--line-strong); border-radius: 999px;
    color: var(--gold); font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.course-step:hover, .course-go:hover { background: rgba(201, 168, 76, 0.1); border-color: var(--gold); }
.course-step:focus-visible, .course-go:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }
.course-hint { margin: 10px 0 0; font-size: 12px; color: var(--faint); }

/* Bigger step buttons for fingers. */
@media (pointer: coarse) {
    .course-card { grid-template-columns: 2.75rem minmax(0, 1fr) 2.75rem; }
    .course-step { width: 2.75rem; height: 2.75rem; }
}

@keyframes coursePortHalo {
    from { opacity: 0.8; transform: scale(1); }
    to { opacity: 0; transform: scale(2.8); }
}

@media (prefers-reduced-motion: reduce) {
    .course-needle { transition: none; }
    .course-port.arrived .halo { animation: none; }
}
