/* CIOOS National theme (teal primary). A regional catalogue changes --cioos-primary/--cioos-dark. */
:root {
  --cioos-navy: #152F37;
  --cioos-teal-light: #C6E3DF;
  --cioos-sand: #F3F0EC;
  --cioos-white: #FFFFFF;
  --cioos-primary: #52A79B;
  --cioos-dark: var(--cioos-navy);
  --cioos-primary-text: #2E7D72; /* primary darkened for text/link contrast on white */
  --border: #C6E3DF;
  --muted: #4A6169;
  --danger: #B23A48;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cioos-sand);
  color: var(--cioos-navy);
  font-family: 'Montserrat', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
h1, h2, h3, h4 { font-family: 'Sora', sans-serif; color: var(--cioos-navy); line-height: 1.25; margin: 0 0 16px; }
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
p, li { line-height: 1.7; }
a { color: var(--cioos-primary-text); }
a:hover { color: var(--cioos-navy); }
code, pre { font-family: 'Courier New', monospace; }
img { max-width: 100%; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--cioos-white); padding: 8px; z-index: 10; }

/* Header */
.site-header { background: var(--cioos-dark); color: var(--cioos-white); }
.site-header .container { display: flex; align-items: center; gap: 16px; min-height: 72px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.site-header .logo { display: flex; align-items: center; gap: 10px; color: var(--cioos-white); text-decoration: none; font: 700 1.5rem Sora, sans-serif; }
.site-header .logo img { height: 36px; width: auto; display: block; }
.site-nav { display: flex; gap: 0 4px; flex-wrap: wrap; flex: 1; }
.site-nav a, .site-tools a { white-space: nowrap; }
.site-nav a, .site-tools a { color: var(--cioos-white); text-decoration: none; padding: 8px 8px; border-radius: 4px; font-weight: 500; }
.site-nav a:hover, .site-nav a.active, .site-tools a:hover { color: var(--cioos-teal-light); }
.site-nav a.active { box-shadow: inset 0 -2px 0 var(--cioos-teal-light); border-radius: 0; }
.site-tools { display: flex; gap: 8px; align-items: center; }
.site-tools .lang { border: 1px solid rgba(255,255,255,.5); }

/* Footer */
.site-footer { background: var(--cioos-dark); color: rgba(255,255,255,.8); margin-top: 64px; padding: 32px 0; font-size: .875rem; }
.site-footer a { color: var(--cioos-white); }
.site-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

main { padding: 32px 0; }
main > .hero:first-child { margin-top: -32px; }

/* Buttons and forms */
.btn {
  display: inline-block; font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 1rem;
  border-radius: 4px; padding: 12px 24px; border: none; cursor: pointer; text-decoration: none; line-height: 1.2;
  background: var(--cioos-primary); color: var(--cioos-navy);
}
.btn:hover { background: var(--cioos-navy); color: var(--cioos-white); }
.btn-secondary { background: transparent; color: var(--cioos-primary-text); border: 2px solid var(--cioos-primary); padding: 10px 24px; }
.btn-secondary:hover { background: var(--cioos-teal-light); color: var(--cioos-navy); }
.btn-danger { background: transparent; color: var(--danger); border: 2px solid var(--danger); padding: 10px 24px; }
.btn-danger:hover { background: var(--danger); color: var(--cioos-white); }
.btn-small { padding: 8px 16px; font-size: .875rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

label { display: block; font-weight: 600; margin-bottom: 8px; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=search], input[type=date], select, textarea {
  width: 100%; font: inherit; color: var(--cioos-navy); background: var(--cioos-white);
  border: 1px solid #9DB7B3; border-radius: 4px; padding: 8px 16px;
}
textarea { min-height: 96px; }
textarea.json { font-family: 'Courier New', monospace; font-size: .875rem; min-height: 160px; }
input:focus, select:focus, textarea:focus, .btn:focus, a:focus { outline: 3px solid var(--cioos-primary); outline-offset: 2px; }
.field { margin-bottom: 24px; }
.field .help { color: var(--muted); font-size: .875rem; margin: 0 0 8px; }
.field .langs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field .langs span { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.field .checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.field .checks label { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; margin: 0; }
.errors { color: var(--danger); font-weight: 600; margin: 8px 0 0; padding: 0; list-style: none; }
.alert { background: #FBE9EB; border-left: 4px solid var(--danger); padding: 16px; border-radius: 4px; margin-bottom: 24px; }
.notice { background: var(--cioos-teal-light); padding: 16px; border-radius: 4px; margin-bottom: 24px; word-break: break-all; }

/* Cards and panels */
.card { background: var(--cioos-white); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 2px 8px rgba(21,47,55,0.08); padding: 24px; }
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.layout { display: grid; grid-template-columns: 280px 1fr; gap: 32px; align-items: start; }
.layout-main-side { display: grid; grid-template-columns: 1fr 320px; gap: 32px; align-items: start; }

/* Home */
.hero { background: var(--cioos-navy); color: var(--cioos-white); padding: 64px 0; }
.hero h1 { color: var(--cioos-white); font-size: 2.5rem; }
.hero p { color: rgba(255,255,255,.85); max-width: 720px; }
.search-box { display: flex; gap: 8px; margin-top: 24px; max-width: 720px; }
.search-box input { flex: 1; }
.stats { display: flex; gap: 32px; margin-top: 24px; font-weight: 600; color: var(--cioos-teal-light); }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.tile { background: var(--cioos-white); border: 1px solid var(--border); border-radius: 8px; padding: 8px 16px; text-decoration: none; color: var(--cioos-navy); }
.tile:hover { background: var(--cioos-teal-light); }
.tile .count { color: var(--muted); font-size: .875rem; margin-left: 8px; }
section.block { margin-top: 48px; }

/* Search */
.facets h2 { font-size: 1rem; margin: 24px 0 8px; }
.facets ul { list-style: none; margin: 0; padding: 0; }
.facets li a { display: flex; justify-content: space-between; gap: 8px; padding: 4px 8px; border-radius: 4px; text-decoration: none; color: var(--cioos-navy); font-size: .9rem; }
.facets li a:hover { background: var(--cioos-teal-light); }
.facets li a.active { background: var(--cioos-primary); color: var(--cioos-navy); font-weight: 600; }
.facets .count { color: var(--muted); }
.search-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.search-bar input { flex: 1 1 280px; }
.search-bar select { flex: 0 1 220px; }
.result-count { margin: 0 0 16px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { background: var(--cioos-teal-light); color: var(--cioos-navy); border-radius: 16px; padding: 4px 16px; font-size: .875rem; text-decoration: none; }
.chip:hover { background: var(--cioos-primary); }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.result h3 { margin-bottom: 8px; }
.result h3 a { text-decoration: none; color: var(--cioos-navy); }
.result h3 a:hover { color: var(--cioos-primary-text); text-decoration: underline; }
.result .org { color: var(--muted); font-size: .875rem; margin-bottom: 8px; }
.result p { margin: 0 0 8px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: var(--cioos-sand); border: 1px solid var(--border); }
.badge.eov { background: var(--cioos-teal-light); border-color: var(--cioos-teal-light); }
.badge.private { background: var(--cioos-navy); color: var(--cioos-white); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; }

/* Dataset */
.breadcrumb { font-size: .875rem; margin-bottom: 16px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.dataset-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.notes { margin: 16px 0 24px; }
.resources { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.resources li { display: flex; gap: 16px; justify-content: space-between; align-items: center; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--cioos-white); flex-wrap: wrap; }
.resources .name { font-weight: 600; }
.resources .desc { color: var(--muted); font-size: .875rem; }
table.info { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.info th, table.info td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.info th { width: 35%; font-weight: 600; }
.side h3 { font-size: 1rem; margin-top: 24px; }
.side .card + .card { margin-top: 16px; }
.contacts { list-style: none; padding: 0; margin: 0; }
.contacts li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.contacts .role { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.map-filter { padding: 16px 24px; margin-bottom: 16px; }
.map-filter summary { cursor: pointer; font-weight: 600; }
#search-map { height: 320px; border-radius: 8px; border: 1px solid var(--border); margin-top: 16px; }
#map { height: 280px; border-radius: 8px; border: 1px solid var(--border); margin-top: 8px; }
.citation { font-size: .9rem; background: var(--cioos-sand); padding: 16px; border-radius: 4px; }

/* Harvest */
table.list { width: 100%; border-collapse: collapse; background: var(--cioos-white); }
table.list th, table.list td { text-align: left; padding: 8px 16px; border-bottom: 1px solid var(--border); }
table.list th { background: var(--cioos-teal-light); font-weight: 600; }
.status { font-weight: 600; }
.error-list { font-size: .875rem; }

@media (max-width: 1024px) {
  .layout-main-side { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .layout { grid-template-columns: 1fr; }
  .field .langs { grid-template-columns: 1fr; }
  .hero { padding: 48px 0; }
  .hero h1 { font-size: 2rem; }
  .search-box { flex-direction: column; }
  table.list { display: block; overflow-x: auto; }
}
.sign-in-providers { display: flex; flex-direction: column; gap: 12px; }
.btn-provider { text-align: center; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 24px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid #ccc; }

/* Metadata entry form */
.muted { color: var(--muted); }
.form-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.form-head h1 { margin: 0; }
.form-page { max-width: 1200px; }
.form-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; margin-top: 24px; }
.section-rail { position: sticky; top: 16px; }
.section-rail ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.section-rail a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; color: var(--cioos-navy); text-decoration: none; margin-left: -2px; border-left: 2px solid transparent; }
.section-rail a:hover, .section-rail a:focus { border-left-color: var(--cioos-primary); background: var(--cioos-white); }
.section-rail .mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); font-size: .75rem; font-weight: 700; flex: none; }
.section-rail .done .mark { background: var(--cioos-primary); border-color: var(--cioos-primary); color: var(--cioos-white); }
.section-rail .has-errors .mark { background: var(--danger); border-color: var(--danger); color: var(--cioos-white); }
.form-sections { display: flex; flex-direction: column; gap: 24px; }
.form-section { scroll-margin-top: 16px; }
.form-section > form > fieldset, .row-card fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field { border: 0; padding: 0; min-width: 0; }
fieldset.field legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.row-card { border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; margin: 0 0 16px; background: var(--cioos-white); }
.row-card legend { font-weight: 700; padding: 0 6px; }
.row-card h3 { font-size: 1rem; margin: 16px 0 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.bbox { display: grid; grid-template-columns: repeat(3, minmax(0, 160px)); grid-template-areas: ". n ." "w . e" ". s ."; gap: 8px 16px; }
.bbox-north { grid-area: n; } .bbox-south { grid-area: s; } .bbox-east { grid-area: e; } .bbox-west { grid-area: w; }
.form-section:has(#noVerticalExtent:checked) .vertical { display: none; }
.field-error { color: var(--danger); font-weight: 600; margin: 4px 0 0; }
.check { display: flex; gap: 8px; align-items: baseline; font-weight: 400; }
.eov-group h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 4px; }
details summary { cursor: pointer; color: var(--cioos-primary-text); margin: 8px 0; }
.actions form { display: inline; }
.status-draft { background: var(--cioos-sand); }
.status-submitted { background: #FFF3CD; }
.status-published { background: var(--cioos-teal-light); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 1024px) {
  .form-layout { grid-template-columns: 1fr; }
  .section-rail { position: static; }
  .section-rail ol { display: flex; flex-wrap: wrap; border-left: 0; }
}
@media (max-width: 767px) { .grid-2 { grid-template-columns: 1fr; } }
.replaced-by { grid-column: 1 / -1; margin: 0 0 8px 24px; }
.translate { margin-top: 8px; } .translate-status { margin-left: 12px; font-size: .875rem; }
.saved-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.subsection { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); }
.row-card.nested { background: var(--cioos-sand); }
.row-card h4 { font-size: .95rem; margin: 16px 0 8px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.saved-picker { display: flex; gap: 8px; align-items: center; margin-top: 12px; max-width: 520px; }
.search-row { display: flex; gap: 8px; }
.taxa-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.taxa-table th, .taxa-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.taxon-results { list-style: none; padding: 0; } .taxon-results li { margin: 6px 0; }
.form-section:has(#noTaxa:checked) .taxa { display: none; }
.form-section:has(#noPlatform:checked) .platforms { display: none; }
.form-section:not(:has(#noPlatform:checked)) .no-platform-note { display: none; }
.form-map { height: 360px; border-radius: 8px; border: 1px solid var(--border); margin-top: 8px; }
.form-map-wrap { margin: 8px 0 24px; }
.share-list { list-style: none; padding: 0; margin: 0 0 16px; }
.share-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.inline-form { display: flex; gap: 8px; max-width: 520px; }
.return-form { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
