/* Homepage dashboard (/)
   Moved out of templates/index.html (issue #56). Loaded after barwatch.css from
   {% block extra_css %}; the sections keep their original order. */
/* Header */
.header {
    position: relative;
    padding: 2rem 2rem 3rem;
    background: linear-gradient(180deg, var(--ocean-dark) 0%, var(--ocean-abyss) 100%);
    border-bottom: 1px solid var(--card-border);
    overflow: visible;
    z-index: 100;
}

.header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 60'%3E%3Cpath fill='%233b9ece' fill-opacity='0.08' d='M0,30 C240,60 480,0 720,30 C960,60 1200,0 1440,30 L1440,60 L0,60 Z'%3E%3Canimate attributeName='d' dur='20s' repeatCount='indefinite' values='M0,30 C240,60 480,0 720,30 C960,60 1200,0 1440,30 L1440,60 L0,60 Z;M0,30 C240,0 480,60 720,30 C960,0 1200,60 1440,30 L1440,60 L0,60 Z;M0,30 C240,60 480,0 720,30 C960,60 1200,0 1440,30 L1440,60 L0,60 Z'/%3E%3C/path%3E%3C/svg%3E") no-repeat bottom center;
    background-size: cover;
    z-index: -1;
    pointer-events: none;
}

/* Secondary wave for depth/parallax effect */
.header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 80'%3E%3Cpath fill='%233b9ece' fill-opacity='0.04' d='M0,50 C180,20 360,70 540,40 C720,10 900,60 1080,35 C1260,10 1350,50 1440,40 L1440,80 L0,80 Z'%3E%3Canimate attributeName='d' dur='28s' repeatCount='indefinite' values='M0,50 C180,20 360,70 540,40 C720,10 900,60 1080,35 C1260,10 1350,50 1440,40 L1440,80 L0,80 Z;M0,35 C180,60 360,20 540,50 C720,70 900,25 1080,55 C1260,70 1350,30 1440,50 L1440,80 L0,80 Z;M0,50 C180,20 360,70 540,40 C720,10 900,60 1080,35 C1260,10 1350,50 1440,40 L1440,80 L0,80 Z'/%3E%3C/path%3E%3C/svg%3E") no-repeat bottom center;
    background-size: cover;
    z-index: -2;
    pointer-events: none;
}

.header-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Large Logo Mode */
.logo-icon.large-mode {
    width: auto;
    height: auto;
}
.header-title.large-logo-mode {
    justify-content: flex-start;
}
/* Make header background solid to match footer contrast */
.header {
    background: linear-gradient(180deg, var(--ocean-dark) 0%, var(--ocean-abyss) 100%);
}

/* Filter Badge */
.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(59, 158, 206, 0.15);
    border: 1px solid rgba(59, 158, 206, 0.3);
    border-radius: 20px;
    font-size: 0.8125rem;
    color: var(--ocean-glow);
    margin-bottom: 1rem;
}

.filter-badge a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: background-color 0.2s;
}

.filter-badge a:hover { background: rgba(255, 255, 255, 0.2); }

/* Region Filter Chips */
.region-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 26px 0 1rem;
}

.region-filters-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-right: 0.25rem;
}

.region-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-chip);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: translate 0.14s ease, border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
    translate: 0px;  /* keeps the stacking context the same on hover (#168) */
}

.region-chip:hover {
    border-color: var(--card-border-hover);
    color: var(--ocean-glow);
}
@media (prefers-reduced-motion: no-preference) { .region-chip:hover { translate: 0 -2px; } }

.region-chip.active {
    background: var(--ocean-glow);
    border-color: var(--ocean-glow);
    color: var(--ocean-abyss);
}

.region-chip-count {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    opacity: 0.7;
}
.region-chip.active .region-chip-count { opacity: 0.85; }

@media (max-width: 480px) {
    .region-filters { gap: 0.375rem; }
    .region-chip { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
    .region-chip-count { font-size: var(--text-xs); }
}

/* Popular Bars Widget */
.popular-bars {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
}

.popular-bars-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--status-restricted);
    margin-bottom: 1rem;
    cursor: pointer;
    user-select: none;
}

.popular-bars-header:hover { opacity: 0.8; }
.popular-bars-header svg:first-child { width: 18px; height: 18px; }
.popular-bars-header .collapse-chevron {
    width: 16px; height: 16px;
    margin-left: auto;
    transition: transform 0.2s ease;
    color: var(--text-muted);
}
.popular-bars.collapsed .popular-bars-header .collapse-chevron { transform: rotate(-90deg); }
.popular-bars.collapsed .popular-bars-grid { display: none; }
.popular-bars.collapsed { padding-bottom: 1rem; }
.popular-bars.collapsed .popular-bars-header { margin-bottom: 0; }

.popular-bars-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.popular-bar-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--ocean-deep);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    text-decoration: none;
    border: 1px solid transparent;
}

.popular-bar-card:hover {
    background: rgba(59, 158, 206, 0.1);
    border-color: var(--card-border);
}

.popular-bar-status {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.popular-bar-status svg {
    width: 14px;
    height: 14px;
}

.popular-bar-status.open svg { color: var(--status-open); }
.popular-bar-status.restricted svg { color: var(--status-restricted); }
.popular-bar-status.closed svg { color: var(--status-closed); }
.popular-bar-status.unknown svg { color: var(--status-unknown); }

.popular-bar-name { flex: 1; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.popular-bar-badge {
    font-size: var(--text-xs);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    white-space: nowrap;
}

.popular-bar-badge.open { background: var(--status-open-bg); color: var(--status-open); }
.popular-bar-badge.restricted { background: var(--status-restricted-bg); color: var(--status-restricted); }
.popular-bar-badge.closed { background: var(--status-closed-bg); color: var(--status-closed); }
.popular-bar-badge.unknown { background: var(--status-unknown-bg); color: var(--status-unknown); }

/* Widgets Row - Side by side on desktop */
.widgets-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Recent Changes Widget */
.recent-changes {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
}

.recent-changes-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ocean-glow);
    margin-bottom: 1rem;
    cursor: pointer;
    user-select: none;
}

.recent-changes-header:hover { opacity: 0.8; }
.recent-changes-header svg:first-child { width: 18px; height: 18px; }
.recent-changes-header .collapse-chevron {
    width: 16px; height: 16px;
    margin-left: auto;
    transition: transform 0.2s ease;
    color: var(--text-muted);
}
.recent-changes.collapsed .recent-changes-header .collapse-chevron { transform: rotate(-90deg); }
.recent-changes.collapsed .changes-list,
.recent-changes.collapsed .no-changes { display: none; }
.recent-changes.collapsed { padding-bottom: 1rem; }
.recent-changes.collapsed .recent-changes-header { margin-bottom: 0; }

.changes-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.change-item {
    display: grid;
    grid-template-columns: 1fr auto 70px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--ocean-deep);
    border-radius: 8px;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.change-item:hover {
    background: rgba(59, 158, 206, 0.1);
    border-color: var(--card-border);
}

.change-bar-name { font-weight: 500; color: var(--text-primary); }
.change-bar-name a { color: var(--text-primary); text-decoration: none; }
.change-bar-name a:hover { color: var(--ocean-glow); }

.change-status { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-size: 0.75rem; }
.change-time { text-align: right; }
.change-arrow { color: var(--text-muted); flex-shrink: 0; }
.change-old { padding: 0.25rem 0.5rem; border-radius: 4px; background: rgba(160, 174, 192, 0.15); color: var(--text-secondary); width: 105px; text-align: center; white-space: nowrap; }
.change-new { padding: 0.25rem 0.5rem; border-radius: 4px; width: 105px; text-align: center; white-space: nowrap; }
.change-new.open { background: rgba(72, 187, 120, 0.15); color: var(--status-open); }
.change-new.restricted { background: rgba(236, 201, 75, 0.15); color: var(--status-restricted); }
.change-new.closed { background: rgba(245, 101, 101, 0.15); color: var(--status-closed); }

.change-time { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.no-changes { color: var(--text-muted); font-size: 0.8125rem; text-align: center; padding: 0.5rem; }

/* Main Content */
.main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 44px 44px;
}

/* ===== NewTheme Homepage Hero ===== */
.home-hero { padding: 40px 0 6px; }
.home-hero-eyebrow {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.home-hero-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    margin: 12px 0 0;
    color: var(--text-primary);
}
.home-hero-tagline {
    margin: 6px 0 0;
    font-size: var(--text-base);
    color: var(--text-secondary);
}
/* Find your bar or port: on the first phone screen, above the list */
.home-find { margin-top: 16px; max-width: 520px; }
.home-find-label { display: block; margin-bottom: 6px; font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.home-find-field { position: relative; }
.home-find .home-find-input,
.home-find .home-find-input:focus { width: 100%; min-height: 44px; border-radius: var(--radius-md); font-size: 1rem; }
.home-find .home-find-results { left: 0; right: 0; width: auto; }
.home-find-hint { margin: 6px 0 0; font-size: var(--text-xs); color: var(--text-muted); }
.home-hero-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 22px;
    margin-top: 20px;
    font-family: var(--font-mono);
    font-size: 0.84375rem;
    color: var(--text-muted);
}
.home-hero-summary strong { color: var(--text-primary); font-family: var(--font-display); font-weight: 800; }
.hero-stat { display: inline-flex; align-items: center; gap: 8px; }
.hero-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--status-unknown); }
.hero-dot.open { background: var(--status-open); }
.hero-dot.restricted { background: var(--status-restricted); }
.hero-dot.closed { background: var(--status-closed); }
.hero-dot.unknown { background: var(--status-unknown); }
.hero-recent { opacity: 0.7; }

/* Status is not shown by colour alone: open = circle, restricted = triangle,
   closed = square, unavailable = ring */
.hero-dot.restricted { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); width: 10px; height: 10px; }
.hero-dot.closed { border-radius: 1px; }
.hero-dot.unknown { background: transparent; box-shadow: inset 0 0 0 2px var(--status-unknown); }

/* ===== Bottom disclaimer strip ===== */
.home-disclaimer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 30px;
    padding: 16px 20px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
}
.home-disclaimer-label {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--status-restricted);
    flex-shrink: 0;
}
.home-disclaimer-text { font-family: var(--font-mono); font-size: 0.78125rem; color: var(--text-muted); }

/* Controls Bar */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.last-updated { font-size: 0.875rem; color: var(--text-muted); }
.last-updated time { color: var(--text-secondary); font-family: var(--font-mono); }

.scrape-result { font-size: 0.75rem; color: var(--text-muted); margin-left: 0.25rem; }
.scrape-result.success { color: var(--status-open); }
.scrape-result.error { color: var(--status-closed); }

/* Region Sections */
.region { margin-bottom: 3rem; }

.region-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--card-border);
}

.region-name { font-family: var(--font-display); font-size: 1rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }

.region-count {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Bar Cards Grid */
.bars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 1rem;
}

/* Bar Card — NewTheme simple single-view */
.bar-card {
    position: relative;
    display: flex;
    overflow: hidden;
    min-width: 0;
    text-decoration: none;
    color: var(--text-primary);
    transition: translate 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
    translate: 0px;  /* keeps the stacking context the same on hover (#168) */
}
.bar-card:hover {
    border-color: var(--card-border-hover);
    box-shadow: var(--shadow-card);
}
@media (prefers-reduced-motion: no-preference) { .bar-card:hover { translate: 0 -3px; } }

/* Status color rail */
.bar-card-rail { width: 4px; flex-shrink: 0; background: var(--status-unknown); }
.bar-card[data-status="open"] .bar-card-rail { background: var(--status-open); }
.bar-card[data-status="restricted"] .bar-card-rail { background: var(--status-restricted); }
.bar-card[data-status="closed"] .bar-card-rail { background: var(--status-closed); }
.bar-card[data-status="unknown"] .bar-card-rail { background: var(--status-unknown); }

.bar-card-body { flex: 1; min-width: 0; padding: 17px 19px; }

.bar-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.bar-card-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.3125rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    /* Names wrap instead of truncating ("Cape Disappoi…") */
    white-space: normal;
    text-wrap: balance;
    overflow-wrap: break-word;  /* wrap between words; split a word only if it cannot fit */
    line-height: 1.15;
    min-width: 0;
}

/* Status badge — solid knockout (dark), tinted (light) for AA contrast */
.bar-card-badge {
    flex-shrink: 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: var(--text-xs);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    color: var(--ocean-abyss);
    background: var(--status-unknown);
}
.bar-card-badge.open { background: var(--status-open); }
.bar-card-badge.restricted { background: var(--status-restricted); }
.bar-card-badge.closed { background: var(--status-closed); }
.bar-card-badge.unknown { background: var(--status-unknown); }

.bar-card-cond {
    font-family: var(--font-mono);
    font-size: 0.78125rem;
    color: var(--text-muted);
    margin-top: 9px;
    line-height: 1.4;
}
.bar-card-sep { opacity: 0.5; }
/* Stretched link: the name is the link, and it covers the whole card */
.bar-card-link { color: inherit; text-decoration: none; }
.bar-card-link::after { content: ""; position: absolute; inset: 0; }
.bar-card-link:focus-visible { outline: none !important; }
.bar-card:has(.bar-card-link:focus-visible) { outline: 2px solid var(--ocean-foam); outline-offset: 2px; }
/* The star is drawn small; its 44px tap area comes from the invisible
   overlay in barwatch.css, so it does not take width away from the name. */
.bar-card .bar-card-star { position: relative; z-index: 1; min-width: 0; min-height: 0; }
/* What the restriction is (vessel class and length), max two lines */
.bar-card-restriction {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 9px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bar-card-restriction:not(.is-none) + .bar-card-cond { margin-top: 4px; }
/* The limit itself ("all vessels", "40 ft & under") in the status colour, in both views */
.bar-card-restriction strong { font-weight: 600; color: var(--text-primary); }
.bar-card[data-status="restricted"] .bar-card-restriction strong { color: var(--status-restricted); }
.bar-card[data-status="closed"] .bar-card-restriction strong { color: var(--status-closed); }
.bar-card-restriction.is-none { font-weight: 400; color: var(--text-muted); }
.bar-list-head { display: none; }

/* Cards view: the restriction is its own labelled section under the name */
html:not([data-home-view="list"]) .bar-card-restriction {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--card-border);
}
html:not([data-home-view="list"]) .bar-card-restriction::before {
    content: "Restriction";
    display: block;
    margin-bottom: 3px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
html:not([data-home-view="list"]) .bar-card-restriction + .bar-card-cond { margin-top: 8px; }

.bar-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 15px;
}
.bar-card-age {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
}
/* A report 4-12 h old (#238): still shown, its age flagged */
.bar-card-age.is-aging { color: var(--status-restricted); }
.bar-card-details {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--ocean-glow);
    white-space: nowrap;
}
.bar-card-details svg { display: block; }

/* ===== Home harbor ===== */
/* Star toggle on each card */
.bar-card-top-left { display: flex; align-items: center; gap: 9px; flex: 1 1 0; min-width: 0; }
.bar-card-star {
    flex-shrink: 0;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 2px;
    line-height: 0;
    display: flex;
    color: var(--text-muted);
    border-radius: 6px;
    transition: color 0.14s ease, transform 0.14s ease;
}
.bar-card-star svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.bar-card-star:hover { color: var(--ocean-glow);}
@media (prefers-reduced-motion: no-preference) { .bar-card-star:hover { transform: scale(1.12); } }
.bar-card-star.is-home { color: var(--ocean-glow); }
.bar-card-star.is-home svg { fill: var(--ocean-glow); stroke: var(--ocean-glow); }

/* Welcome-back strip */
.home-harbor { margin: 0 0 4px; }
.harbor-empty {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 20px;
    background: var(--card-bg);
    border: 1px dashed var(--card-border);
    border-radius: var(--radius-card);
}
.harbor-empty-star { flex-shrink: 0; opacity: 0.85; line-height: 0; color: var(--text-muted); }
.harbor-empty-star svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.harbor-empty-title { font-family: var(--font-display); font-weight: 800; font-size: 0.9375rem; color: var(--text-primary); }
.harbor-empty-sub { font-family: var(--font-mono); font-size: 0.78125rem; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }

.harbor-card {
    display: flex;
    background: var(--card-bg);
    border: 1px solid var(--ocean-glow);
    border-radius: var(--radius-card);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}
.harbor-rail { width: 5px; flex-shrink: 0; background: var(--status-unknown); }
.harbor-rail.open { background: var(--status-open); }
.harbor-rail.restricted { background: var(--status-restricted); }
.harbor-rail.closed { background: var(--status-closed); }
.harbor-rail.unknown { background: var(--status-unknown); }
.harbor-body { flex: 1; min-width: 0; padding: 20px 26px; display: flex; align-items: center; gap: 26px; }
.harbor-main { flex: 1; min-width: 0; }
.harbor-eyebrow {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ocean-glow);
    display: flex;
    align-items: center;
    gap: 8px;
}
.harbor-eyebrow svg { width: 13px; height: 13px; fill: var(--ocean-glow); stroke: var(--ocean-glow); flex-shrink: 0; }
.harbor-name-row { display: flex; align-items: center; gap: 14px; margin-top: 9px; }
.harbor-name { font-family: var(--font-display); font-weight: 800; font-size: 1.875rem; letter-spacing: -0.01em; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.harbor-cond { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--text-muted); margin-top: 9px; }
/* My bars: since-you-last-checked line and links on the pinned bar */
.harbor-since { margin-top: 6px; font-size: var(--text-sm); color: var(--text-secondary); }
.harbor-links { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; font-size: var(--text-sm); }
.harbor-links a { font-weight: 600; padding: 4px 0; }
.harbor-card.has-photo .harbor-since, .harbor-card.has-photo .harbor-links a { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
.harbor-side { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; flex-shrink: 0; }
.harbor-age, .harbor-saved { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
.harbor-btns { display: flex; align-items: center; gap: 10px; }
.harbor-unpin {
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 9px 14px;
}
.harbor-unpin:hover { color: var(--text-primary); border-color: var(--card-border-hover); }
.harbor-report {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.875rem;
    color: var(--ocean-abyss);
    background: var(--ocean-glow);
    border-radius: 8px;
    padding: 10px 18px;
    white-space: nowrap;
}
.harbor-report svg { width: 7px; height: 11px; fill: none; stroke: var(--ocean-abyss); stroke-width: 1.8; }

/* The strip is filled by script after the first paint. The empty prompt is in the
   page already; with a pin saved (data-home-pinned, set in the page head) its
   space is reserved instead, so the page does not jump down when it is filled. */
html[data-home-pinned] .home-harbor:not(.is-ready) { min-height: 152px; }
html[data-home-pinned] .home-harbor:not(.is-ready) > * { visibility: hidden; }

@media (max-width: 640px) {
    html[data-home-pinned] .home-harbor:not(.is-ready) { min-height: 219px; }
    /* Keeps "Find your bar or port" on the first screen of a small phone, below a pinned harbor */
    .home-hero { padding-top: 16px; }
    .harbor-body { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px 18px; }
    .harbor-name { font-size: 1.4375rem; }
    .harbor-side { align-items: stretch; }
    .harbor-btns { justify-content: flex-start; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--ocean-mid);
    border-radius: 16px;
    border: 1px dashed var(--card-border);
}

.empty-state p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* Toast Container */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
}

.toast {
    background: linear-gradient(135deg, var(--ocean-mid), var(--ocean-dark));
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.toast-icon { width: 24px; height: 24px; flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; margin-bottom: 0.25rem; }
.toast-message { font-size: 0.875rem; color: var(--text-secondary); }
.toast-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.25rem; }
.toast-close:hover { color: var(--text-primary); }

.next-update { margin-left: 0.5rem; color: var(--text-muted); white-space: nowrap; }

/* Changelog Modal */
.changelog-entry { margin-bottom: 1.5rem; }
.changelog-entry:last-child { margin-bottom: 0; }
.changelog-version { font-family: var(--font-mono); font-size: 1rem; font-weight: 600; color: var(--ocean-glow); }
.changelog-date { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.changelog-entry ul { list-style: none; padding: 0; }
.changelog-entry li { font-size: 0.875rem; color: var(--text-secondary); padding: 0.25rem 0; padding-left: 1rem; position: relative; }
.changelog-entry li::before { content: '\2192'; position: absolute; left: 0; color: var(--ocean-glow); }

/* Tooltips */
[data-tooltip] { cursor: help; }

/* Desktop view link - hidden by default, shown on mobile */
.desktop-view-link, .desktop-link-sep { display: none; }

/* Responsive */
@media (max-width: 768px) {
    .header { padding: 1rem; }
    .header-content { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
    .header-title { gap: 0.75rem; flex: 1; }
    .logo-icon { width: 40px; height: 40px; }
    .logo-icon svg { width: 24px; height: 24px; }
    h1 { font-size: 1.25rem; }
    .header-subtitle { display: none; }
    .nav { display: none; }
    .bars-grid { grid-template-columns: 1fr; }
    .toast-container { left: 1rem; right: 1rem; max-width: none; }
    .widgets-row { grid-template-columns: 1fr; }
    .main { padding: 1rem; }
    .controls { flex-direction: column; gap: 0.75rem; }
    .change-item { grid-template-columns: 1fr auto; gap: 0.5rem; }
    .change-bar-name { grid-column: 1 / -1; }
    .change-status { justify-content: flex-start; }
    .change-old, .change-new { width: auto; }
    .change-time { font-size: var(--text-xs); }
    .desktop-view-link, .desktop-link-sep { display: inline; }
}

/* Inline Disclaimer */
.inline-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin: 1rem 0;
    padding: 0.5rem;
    /* Removed opacity: 0.8 for WCAG AA contrast compliance */
}
.inline-disclaimer strong {
    color: var(--status-restricted);
}

/* Crossing Recommendation Badge */
.crossing-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

.crossing-badge.favorable {
    background: rgba(72, 187, 120, 0.15);
    color: var(--status-open);
    border: 1px solid rgba(72, 187, 120, 0.3);
}

.crossing-badge.caution {
    background: rgba(236, 201, 75, 0.15);
    color: var(--status-restricted);
    border: 1px solid rgba(236, 201, 75, 0.3);
}

.crossing-badge.not_advised {
    background: rgba(245, 101, 101, 0.15);
    color: var(--status-closed);
    border: 1px solid rgba(245, 101, 101, 0.3);
}

/* Crossing badge in compact view */
.compact-crossing {
    font-size: var(--text-xs);
    padding: 0.125rem 0.375rem;
    margin-top: 0;
    margin-left: 0.5rem;
}

/* Crossing Recommendation section in expanded cards */
.crossing-recommendation {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--ocean-deep);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.crossing-recommendation .crossing-badge {
    margin-top: 0;
    font-size: var(--text-xs);
    padding: 0.375rem 0.625rem;
}

.crossing-recommendation .crossing-badge svg {
    flex-shrink: 0;
}

.crossing-detail {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.load-more-btn { margin-top: 1rem; }

/* ===== Bar photos, Cards / List layout (v2.85.0) ===== */
/* Each card carries its bar's aerial (or uploaded) photo. Cards view shows it
   as a banner; List view (html[data-home-view="list"]) restyles the same
   markup into compact rows with the photo as a thumbnail. */

/* Layout switch, at the end of the region chips */
.view-toggle {
    margin-left: auto;
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-chip);
}
.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.375rem 0.75rem;
    border: 0;
    border-radius: var(--radius-chip);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.8125rem;
    cursor: pointer;
}
.view-toggle-btn svg { width: 14px; height: 14px; fill: currentColor; }
.view-toggle-btn:hover { color: var(--text-primary); }
.view-toggle-btn[aria-pressed="true"] { background: var(--ocean-glow); color: var(--on-accent); }

/* Cards view: photo banner across the top, status colour beneath it */
.bar-card {
    display: grid;
    grid-template-columns: 4px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
}
.bar-card-photo {
    grid-column: 1 / -1;
    display: block;
    width: 100%;
    height: 112px;
    object-fit: cover;
    object-position: 60% 50%;
    background: var(--bg-raised);
    /* The inline placeholder (style attribute) is framed like the photo */
    background-size: cover;
    background-position: 60% 50%;
    border-bottom: 3px solid var(--status-unknown);
}
.bar-card-photo.is-empty { display: none; }
.bar-card[data-status="open"] .bar-card-photo { border-bottom-color: var(--status-open); }
.bar-card[data-status="restricted"] .bar-card-photo { border-bottom-color: var(--status-restricted); }
.bar-card[data-status="closed"] .bar-card-photo { border-bottom-color: var(--status-closed); }
.bar-card[data-status="unknown"] .bar-card-photo { filter: grayscale(0.85) brightness(0.75); }
.bar-card-rail { grid-row: 2; }
.bar-card-body { grid-row: 2; }

/* List view: one row per bar */
html[data-home-view="list"] .bars-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-card);
    overflow: hidden;
    background: var(--card-bg);
}
html[data-home-view="list"] .bar-card {
    grid-template-columns: 4px 104px minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
    border: 0;
    border-top: 1px solid var(--card-border);
    border-radius: 0;
    box-shadow: none;
}
html[data-home-view="list"] .bar-card:first-child { border-top: 0; }
html[data-home-view="list"] .bar-card:hover { translate: 0; background: var(--bg-raised); }
html[data-home-view="list"] .bar-card.is-home { box-shadow: inset 0 0 0 1px var(--ocean-glow); }
html[data-home-view="list"] .bar-card-rail { grid-row: 1; grid-column: 1; align-self: stretch; }
html[data-home-view="list"] .bar-card-photo {
    grid-row: 1;
    grid-column: 2;
    width: 88px;
    height: 50px;
    margin: 10px 0 10px 12px;
    border: 0;
    border-radius: var(--radius-md);
}
html[data-home-view="list"] .bar-card-photo.is-empty { display: block; }
html[data-home-view="list"] .bar-card-body {
    grid-row: 1;
    grid-column: 3;
    display: grid;
    /* Every column has a set width: each row is its own grid, so an auto badge
       column ("Open" vs "Unavailable") shifted the readings and age per row */
    grid-template-columns: minmax(0, 1fr) 9.5rem minmax(140px, 1fr) 180px;
    /* Status straight after the bar name, then the restriction, then the readings */
    grid-template-areas: "name badge cond age" "restr badge cond age";
    align-items: center;
    column-gap: 18px;
    padding: 10px 18px 10px 14px;
}
html[data-home-view="list"] .bar-card-top { display: contents; }
html[data-home-view="list"] .bar-card-top-left { grid-area: name; }
html[data-home-view="list"] .bar-card-body:not(:has(.bar-card-restriction:not(.is-none))) .bar-card-top-left { grid-row: 1 / 3; }
html[data-home-view="list"] .bar-card-name { font-size: 1rem; }
html[data-home-view="list"] .bar-card-badge { grid-area: badge; justify-self: start; }
/* Two lines, as on desktop: one line cut "Rec. & passenger: all vessels at tower" to "all…", and the
   cut-off part (all vessels, the passenger limit) is what matters */
html[data-home-view="list"] .bar-card-restriction { grid-area: restr; margin-top: 2px; font-size: 0.8125rem; font-weight: 500; -webkit-line-clamp: 2; line-clamp: 2; }
/* The limit itself in the status colour, so it reads down the list */
/* "No restrictions" / "Not reported" only fill the Restriction column on wide screens */
html[data-home-view="list"] .bar-card-restriction.is-none { display: none; }
html[data-home-view="list"] .bar-card-cond { grid-area: cond; margin-top: 0; }
/* Status and Report columns fit "No restrictions" and "Last report 23h 59m ago";
   anything longer is clipped in its own column instead of running into the next */
html[data-home-view="list"] .bar-card-foot { grid-area: age; margin-top: 0; white-space: nowrap; min-width: 0; overflow: hidden; }
html[data-home-view="list"] .bar-card-foot .staleness-badge { max-width: 100%; }
html[data-home-view="list"] .bar-card-foot .staleness-badge-text { overflow: hidden; text-overflow: ellipsis; }
html[data-home-view="list"] .bar-card-details { display: none; }

/* Wide screens: the restriction gets its own column, under column headings.
   From 1100px the coast map takes 320px beside the list (#418), so the list is
   this wide (1012px) from 1560px */
@media (min-width: 1560px) {
    html[data-home-view="list"] {
        --bar-list-cols: minmax(140px, 0.8fr) 9.5rem minmax(200px, 1.4fr) minmax(170px, 210px) 180px;
    }
    html[data-home-view="list"] .bar-list-head {
        display: grid;
        grid-template-columns: 4px 104px minmax(0, 1fr);
        border-bottom: 1px solid var(--card-border);
    }
    html[data-home-view="list"] .bar-list-head-cols {
        grid-column: 3;
        display: grid;
        grid-template-columns: var(--bar-list-cols);
        column-gap: 18px;
        padding: 9px 18px 9px 14px;
        font-family: var(--font-mono);
        font-size: var(--text-xs);
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-muted);
    }
    html[data-home-view="list"] .bar-list-head + .bar-card { border-top: 0; }
    html[data-home-view="list"] .bar-card-body {
        grid-template-columns: var(--bar-list-cols);
        grid-template-areas: "name badge restr cond age";
    }
    html[data-home-view="list"] .bar-card-body:not(:has(.bar-card-restriction:not(.is-none))) .bar-card-top-left { grid-row: auto; }
    html[data-home-view="list"] .bar-card-restriction { margin-top: 0; font-size: 0.875rem; -webkit-line-clamp: 2; line-clamp: 2; }
    html[data-home-view="list"] .bar-card-restriction.is-none { display: block; }
}

/* Narrow tablets: four columns left the name no width, so the report age goes
   under the readings in the same column */
/* Also 1100-1219px: the coast map (#418) leaves the list as narrow as it is here */
@media (min-width: 641px) and (max-width: 900px), (min-width: 1100px) and (max-width: 1219px) {
    html[data-home-view="list"] .bar-card-body {
        grid-template-columns: minmax(0, 1fr) 9.5rem minmax(0, 1fr);
        grid-template-areas: "name badge cond" "restr badge age";
        row-gap: 4px;
    }
    html[data-home-view="list"] .bar-card-body:not(:has(.bar-card-restriction:not(.is-none))) .bar-card-top-left { grid-row: 1 / 3; }
    html[data-home-view="list"] .bar-card-body:not(:has(.bar-card-restriction:not(.is-none))) .bar-card-cond { grid-row: 1 / 2; }
    /* "14h 28m ago" in the orange clock badge; the full wording stays in its title and aria-label */
    html[data-home-view="list"] .staleness-badge-lead { display: none; }
    html[data-home-view="list"] .bar-card-foot .staleness-badge { white-space: normal; line-height: 1.2; }
    /* the restriction shares a half-width column with the name here: give it a third line */
    html[data-home-view="list"] .bar-card-restriction { -webkit-line-clamp: 3; line-clamp: 3; }
}

/* ===== Coast map beside the list (#418) =====
   List view at 1100px and up: a 240px chart panel, an 80px gutter, then the
   list. coast-map.js sets the chart's size and offset (--coast-w/h/top) and
   draws the dots and leader lines into .coast-lines. Decoration that repeats
   the list: no labels, no depths, not for navigation. The images are only
   referenced inside this media query, so they are not fetched in Cards view
   or below 1100px. The colours are the chart's own, darker than the cards. */
.coast-map, .coast-lines, .coast-map-state, .coast-map-borders { display: none; }
@media (min-width: 1100px) {
    html[data-home-view="list"] .coast-wrap {
        --coast-bg: #0e1318;
        --coast-border: #2a323a;
        --coast-south-bg: #12171d;
        --coast-line: #6f8fa3;
        --coast-row-active: #1d2832;
        --coast-active: #fff;
        position: relative;
        display: grid;
        grid-template-columns: 240px minmax(0, 1fr);
        column-gap: 80px;
        /* On screens wider than the page column the map moves out into the left
           margin, so the list gets its width back (all of it from 1920px) */
        margin: 0 0 3rem clamp(-320px, (1280px - 100vw) / 2, 0px);
    }
    /* Its own height, not the panel's: the script compares the two */
    html[data-home-view="list"] .coast-list { align-self: start; min-width: 0; }
    html[data-home-view="list"] .coast-list .region:last-child { margin-bottom: 0; }
    html[data-home-view="list"] .coast-map {
        display: flex;
        flex-direction: column;
        border: 1px solid var(--coast-border);
        border-radius: 10px;
        overflow: hidden;
        background: var(--coast-bg);
    }
    html[data-home-view="list"] .coast-map-chart { position: relative; flex: 1; overflow: hidden; }
    html[data-home-view="list"] .coast-map-tint,
    html[data-home-view="list"] .coast-map-contours {
        position: absolute;
        right: 0;
        top: var(--coast-top, 0);
        width: var(--coast-w, 0);
        height: var(--coast-h, 0);
        background-size: 100% 100%;
        background-repeat: no-repeat;
    }
    html[data-home-view="list"] .coast-map-tint { background-image: url("/static/images/pnw-depth-tint.png?v=2"); }
    html[data-home-view="list"] .coast-map-contours { background-image: url("/static/images/pnw-contours.svg"); opacity: 0.55; }
    /* State lines: the same box as the chart images, faint so the dots and leader lines lead */
    html[data-home-view="list"] .coast-map-borders {
        display: block;
        position: absolute;
        right: 0;
        top: var(--coast-top, 0);
        width: var(--coast-w, 0);
        height: var(--coast-h, 0);
        fill: none;
        stroke: var(--coast-active);
        stroke-opacity: 0.35;
        stroke-width: 1;
        stroke-dasharray: 4 3;
    }
    .coast-map-borders * { vector-effect: non-scaling-stroke; }
    /* State letters on the land (top set by coast-map.js); hidden until placed */
    html[data-home-view="list"] .coast-map-state {
        display: block;
        position: absolute;
        right: 9px;
        translate: 0 -50%;
        font-family: var(--font-mono);
        font-size: var(--text-xs);
        font-weight: 600;
        letter-spacing: 0.1em;
        color: var(--text-secondary);
        visibility: hidden;
    }
    html[data-home-view="list"] .coast-map-south {
        flex: none;
        height: 78px;
        padding: 8px 12px;
        background: var(--coast-south-bg);
        border-top: 1px solid var(--coast-border);
    }
    html[data-home-view="list"] .coast-map-south-label {
        font-family: var(--font-mono);
        font-size: var(--text-xs);
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-muted);
    }
    html[data-home-view="list"] .coast-lines {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 324px;
        height: 100%;
        overflow: visible;
        pointer-events: none;
        z-index: 1;
    }
    .coast-line { fill: none; stroke: var(--coast-line); stroke-width: 1; }
    .coast-line.is-active { stroke: var(--coast-active); stroke-width: 2; }
    .coast-dot { pointer-events: auto; cursor: pointer; }
    .coast-dot.is-dim { opacity: 0.3; }
    .coast-dot-shape { stroke: var(--coast-bg); stroke-width: 4; stroke-linejoin: round; paint-order: stroke; fill: var(--status-unknown); }
    .coast-dot[data-status="open"] .coast-dot-shape { fill: var(--status-open); }
    .coast-dot[data-status="restricted"] .coast-dot-shape { fill: var(--status-restricted); }
    .coast-dot[data-status="closed"] .coast-dot-shape { fill: var(--status-closed); }
    .coast-dot-ring-back { fill: none; stroke: var(--coast-bg); stroke-width: 6; }
    .coast-dot-ring { fill: none; stroke: var(--status-unknown); stroke-width: 2; }
    .coast-dot-halo { fill: none; stroke: var(--coast-active); stroke-width: 2; visibility: hidden; }
    .coast-dot.is-active .coast-dot-halo { visibility: visible; }
    html[data-home-view="list"] .coast-list .bar-card.is-coast-active { background: var(--coast-row-active); }
}

@media (max-width: 640px) {
    .view-toggle-btn { padding: 0.375rem 0.625rem; }
    html[data-home-view="list"] .bar-card { grid-template-columns: 4px 76px minmax(0, 1fr); }
    html[data-home-view="list"] .bar-card-photo { width: 64px; height: 48px; margin-left: 10px; }
    /* Name, then the status badge beside it, then the restriction, then the readings */
    html[data-home-view="list"] .bar-card-body {
        /* Three columns so the report age can sit at the end of the readings
           line without taking width from them: it is the last column alone,
           and the badge spans the last two */
        grid-template-columns: minmax(0, 1fr) auto auto;
        grid-template-areas: "name badge badge" "restr restr restr" "cond cond age";
        row-gap: 3px;
        column-gap: 10px;
        padding: 10px 12px;
    }
    html[data-home-view="list"] .bar-card-badge { font-size: var(--text-xs); padding: 3px 8px; justify-self: end; }
    /* Readings on one line: "14–20 ft · 10 kts S" (the units
       say which is swell and which is wind; larger screens keep the words) */
    html[data-home-view="list"] .bar-card-cond { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    html[data-home-view="list"] .bar-card-cond-word { display: none; }
    html[data-home-view="list"] .bar-card-body:not(:has(.bar-card-restriction:not(.is-none))) .bar-card-top-left { grid-row: auto; }
    /* Every row says how old its report is: "2h 21m ago" after the readings */
    html[data-home-view="list"] .bar-card-foot { display: block; justify-self: end; align-self: baseline; overflow: visible; }
    html[data-home-view="list"] .bar-card-age { font-size: 0.8125rem; color: var(--text-secondary); }
    html[data-home-view="list"] .bar-card-age.is-aging { color: var(--status-restricted); }
    html[data-home-view="list"] .bar-card-age-word { display: none; }
    /* An old report must not look current: a stale row gets its own line for
       "Last report 14h 24m ago" */
    html[data-home-view="list"] .bar-card-body:has(.staleness-badge--stale) {
        grid-template-areas: "name badge badge" "restr restr restr" "cond cond cond" "age age age";
    }
    html[data-home-view="list"] .bar-card-body:has(.staleness-badge--stale) .bar-card-foot { justify-self: start; overflow: hidden; }
}

/* Phones up to 430px: no room for "No restrictions" beside a long name, so
   the badge gets its own line under the name, above the restriction */
@media (max-width: 430px) {
    html[data-home-view="list"] .bar-card-body {
        grid-template-areas: "name name name" "badge badge badge" "restr restr restr" "cond cond age";
    }
    html[data-home-view="list"] .bar-card-body:has(.staleness-badge--stale) {
        grid-template-areas: "name name name" "badge badge badge" "restr restr restr" "cond cond cond" "age age age";
    }
    html[data-home-view="list"] .bar-card-badge { justify-self: start; }
    /* the restriction has a full row here, and narrow lines wrap a lot: allow a third line */
    html[data-home-view="list"] .bar-card-restriction { -webkit-line-clamp: 3; line-clamp: 3; }
}

/* Long names ("Cape Disappointment") must not break mid-word on phones */
@media (max-width: 480px) {
    .bar-card-name { font-size: 1.125rem; }
}

/* Home harbor strip with the bar's photo behind it */
.harbor-card.has-photo {
    background-color: var(--card-bg);
    background-image:
        linear-gradient(90deg, var(--card-bg) 0%, var(--card-bg) 30%, color-mix(in oklab, var(--card-bg) 45%, transparent) 65%, color-mix(in oklab, var(--card-bg) 25%, transparent) 100%),
        var(--harbor-photo);
    background-size: 100% 100%, 70% auto;
    background-position: 0 0, right center;
    background-repeat: no-repeat;
}
.harbor-card.has-photo .harbor-body { min-height: 150px; }
.harbor-card.has-photo .harbor-unpin { background: color-mix(in oklab, var(--card-bg) 80%, transparent); color: var(--text-secondary); }
.harbor-card.has-photo .harbor-age, .harbor-card.has-photo .harbor-saved { color: var(--text-secondary); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
@media (max-width: 640px) {
    .harbor-card.has-photo {
        background-image:
            linear-gradient(180deg, color-mix(in oklab, var(--card-bg) 55%, transparent) 0%, var(--card-bg) 70%),
            var(--harbor-photo);
        background-size: 100% 100%, cover;
        background-position: 0 0, center top;
    }
}

/* Saved bars to compare (#250) */
.compare-saved-link[hidden] { display: none; }
.compare-home-link { display: inline-block; margin: 4px var(--page-pad) 8px; font-size: var(--text-sm); color: var(--ocean-glow); }

/* Moved from barwatch.css (#371): only the homepage runs the tour */
/* ============================================================================
   Onboarding Tour
   ============================================================================ */

/* Tour overlay - dimmed backdrop */
.tour-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 13, 24, 0.85);
    z-index: calc(var(--z-tour) - 1);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur-slow) ease, visibility var(--dur-slow) ease;
}

.tour-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Highlighted target element */
.tour-highlighted {
    position: relative;
    z-index: var(--z-tour);
    box-shadow: 0 0 0 4px var(--ocean-glow), 0 0 20px rgba(59, 158, 206, 0.4);
    border-radius: var(--radius-md);
}

/* Tour tooltip */
.tour-tooltip {
    position: fixed;
    z-index: calc(var(--z-tour) + 1);
    background: var(--ocean-dark);
    border: 1px solid var(--ocean-glow);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    width: 320px;
    max-width: calc(100% - 32px);  /* % of the viewport for a fixed box, without the scrollbar (100vw includes it, #144) */
    box-shadow: var(--shadow-3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity var(--dur-slow) ease, visibility var(--dur-slow) ease, transform var(--dur-slow) ease;
}

/* A non-modal <dialog> (#146): undo the browser's centring, JS sets top/left */
dialog.tour-tooltip {
    margin: 0;
    inset: auto;
    color: inherit;
}

.tour-tooltip.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Tooltip arrow */
.tour-tooltip::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--ocean-dark);
    border: 1px solid var(--ocean-glow);
    transform: rotate(45deg);
}

.tour-tooltip.position-top::before {
    bottom: -7px;
    left: 50%;
    margin-left: -6px;
    border-top: none;
    border-left: none;
}

.tour-tooltip.position-bottom::before {
    top: -7px;
    left: 50%;
    margin-left: -6px;
    border-bottom: none;
    border-right: none;
}

.tour-tooltip.position-left::before {
    right: -7px;
    top: 50%;
    margin-top: -6px;
    border-bottom: none;
    border-left: none;
}

.tour-tooltip.position-right::before {
    left: -7px;
    top: 50%;
    margin-top: -6px;
    border-top: none;
    border-right: none;
}

/* Tour header */
.tour-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.tour-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--ocean-glow);
    margin: 0;
}

.tour-step-count {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Tour content */
.tour-content {
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Tour progress dots */
.tour-progress {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ocean-mid);
    transition: background-color var(--dur-base) ease, transform var(--dur-base) ease;
}

.tour-dot.active {
    background: var(--ocean-glow);
    transform: scale(1.25);
}

/* Tour footer with buttons */
.tour-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.tour-skip {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--text-sm);
    cursor: pointer;
    padding: 0.5rem;
    transition: color var(--dur-base) ease;
}

.tour-skip:hover {
    color: var(--text-secondary);
}

.tour-nav {
    display: flex;
    gap: 0.5rem;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .tour-overlay,
    .tour-tooltip,
    .tour-dot {
        transition: none;
    }

    .tour-tooltip.active {
        transform: none;
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .tour-tooltip {
        width: calc(100% - 32px);
        left: 16px !important;
        right: 16px;
    }

    .tour-tooltip.position-top::before,
    .tour-tooltip.position-bottom::before {
        left: 50%;
    }

    .tour-highlighted {
        box-shadow: 0 0 0 3px var(--ocean-glow), 0 0 15px rgba(59, 158, 206, 0.3);
    }
}

/* Print - hide tour elements */
@media print {
    .tour-overlay,
    .tour-tooltip {
        display: none !important;
    }
}

/* ============================================================================
   Phone home page (640px and under): the first bar is near the top of the
   first screen. Shorter title block, counts on one line, region chips and the
   layout switch on one row, and List rows without the thumbnail so the name
   and status share a line on every phone width.
   ============================================================================ */
@media (max-width: 640px) {
    .main { display: flex; flex-direction: column; padding-top: var(--space-1); }
    /* The "pin your home harbor" hint goes under the list; a pinned harbor stays on top */
    .home-harbor:has(> .harbor-empty) { order: 5; margin: var(--space-3) 0 0; }
    .harbor-empty { padding: 10px 14px; }
    .home-hero { padding-top: var(--space-2); }
    .home-hero-title { font-size: 1.375rem; }
    .home-hero-tagline, .home-find-hint { display: none; }
    .home-find { margin-top: 10px; }
    .home-find-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
    .home-hero-summary { margin-top: 10px; gap: 4px 12px; font-size: var(--text-xs); }
    .home-hero-summary .hero-stat { gap: 5px; }
    .home-hero-summary .hero-stat:first-child { display: none; }  /* the "All" chip below carries the total */
    .region-filters { margin: 10px 0 var(--space-2); gap: 6px; }
    .region-chip { padding-inline: 10px; }
    .region-filters-label { display: none; }
    /* Icons only: the buttons keep their text for screen readers */
    .view-toggle-btn { font-size: 0; gap: 0; min-width: 44px; min-height: 44px; justify-content: center; padding: 0; }
    .region { margin-bottom: var(--space-4); }
    .region-header { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }

    html[data-home-view="list"] .bar-card { grid-template-columns: 4px minmax(0, 1fr); }
    html[data-home-view="list"] .bar-card-photo,
    html[data-home-view="list"] .bar-card-photo.is-empty { display: none; }
    html[data-home-view="list"] .bar-card-body { grid-column: 2; padding: 8px 12px; row-gap: 1px; grid-template-areas: "name badge badge" "restr restr restr" "cond cond age"; }
    html[data-home-view="list"] .bar-card-body:has(.staleness-badge--stale) { grid-template-areas: "name badge badge" "restr restr restr" "cond cond cond" "age age age"; }
    html[data-home-view="list"] .bar-card-badge { justify-self: end; align-self: start; }
    html[data-home-view="list"] .bar-card-restriction { margin-top: 0; }
    .home-disclaimer { margin-top: 0; }
}
