/*
 * Flotilla 11 site styles — a port of the inline stylesheet from the legacy default.php.
 * Same palette, masthead, red menu bar, blue submenu column and chart background;
 * table layout replaced with CSS grid, rounded-corner GIFs with border-radius.
 */
:root {
    --navy: #0C2566;
    --red: #EF3E42;
    --blue: #009DDC;
    --edge: #0C25CC;
    --text: #333333;
    --muted: #999999;
    --link: navy;
    --link-hover: #CC0033;
    --h2: #EE5522;
    --radius: 20px;
    --submenu-width: 12em;
    --sidebar-width: 200px;
    --main-font-size: small;
    --font-body: verdana, arial, helvetica, sans-serif;
    --font-head: arial, helvetica, verdana, sans-serif;
}

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
    background-color: #dfe6ea;
    background-image: url(/images/bellingham_bay_chart_muted_1920.jpeg);
    background-size: cover;
    background-attachment: fixed;
    font-family: var(--font-body);
    color: var(--text);
}
@media (max-width: 1600px) { body { background-image: url(/images/bellingham_bay_chart_muted_1600.jpeg); } }
@media (max-width: 1024px) { body { background-image: url(/images/bellingham_bay_chart_muted_1024.jpeg); } }
@media (max-width: 800px)  { body { background-image: url(/images/bellingham_bay_chart_muted_800.jpeg); } }

.site {
    width: 90%;
    max-width: 1500px;
    margin: 1em auto;
    min-width: 0;
}

/* ---- Masthead ---- */
.masthead {
    display: flex;
    align-items: center;
    gap: 1em;
    height: 100px;
    padding: 0 var(--radius);
    background: var(--navy) url(/images/flag100.jpg) no-repeat right center;
    border-radius: var(--radius) var(--radius) 0 0;
    color: #fff;
    font-family: var(--font-head);
}
.masthead a.logo { display: block; flex: 0 0 100px; height: 100px; }
.masthead a.logo img { display: block; width: 100px; height: 100px; }
.masthead .titles { display: flex; flex-direction: column; min-width: 0; }
.masthead .title { font-size: x-large; font-weight: bold; padding: 0.5em 0.5em 0.25em; }
.masthead .subtitle { font-size: large; padding: 0.25em 0.75em 0.5em; }

/* ---- Primary menu (red bar) ---- */
.primary {
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    min-height: 2em;
    background: var(--red) url(/images/menu_gradient.png) repeat-x;
    background-size: auto 100%;
    border: solid 1px var(--edge);
    border-top: 0;
    font-family: var(--font-head);
    font-size: small;
    padding-left: var(--radius);
}
.primary ul { display: flex; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.primary li { display: flex; }
.primary li + li { border-left: solid 1px var(--edge); }
.primary a { display: flex; align-items: center; padding: 0.4em 0.75em; color: var(--navy); text-decoration: none; white-space: nowrap; }
.primary a:hover { color: #fff; }
.primary li.selected { background: var(--blue); }
.primary li.selected a { color: #fff; }
.primary .account {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.4em;
    padding: 0 0.75em;
    color: var(--navy);
    white-space: nowrap;
}
.primary .account a { display: inline; padding: 0; }
.primary .account form { display: inline; margin: 0; }
.linklike {
    background: none; border: 0; padding: 0; margin: 0;
    font: inherit; color: inherit; cursor: pointer;
}
.primary .account .linklike { color: var(--navy); }
.primary .account .linklike:hover { color: #fff; }
.menu-toggle { display: none; }

.band {
    height: 4px;
    background: var(--blue);
    border-left: solid 1px var(--edge);
    border-right: solid 1px var(--edge);
}

/* ---- Body: [gutter+submenu] [main] [divider] [sidebar] [gutter] ---- */
.frame {
    display: grid;
    grid-template-columns: var(--radius) minmax(0, 1fr) 1px calc(var(--sidebar-width) + 2em) var(--radius);
    background: #fff;
    border-left: solid 1px var(--edge);
    border-right: solid 1px var(--edge);
    min-height: 20em;
}
.frame.has-submenu {
    grid-template-columns: calc(var(--submenu-width) + var(--radius)) minmax(0, 1fr) 1px calc(var(--sidebar-width) + 2em) var(--radius);
}
.frame > .gutter-right { border-top: solid 1px var(--edge); }

.submenu {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.has-submenu .submenu {
    background: var(--blue);
    border-right: solid 1px var(--edge);
    padding: 1em 0.5em 0.75em var(--radius);
}
.submenu ul { list-style: none; margin: 0; padding: 0; }
.submenu li { padding: 0; line-height: 1.25; }
.submenu a { color: #fff; text-decoration: none; font-family: var(--font-head); font-size: small; }
.submenu a:hover, .submenu li.selected a { text-decoration: underline; }
.submenu li.selected a { font-weight: bold; }
.submenu ul.nested { margin: 0.2em 0 0.3em 0.8em; font-size: 95%; }
/* A selected parent (Topics) must not bold/underline all of its nested items. */
.submenu li.selected ul.nested a { font-weight: normal; text-decoration: none; }
.submenu li.selected ul.nested a:hover, .submenu ul.nested li.selected a { text-decoration: underline; }
.submenu ul.nested li.selected a { font-weight: bold; }
.type-size { color: #fff; font-size: small; margin-top: 2em; }
.type-size button { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; padding: 0 0.15em; font-family: inherit; }
.frame:not(.has-submenu) .type-size { display: none; }

#main {
    min-height: 20em;
    padding: 0.5em 1em 1em;
    border-top: solid 1px var(--edge);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--main-font-size);
    letter-spacing: 0.5px;
    overflow-wrap: break-word;
}
#main h1:focus { outline: none; }
#main h1 { font-family: var(--font-head); font-size: 135%; color: #112266; }
#main h2 { font-family: var(--font-head); font-size: 115%; font-weight: bold; color: var(--h2); }
#main h3 { font-family: var(--font-head); font-size: 105%; color: #112266; }
#main img {
    margin: 1em;
    border-top: solid 1px #CCCCCC; border-left: solid 1px #CCCCCC;
    border-right: solid 1px var(--muted); border-bottom: solid 1px var(--muted);
    max-width: min(20rem, 100%);
    height: auto;
}
#main img.icon, #main img.plain { border: 0; margin: 0; }
#main a { color: var(--link); }
#main a:hover { color: var(--link-hover); }
#main b, #main strong { color: #000; }
#main p { text-align: justify; }
#main iframe { max-width: 100%; border: 0; }

.divider { background: #CCCCCC; border-top: solid 1px var(--edge); }

.sidebar { padding: 1em; border-top: solid 1px var(--edge); font-size: small; }
.sidebar h2 { color: var(--red); font-size: small; font-weight: bold; font-family: var(--font-head); margin: 0 0 0.4em; }
.sidebar section + section { margin-top: 1.5em; }
.sidebar a { color: var(--link); }
.sidebar img.cover { width: 100%; border: solid 1px #ccc; }
.sidebar .subscribe { margin-top: 0.3em; }

/* ---- Footer ---- */
.footer {
    display: grid;
    grid-template-columns: var(--radius) 1fr var(--radius);
    background: #fff;
    border: solid 1px var(--edge);
    border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    min-height: var(--radius);
    overflow: hidden;
}
.footer.has-submenu { grid-template-columns: calc(var(--submenu-width) + var(--radius)) 1fr var(--radius); }
.footer.has-submenu .spacer { background: var(--blue); border-right: solid 1px var(--edge); }
.footer .terms {
    text-align: center;
    font-size: x-small;
    font-family: var(--font-body);
    padding: 0.4em 0 0.6em;
    color: var(--muted);
}
.footer .terms a, .footer .terms button { color: var(--muted); text-decoration: none; }
.footer .terms a:hover, .footer .terms button:hover { color: var(--link-hover); }

/* ---- Dialogs (Terms / Privacy) ---- */
dialog.site-dialog {
    max-width: min(40em, 92vw);
    padding: 0;
    border: solid 2px var(--navy);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: small;
}
dialog.site-dialog::backdrop { background: rgb(102 102 102 / 0.5); }
dialog.site-dialog h2 { margin: 0; padding: 0.5em 1em; background: var(--navy); color: #fff; font-family: var(--font-head); font-size: small; text-align: center; }
dialog.site-dialog .body { padding: 1em; line-height: 1.5; }
dialog.site-dialog form { text-align: right; padding: 0 1em 1em; }

/* ---- Lists (ported xtable / xblock) ---- */
table.xtable { border: solid 1px var(--muted); margin-left: 1em; border-collapse: collapse; }
table.xtable th { border-bottom: solid 1px var(--muted); padding: 0.2em 0.5em 0.2em 0.3em; background: var(--blue); color: #fff; text-transform: capitalize; text-align: left; font-family: var(--font-head); }
table.xtable td { border-right: solid 1px #CCCCCC; border-bottom: solid 1px #CCCCCC; padding: 0.15em 4px 0.15em 2px; }
table.xtable td.group { font-weight: bold; background: #f3f8fb; }
table.xtable td.first { padding-left: 1.5em; }
table.xblock { width: 90%; margin: auto; border-collapse: collapse; }
table.xblock td { padding: 0.1em 0.3em; }
table.xblock tr.gap td { padding-top: 0.9em; }
table.xblock td.group { font-weight: bold; }
.page-footer { text-align: right; padding: 0.5em 2em 0 0; color: var(--muted); font-family: var(--font-head); font-size: x-small; }
.page-footer a { text-decoration: none; }

#main ul.overview { padding-left: 1.2em; }
#main ul.overview li { margin: 0.55em 0; }
#main ul.overview a { font-weight: bold; }

/* ---- Articles ---- */
.byline { color: var(--muted); font-size: 90%; margin-top: -0.6em; }
.article-list { list-style: none; padding: 0; margin: 0; }
.article-list li { padding: 0.6em 0; border-bottom: solid 1px #e3e3e3; display: flow-root; }
.article-list li:last-child { border-bottom: 0; }
.article-list .title { font-family: var(--font-head); font-weight: bold; font-size: 110%; }
.article-list .meta { color: var(--muted); font-size: 90%; }
.article-list .summary { margin: 0.2em 0 0; }
#main .article-list img.thumb { float: right; width: 120px; max-height: 90px; object-fit: cover; margin: 0 0 0.3em 1em; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35em; padding: 0; margin: 0.5em 0; list-style: none; }
.tags a { display: inline-block; padding: 0.1em 0.6em; border-radius: 1em; background: #e6f5fb; color: var(--navy) !important; text-decoration: none; font-size: 90%; }
.tags a:hover { background: var(--blue); color: #fff !important; }
figure.hero { margin: 0 0 1em; }
#main figure.hero img { max-width: 100%; max-height: 26rem; width: auto; margin: 0; }
#main article { display: flow-root; }
figure figcaption { color: #666; font-size: 90%; font-style: italic; }
#main figure.inline { float: right; max-width: min(20rem, 45%); margin: 0.3em 0 0.8em 1.2em; }
#main figure.inline img { margin: 0; max-width: 100%; }
.issue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1.2em; }
.issue-grid a { text-decoration: none; text-align: center; display: block; }
#main .issue-grid img { margin: 0 0 0.3em; max-width: 100%; width: 100%; aspect-ratio: 8.5 / 11; object-fit: cover; object-position: top; }
/* The gap before a badge is set here: Razor drops the whitespace between elements. */
.draft-badge, .members-badge { margin-left: 0.45em; }
.draft-badge + .members-badge { margin-left: 0.25em; }
.members-badge { display: inline-block; background: var(--navy); color: #fff; padding: 0 0.4em; border-radius: 3px; font-size: 80%; font-weight: bold; vertical-align: middle; }
.current-issue { display: flex; gap: 1.5em; align-items: flex-start; background: #f4fafd; border: solid 1px #cfe3ee; border-radius: 8px; padding: 1em 1.2em; margin: 0.5em 0 1.2em; }
#main .current-issue .cover img { margin: 0; width: 180px; max-width: 180px; box-shadow: 0 2px 8px rgb(0 0 0 / 0.2); }
.current-issue h2 { margin-top: 0.2em; }
.current-issue .meta { color: var(--muted); }
#main a.btn.download { font-size: 120%; padding: 0.5em 1.2em; }
@media (max-width: 600px) { .current-issue { flex-direction: column; align-items: center; text-align: center; } }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.4em 1.2em; margin-top: 1em; }
.gallery figure { margin: 0; }
#main .gallery img { margin: 0; width: 100%; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.gallery figcaption { font-size: 90%; margin-top: 0.35em; line-height: 1.35; }
.gallery .when { font-family: var(--font-head); font-weight: bold; }
.gallery .caption { display: block; color: #555; margin-top: 0.15em; }
.draft-badge { display: inline-block; background: #FFCC00; color: #000; padding: 0 0.4em; border-radius: 3px; font-size: 80%; font-weight: bold; vertical-align: middle; }

/* ---- Forms / status ---- */
.warning { color: #CC9900; }
.error, .caution { color: #FF0033; }
.notice { background: #e6f5fb; border-left: 4px solid var(--blue); padding: 0.5em 0.8em; }
.form-grid { display: grid; grid-template-columns: max-content minmax(0, 24em); gap: 0.5em 0.8em; align-items: center; }
.form-grid .full { grid-column: 1 / -1; }
.form-block { margin-top: 0.6em; max-width: calc(24em + 6em); }
.form-block label { display: block; margin-bottom: 0.3em; }
.form-block textarea { font: inherit; padding: 0.25em; width: 100%; box-sizing: border-box; }
.form-grid input:not([type=checkbox]):not([type=radio]):not([type=file]), .form-grid textarea, .form-grid select { font: inherit; padding: 0.25em; width: 100%; box-sizing: border-box; }
.form-grid input[type=checkbox], .form-grid input[type=radio] { width: auto; margin: 0 0.4em 0 0; vertical-align: middle; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(14em, 1fr)); gap: 0.25em 1em; }
.checks label { display: flex; align-items: center; white-space: nowrap; }
.btn { font: inherit; padding: 0.3em 0.9em; border: solid 1px var(--navy); background: var(--navy); color: #fff; border-radius: 4px; cursor: pointer; }
.btn:hover { background: var(--blue); border-color: var(--blue); }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { background: #b3261e; border-color: #b3261e; }
/* Links styled as buttons: beat "#main a" (navy text, underline, red hover). */
#main a.btn, #main a.btn:hover { color: #fff; text-decoration: none; display: inline-block; }
#main a.btn.secondary { color: var(--navy); }
#main a.btn.secondary:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Narrow screens ---- */
@media (max-width: 800px) {
    .site { width: auto; margin: 0; }
    .masthead { border-radius: 0; padding: 0 0.75em; background-size: auto 100%; }
    .masthead .title { font-size: large; }
    .masthead .subtitle { font-size: medium; }
    .frame, .frame.has-submenu { grid-template-columns: minmax(0, 1fr); }
    .frame > .gutter-right, .divider, .sidebar { display: none; }
    .has-submenu .submenu { padding: 0.5em 1em; border-right: 0; }
    .submenu ul { display: flex; flex-wrap: wrap; gap: 0.2em 1.2em; }
    .type-size { display: none; }
    .frame:not(.has-submenu) .submenu { display: none; }
    .footer, .footer.has-submenu { grid-template-columns: 0 1fr 0; border-radius: 0; }
    .primary { padding-left: 0; }
    .primary .account { margin-left: 0; padding: 0.4em 0.75em; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    table.xtable { margin-left: 0; }
    table.xblock { width: 100%; }
    #main { padding: 0.5em 0.8em 1em; }
    #main figure.inline { float: none; max-width: 100%; margin: 0.5em 0; }
}
@media (max-width: 600px) {
    /* Content images carry inline float styles from the editor; stack them instead. */
    #main img { float: none !important; display: block; margin: 0.8em auto !important; max-width: 100%; }
    #main img.icon, #main img.plain { display: inline; margin: 0 !important; }
    #main p, #main li { text-align: left !important; }
}
@media (max-width: 480px) {
    .masthead { height: 72px; background-image: none; }
    .masthead a.logo, .masthead a.logo img { width: 64px; height: 64px; flex-basis: 64px; }
    .masthead .title { font-size: medium; padding: 0.2em 0.3em; }
    .masthead .subtitle { font-size: small; padding: 0.2em 0.3em; }
}

#blazor-error-ui {
    background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---- Admin ---- */
.upload-box { border: solid 1px #cfe3ee; background: #fbfdfe; border-radius: 8px; padding: 0.2em 1.2em 0.8em; margin: 0.5em 0 1.5em; }
.upload-box h2 { margin-top: 0.6em; }
.placements { border: solid 1px #cfe3ee; background: #f4fafd; border-radius: 6px; padding: 0.4em 0.9em; margin: 0.4em 0 1em; }
.placements summary { font-family: var(--font-head); font-weight: bold; color: var(--navy); cursor: pointer; }
.placements .status { margin: 0.4em 0 0.2em; color: #555; font-size: 90%; text-align: left; }
.placements ul { margin: 0.3em 0 0.3em; padding-left: 1.2em; }
.placements li { margin: 0.15em 0; }
.placements .url { color: var(--muted); font-size: 90%; margin-left: 0.3em; }
.placements .note { color: #555; font-size: 90%; margin-left: 0.3em; }
.admin-nav { font-family: var(--font-head); font-size: small; padding: 0.3em 0 0.6em; border-bottom: solid 1px #e3e3e3; margin-bottom: 0.5em; }
.admin-nav a { text-decoration: none; }
#main .xtable input, #main .xtable select { font: inherit; }
button:disabled { opacity: 0.4; cursor: default; }
/* Everything clickable gets the hand cursor (links and .btn already do). */
select, input[type=checkbox], input[type=radio], input[type=file],
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { cursor: pointer; }
input[type=file]::file-selector-button { cursor: pointer; }
select:disabled, input:disabled { cursor: not-allowed; }
