/* NamWater theme: styles for CMS features that the static prototype did not have (forms, accounts, bid pages,
   pop-ups, cookie banner, assistant links, pagination, galleries). Uses the brand variables from namwater.css
   and brand.css. Loaded after brand.css. */

/* Images set in the CMS on hero and page headers */
.hero[data-has-image] { background-image: var(--hero-img); }
.subheader[data-has-image] { background-image: var(--subheader-img); background-size: cover; background-position: center; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--navy); color: #fff; padding: 8px 14px; z-index: 3000; border-radius: 0 0 8px 0; }
.skip-link:focus { left: 0; color: #fff; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.ink { color: var(--ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn-main.w-100 { justify-content: center; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; }

/* Status tags */
.tag-open { background: #DBF2F0; color: #1F6E66; }
.tag-closed, .tag-evaluation { background: #E8F1FA; color: #444C63; }
.tag-award_notice, .tag-awarded { background: #FEF1DB; color: #7A4A06; }
.tag-cancelled { background: #FDE5E5; color: #9B1C1C; }

/* Documents (icon version of the prototype document card) */
.doc { color: var(--ink); width: 100%; text-align: left; cursor: pointer; font: inherit; }
.doc .doc-ico { font-size: 1.25rem; }
.doc .doc-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.doc .doc-text b { font-family: var(--heading); font-size: .98rem; color: var(--ink); overflow-wrap: anywhere; line-height: 1.35; }
.doc .doc-dl { margin-left: auto; color: var(--teal-600); }
.doc-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }

/* Filters, stage tabs, pagination */
.filters .chip { text-decoration: none; }
.chip.active { background: var(--teal); color: var(--navy-900); }
.stage-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.stage-tabs a { padding: 12px 16px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; font-family: var(--heading); }
.stage-tabs a.active, .stage-tabs a:hover { color: var(--navy); border-color: var(--teal); }
.stage-tabs .count { background: var(--teal); color: var(--navy-900); border-radius: 30px; font-size: .72rem; padding: 1px 8px; margin-left: 6px; }
.cms-pager { display: flex; gap: 14px; align-items: center; justify-content: center; }
.cms-pager a, .cms-pager span.disabled { padding: 8px 20px; border: 1px solid var(--line); border-radius: 40px; font-weight: 600; }
.cms-pager .disabled { color: var(--muted); }
.search-big { display: flex; gap: 10px; max-width: 640px; }
.search-big input { flex: 1; border: 1px solid var(--line); border-radius: 40px; padding: 12px 22px; font: inherit; }
.search-group { margin-top: 36px; font-size: 1.25rem; }
.search-hit { display: flex; flex-direction: column; gap: 4px; padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--body); }
.search-hit .tag { align-self: flex-start; }
.search-hit b { color: var(--navy); font-family: var(--heading); font-size: 1.05rem; }

/* Side boxes on light pages: NamWater Blue panels with readable facts */
.side-box dl dt, .bid-facts dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; opacity: .75; }
.side-box dl dd { margin: 0 0 12px; color: #fff; }
.side-box a:not(.btn-main):not(.btn-line) { color: var(--teal); }
.side-box .btn-line { color: #fff; border-color: rgba(255, 255, 255, .5); }
.side-box .footer-contact div { display: flex; gap: 10px; margin-bottom: 10px; }
.side-box .footer-contact.on-light, .side-box .footer-contact.on-light a { color: var(--on-dark); }
.side-box .countdown { color: var(--teal); }
.side-box .notice { color: #643F0E; }
.side-box .notice a { color: var(--navy) !important; }
.side-box .form-hint { color: var(--on-dark); }
.side-box.form-x label { color: #fff; }
.countdown { color: #B45309; font-weight: 600; font-size: .9rem; }
.side-nav button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 14px; border: 0; background: none; color: var(--ink); font-weight: 600; font-size: .92rem; border-radius: 10px; text-align: left; font-family: inherit; }
.side-nav a.active, .side-nav button:hover { background: var(--teal-50); color: var(--teal-600); }
.side-nav a { justify-content: flex-start; gap: 10px; }

/* Notices */
.notice-success { background: #E3F5EC; border-color: #B9E4CD; color: #1E5B3B; }
.notice-danger { background: #FDE5E5; border-color: #F8C4C4; color: #8B1C1C; }
.notice-warning { background: #FEEBD3; }
.notice-info { background: var(--sky); border-color: #CFE0F2; color: var(--ink); }
.notice-info .icon, .notice-success .icon { color: var(--navy); }

/* Cards */
.card-x .card-img { margin: -30px -30px 20px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; aspect-ratio: 16/10; }
.card-x .card-img img { width: 100%; height: 100%; object-fit: cover; }
.step-no { font: 800 2.2rem/1 var(--heading); color: var(--teal); margin-bottom: 12px; display: block; }
.vacancy-card .closing { font-size: .88rem; color: #B45309; font-weight: 600; }
.vacancy-card .closing.closed { color: var(--muted); }
.vacancy-card h4 a, .news-card h4 a { color: var(--ink); }
.contact-card p { font-size: .92rem; }
.bars-grid { max-width: 780px; margin: 0 auto; background: var(--navy-900); border-radius: var(--radius-lg); padding: 26px 30px; }
.qa-item { border-left: 4px solid var(--teal); padding: 10px 18px; margin-bottom: 18px; background: var(--teal-50); border-radius: 0 12px 12px 0; }
.person-bio summary { cursor: pointer; color: var(--teal-600); font-size: .85rem; margin-top: 6px; }
.person-bio { text-align: left; }
.faq-vote button { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 1px 12px; margin-left: 4px; }

/* Rich text from the editor */
.cms-rich > :last-child { margin-bottom: 0; }
.cms-rich img { border-radius: var(--radius); margin: 18px 0; height: auto; }
.cms-rich table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .93rem; }
.cms-rich th { background: var(--teal-50); color: var(--ink); }
.cms-rich td, .cms-rich th { border: 1px solid var(--line); padding: 9px 12px; vertical-align: top; }
.cms-rich h2 { font-size: 1.7rem; margin-top: 1.4em; }
.cms-rich h3 { font-size: 1.3rem; margin-top: 1.3em; }
.cms-rich ul li, .cms-rich ol li { margin-bottom: 6px; }
.cms-rich blockquote { border-left: 4px solid var(--teal); padding: 6px 18px; color: var(--ink); background: var(--teal-50); border-radius: 0 12px 12px 0; }
.section-dark .cms-rich, .section-navy .cms-rich { color: var(--on-dark); }
.section-dark .cms-rich a, .section-navy .cms-rich a { color: var(--teal); }
.cms-embed iframe { width: 100%; min-height: 420px; border: 0; border-radius: var(--radius-lg); }
.narrow-page .container { max-width: 880px; }

/* Gallery and lightbox */
.cms-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cms-gallery a { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/3; display: block; }
.cms-gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.cms-gallery a:hover img { transform: scale(1.05); }
.cms-gallery span { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(20, 25, 60, .8)); color: #fff; padding: 22px 14px 10px; font-size: .82rem; }
.cms-lightbox { position: fixed; inset: 0; background: rgba(20, 25, 60, .92); z-index: 3000; display: grid; place-items: center; padding: 24px; }
.cms-lightbox img { max-height: 82vh; border-radius: 12px; }
.cms-lightbox figcaption { color: #fff; text-align: center; margin-top: 12px; }
.cms-lightbox button { position: absolute; top: 14px; right: 22px; background: none; border: 0; color: #fff; font-size: 2.2rem; }

/* Forms */
.form-x label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--body); }
.form-x input[type=checkbox], .form-x input[type=radio] { width: auto; margin-top: 6px; accent-color: var(--navy); flex: none; }
.form-x input[type=file] { border: 1px dashed var(--line); border-radius: 12px; padding: 10px; background: #fff; width: 100%; }
.form-hint { font-size: .82rem; color: var(--muted); margin: 8px 0 0; }
.form-errors { background: #FDE5E5; border: 1px solid #F8C4C4; color: #8B1C1C; border-radius: var(--radius); padding: 12px 18px; margin-bottom: 18px; font-size: .9rem; }
.form-errors ul { margin: 6px 0 0; padding-left: 18px; }
.rating { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.rating input { display: none; }
.rating label { font-size: 1.7rem; color: rgba(255, 255, 255, .35); cursor: pointer; margin: 0; }
.rating input:checked ~ label, .rating label:hover, .rating label:hover ~ label { color: var(--nw-orange); }
.danger-zone { border-color: #F8C4C4 !important; }
.account-area .card-x { padding: 28px; }
.account-area h3 { font-size: 1.15rem; }

/* Portal conversation */
.thread-msg { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; background: #fff; }
.thread-msg.staff { background: var(--teal-50); border-color: transparent; margin-left: 36px; }
.thread-msg .who { font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.thread-sys { text-align: center; color: var(--muted); font-size: .82rem; margin: 10px 0; }

/* CMS overlays: flash messages, alert bars, pop-ups, modals, cookie banner */
.cms-flash { padding: 12px 0; font-weight: 600; font-size: .95rem; }
.cms-flash .container { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.cms-flash-success { background: var(--teal-50); color: var(--navy-900); }
.cms-flash-danger { background: #FDE5E5; color: #8B1C1C; }
.cms-flash-warning { background: #FEEBD3; color: #643F0E; }
.cms-flash-close, .cms-bar-close { background: none; border: 0; font-size: 1.5rem; line-height: 1; color: inherit; cursor: pointer; }
.cms-bar { padding: 10px 0; font-size: .92rem; position: relative; z-index: 1001; }
.cms-bar .container { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cms-bar a { font-weight: 700; text-decoration: underline; color: inherit; }
.cms-bar-close { margin-left: auto; }
.cms-bar-info { background: var(--navy); color: #fff; }
.cms-bar-success { background: var(--teal); color: var(--navy-900); }
.cms-bar-warning { background: var(--nw-orange); color: var(--navy-900); }
.cms-bar-danger { background: #C62828; color: #fff; }
.cms-popup, .cms-modal { position: fixed; inset: 0; background: rgba(20, 25, 60, .65); z-index: 2500; display: grid; place-items: center; padding: 20px; }
.cms-popup[hidden], .cms-modal[hidden], .cms-bar[hidden], .cms-cookie[hidden] { display: none; }
.cms-popup-box, .cms-modal-box { background: #fff; border-radius: var(--radius-lg); max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; box-shadow: 0 30px 80px rgba(20, 25, 60, .35); }
.cms-modal-box { padding: 34px; max-width: 660px; }
.cms-popup-img { width: 100%; max-height: 280px; object-fit: cover; }
.cms-popup-body { padding: 28px 30px 30px; }
.cms-popup-close { position: absolute; top: 12px; right: 14px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: var(--navy); font-size: 1.5rem; line-height: 1; z-index: 2; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, .12); }
.cms-tone-info { border-top: 6px solid var(--teal); }
.cms-tone-warning { border-top: 6px solid var(--nw-orange); }
.cms-tone-danger { border-top: 6px solid #C62828; }
.cms-tone-success { border-top: 6px solid var(--teal); }
body.cms-modal-open { overflow: hidden; }
.cms-cookie { position: fixed; left: 20px; bottom: 20px; max-width: 460px; background: #fff; border-radius: var(--radius-lg); box-shadow: 0 24px 60px rgba(20, 25, 60, .25); padding: 22px; z-index: 2400; font-size: .9rem; border-top: 5px solid var(--teal); }
.cms-cookie p { color: var(--ink); }
.cms-cookie-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cms-cookie .btn-line { color: var(--navy); border-color: var(--navy); }
.cms-preview-bar { background: var(--nw-orange); color: var(--navy-900); text-align: center; padding: 6px; font-weight: 700; font-size: .9rem; }

/* Assistant links under answers */
.chat-links { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.chat-links a { font-weight: 700; font-size: .85rem; }
.chat-links small { color: var(--muted); font-weight: 400; }
.msg.bot p { margin: 0 0 6px; }
.msg.bot ul { padding-left: 18px; margin: 0; }

/* Error and maintenance pages */
.error-page { padding: 140px 0 120px; }
.error-page .search-big { margin: 30px auto; }

/* Header account button */
.header-actions .icon-btn.account-btn { text-decoration: none; }
.newsletter .hp { position: absolute; }

@media (max-width: 767px) {
  .cms-modal-box { padding: 24px; }
  .thread-msg.staff { margin-left: 12px; }
  .cms-cookie { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
@media print {
  .topbar, .site-header, .site-footer, .chat-fab, .chat-panel, .cms-cookie, #back-to-top, .cms-bar, .cms-popup { display: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* Links inside the dark hero panel and dark sections stay readable */
.hero-card .link-arrow, .section-dark .link-arrow, .section-navy .link-arrow { color: var(--teal); }
.hero-card .small-muted { color: var(--on-dark); }
