/* Trigg Island SLSC Member Handbook — design tokens & shell styles */

:root {
  --green: #00963E;
  --green-dark: #007A32;
  --green-deepest-1: #0E3D24;
  --green-deepest-2: #0A2A19;
  --red: #E8252C;
  --red-text: #C41A20;

  --ink: #15181B;
  --body: #2B2F33;
  --secondary: #5A615A;
  --muted: #8A908A;
  --muted-2: #9AA09A;

  --bg: #EBEDE9;
  --panel: #F6F7F4;
  --card: #FFFFFF;
  --hover: #ECEEE8;
  --hover-2: #F1F3EF;
  --border: #E2E5DF;
  --border-2: #E1E4DE;

  --green-tint: #E7F2EB;
  --green-tint-border: #BFE0CC;
  --amber-tint: #FBF0D6;
  --amber-tint-2: #FFF6E6;
  --amber-tint-border: #F0DDB0;
  --orange-tint: #FBE9D6;
  --orange-tint-border: #F0C9A0;
  --amber-text: #B07E16;
  --amber-text-2: #6A571F;
  --orange-text: #B5631A;
  --dot-draft: #C2891B;

  --red-bg: #FDEEEE;
  --red-title: #C41A20;
  --red-body: #5A3032;
  --amber-bg: #FFF6E6;
  --amber-border: #C2891B;
  --amber-title: #B07E16;
  --amber-body: #6A571F;
  --green-bg: #ECF7F0;
  --green-border: #00963E;
  --green-title: #007A32;
  --green-body: #2B4A38;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Mulish', sans-serif;
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input { font-family: inherit; }
::selection { background: #00963E33; }

.scroll::-webkit-scrollbar { width: 10px; }
.scroll::-webkit-scrollbar-thumb { background: #D4D8D0; border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }

#editor[contenteditable="true"] { outline: none; }

/* ── Shell ── */
.shell { display: flex; flex-direction: column; height: 100vh; min-height: 100vh; }
.body-row { display: flex; flex: 1; min-height: 0; }

/* ── Top bar ── */
.topbar {
  display: flex; align-items: center; gap: 18px;
  height: 66px; flex: none; padding: 0 22px;
  background: #fff; border-bottom: 1px solid var(--border); z-index: 30;
}
.hamburger {
  display: none; width: 38px; height: 38px; border: 1px solid var(--border);
  background: var(--panel); border-radius: 9px; cursor: pointer;
  align-items: center; justify-content: center; font-size: 17px; color: var(--ink); flex: none;
}
.brandwrap { display: flex; align-items: center; gap: 12px; min-width: 264px; }
.brand-logo { width: 42px; height: 42px; border-radius: 9px; object-fit: contain; background: #fff; }
.brand-name { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 15px; color: var(--ink); letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--green); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

.search-wrap { position: relative; flex: 1; max-width: 380px; }
.search-input-wrap { position: relative; }
.search-glyph { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); font-size: 14px; pointer-events: none; }
.search-input {
  width: 100%; height: 38px; padding: 0 12px 0 32px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--panel); font-size: 14px; color: var(--body);
}
.search-dropdown {
  position: absolute; top: 46px; left: 0; right: 0; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 18px 40px -12px rgba(20,24,27,0.22); padding: 8px; z-index: 40;
  max-height: 360px; overflow-y: auto;
}
.search-heading { font-size: 11px; font-weight: 700; color: var(--muted-2); letter-spacing: 0.06em; text-transform: uppercase; padding: 6px 10px 8px; }
.search-result {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px;
  border: none; background: transparent; border-radius: 8px; cursor: pointer; font-family: 'Mulish', sans-serif;
}
.search-result:hover { background: var(--hover-2); }
.search-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.search-result-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.search-title-row { display: flex; align-items: center; gap: 8px; }
.search-title { font-size: 14px; color: var(--body); font-weight: 600; }
.search-section { font-size: 12px; color: var(--muted-2); margin-left: auto; flex: none; }
.search-snippet { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.spacer { flex: 1; }

.mode-switch { display: flex; align-items: center; gap: 4px; background: var(--hover-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.mode-btn { border: none; background: transparent; border-radius: 7px; padding: 7px 13px; font-size: 13px; font-weight: 700; color: var(--secondary); cursor: pointer; font-family: 'Archivo', sans-serif; }
.mode-btn.active { background: var(--ink); color: #fff; }

.userblock { display: flex; align-items: center; gap: 9px; padding-left: 6px; }
.user-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.signout-link { font-size: 11px; color: var(--red); font-weight: 700; background: none; border: none; padding: 0; cursor: pointer; }
.signout-link:hover { text-decoration: underline; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Archivo', sans-serif; font-weight: 700; font-size: 14px; flex: none; }
.avatar.small { width: 38px; height: 38px; font-size: 13px; background: var(--green-tint); color: var(--green-dark); }

/* ── Editor toolbar ── */
.toolbar { display: flex; align-items: center; gap: 6px; flex: none; height: 50px; padding: 0 22px; background: #FBFCFA; border-bottom: 1px solid var(--border); overflow-x: auto; z-index: 20; }
.tb-btn { width: 34px; height: 34px; background: #fff; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--ink); font-size: 14px; flex: none; }
.tb-btn:hover { background: var(--hover-2); }
.tb-div { width: 1px; height: 24px; background: var(--border); margin: 0 4px; flex: none; }
.tb-status { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--secondary); white-space: nowrap; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.dot.amber { background: var(--dot-draft); }
.dot.green { background: var(--green); }

/* ── Sidebar / TOC ── */
.sidebar {
  width: 300px; flex: none; background: var(--panel); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 16px 12px 40px;
}
.toc-label { font-size: 11px; font-family: 'Archivo', sans-serif; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-2); padding: 4px 10px 10px; }
.sec-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.sec-row:hover { background: var(--hover); }
.sec-chevron { display: inline-block; transition: transform 0.15s; color: var(--muted-2); font-size: 10px; width: 10px; }
.sec-chevron.open { transform: rotate(90deg); }
.sec-title { font-family: 'Archivo', sans-serif; font-weight: 700; font-size: 13px; color: var(--ink); flex: 1; }
.sec-count { color: #B4B9B1; font-size: 12px; }
.sec-add { width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--border); background: #fff; color: var(--secondary); font-size: 13px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.page-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 14px; margin-left: 6px; border-radius: 8px; cursor: pointer; border-left: 2px solid transparent; }
.page-row:hover { background: var(--hover); }
.page-row.active { border-left-color: var(--green); background: var(--green-tint); }
.page-row.active .page-title { color: var(--green); font-weight: 800; }
.page-title { font-size: 13.5px; color: #3A403A; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.status-dot.published { background: var(--green); }
.status-dot.draft { background: var(--dot-draft); }
.badge { font-size: 9.5px; font-weight: 800; border-radius: 4px; padding: 2px 5px; flex: none; text-transform: uppercase; }
.badge.draft { color: var(--amber-text); background: var(--amber-tint); border: 1px solid var(--amber-tint-border); }
.badge.edited { color: var(--orange-text); background: var(--orange-tint); border: 1px solid var(--orange-tint-border); }
.drag-handle { color: var(--muted-2); cursor: grab; flex: none; font-size: 13px; }
.row-menu-btn { width: 20px; height: 20px; border: none; background: transparent; color: var(--muted-2); cursor: pointer; flex: none; border-radius: 5px; }
.row-menu-btn:hover { background: var(--hover); }
.new-section-btn {
  width: 100%; margin-top: 10px; padding: 9px 10px; border: 1.5px dashed var(--border);
  border-radius: 8px; background: transparent; color: var(--secondary); font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.new-section-btn:hover { background: var(--hover); }

/* mobile drawer */
.backdrop { display: none; }
.backdrop.show { display: block; position: fixed; inset: 56px 0 0 0; background: rgba(20,24,27,.42); z-index: 65; }

/* ── Admin bar ── */
.admin-bar { display: flex; align-items: center; gap: 20px; background: var(--ink); color: #fff; padding: 16px 48px; flex: none; }
.admin-bar-title { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
.admin-bar-hint { font-size: 12.5px; color: #B8BDBA; flex: 1; }
.manage-editors-btn { border: 1px solid #3A403A; background: transparent; color: #fff; border-radius: 9px; padding: 9px 14px; font-size: 13px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.manage-editors-btn:hover { background: #23282C; }

/* ── Main / article ── */
.main { flex: 1; overflow-y: auto; min-width: 0; }
.main-pad { max-width: 820px; margin: 0 auto; padding: 40px 48px 120px; }
.breadcrumb { font-size: 12.5px; color: var(--muted-2); margin-bottom: 14px; }
.status-pill { display: inline-block; font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 5px 12px; margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.03em; }
.status-pill.published { color: #007A32; background: var(--green-tint); border: 1px solid var(--green-tint-border); }
.status-pill.draft { color: var(--amber-text); background: var(--amber-tint-2); border: 1px solid var(--amber-tint-border); }
.h1 { font-family: 'Anton', sans-serif; font-weight: 400; font-size: 56px; line-height: 0.96; text-transform: uppercase; color: var(--ink); margin: 0; }
.h1[contenteditable] { outline: none; }
.subtitle { font-family: 'Archivo', sans-serif; font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--green); margin-top: 14px; }
.accent-underline { width: 120px; height: 2px; background: var(--red); margin: 22px 0 16px; }
.meta-line { font-size: 13px; color: var(--muted-2); margin-bottom: 30px; }

.art { font-size: 16.5px; line-height: 1.75; color: var(--body); }
.art h2 { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 22px; color: var(--ink); margin: 34px 0 12px; letter-spacing: -0.01em; }
.art h3 { font-family: 'Archivo', sans-serif; font-weight: 700; font-size: 18px; color: var(--ink); margin: 26px 0 8px; }
.art p { margin: 0 0 16px; }
.art p.lead { font-size: 19px; font-weight: 500; color: var(--ink); }
.art ul, .art ol { margin: 8px 0 18px; padding-left: 22px; }
.art li { margin: 8px 0; }
.art ul li::marker { color: var(--green); }
.art ol li::marker { color: var(--green); font-weight: 700; }
.art a { color: var(--green); text-decoration: underline; text-underline-offset: 2px; }
.art blockquote { margin: 22px 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--red); font-family: 'Archivo', sans-serif; font-weight: 800; font-style: italic; color: var(--red); font-size: 19px; line-height: 1.4; }

.callout { border-radius: 14px; padding: 18px 20px; margin: 22px 0; border-left: 4px solid; }
.callout-title { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 14.5px; margin-bottom: 6px; }
.callout-body { font-size: 15px; line-height: 1.6; }
.callout.green { background: var(--green-bg); border-color: var(--green-border); }
.callout.green .callout-title { color: var(--green-title); }
.callout.green .callout-body { color: var(--green-body); }
.callout.red { background: var(--red-bg); border-color: var(--red); }
.callout.red .callout-title { color: var(--red-title); }
.callout.red .callout-body { color: var(--red-body); }
.callout.amber { background: var(--amber-bg); border-color: var(--amber-border); }
.callout.amber .callout-title { color: var(--amber-title); }
.callout.amber .callout-body { color: var(--amber-body); }

.check-card { background: var(--green); color: #fff; border-radius: 16px; padding: 24px 26px; margin: 22px 0; }
.check-title { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 16px; margin-bottom: 14px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.check-item { display: flex; align-items: flex-start; gap: 8px; font-size: 14.5px; line-height: 1.5; }
.check-mark { flex: none; }

.tbl-wrap { overflow-x: auto; margin: 22px 0; }
table.art-table { border-collapse: collapse; width: 100%; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
table.art-table th, table.art-table td { border: 1px solid var(--border); padding: 10px 14px; font-size: 14.5px; text-align: left; }
table.art-table th { background: #F1F3EF; font-family: 'Archivo', sans-serif; font-weight: 700; color: var(--ink); }

.contacts-list { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.contact-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.contact-name { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.contact-role { font-size: 13px; color: var(--muted); }
.contact-email { font-size: 13px; color: var(--green); margin-left: auto; text-decoration: none; }

.fig-wrap { margin: 24px 0; }
.fig-box {
  height: 220px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; padding: 20px;
  background: repeating-linear-gradient(135deg, #EDEFEA, #EDEFEA 10px, #E4E7E0 10px, #E4E7E0 20px);
  border: 1px solid var(--border);
}
.fig-caption { font-size: 12.5px; color: var(--muted); margin-top: 8px; text-align: center; }
.fig-img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--border); }
.video-embed { position: relative; width: 100%; padding-top: 56.25%; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.block { position: relative; }
.block[contenteditable="false"] { cursor: default; }

/* prev/next */
.prevnext { display: flex; gap: 14px; margin-top: 50px; }
.pn-card { flex: 1; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; text-decoration: none; cursor: pointer; background: #fff; }
.pn-card:hover { border-color: var(--green); }
.pn-label { font-size: 12px; color: var(--muted-2); margin-bottom: 4px; }
.pn-title { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.pn-card.next { text-align: right; }

/* ── Save bar ── */
.savebar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; background: rgba(255,255,255,0.86); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); flex: none;
}
.savebar-status { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--secondary); }
.savebar-spacer { flex: 1; }
.btn { border-radius: 9px; padding: 10px 18px; font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: 'Archivo', sans-serif; border: 1px solid transparent; }
.btn.outline { background: #fff; border-color: var(--border); color: var(--ink); }
.btn.outline:hover { background: var(--hover-2); }
.btn.dark-outline { background: #fff; border-color: var(--ink); color: var(--ink); }
.btn.dark-outline:hover { background: var(--hover-2); }
.btn.solid-green { background: var(--green); color: #fff; }
.btn.solid-green:hover { background: var(--green-dark); }
.btn.text-danger { background: none; border: none; color: var(--red-text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Modals ── */
.modal-scrim { position: fixed; inset: 0; background: rgba(20,24,27,0.5); display: flex; align-items: center; justify-content: center; z-index: 90; padding: 20px; }
.modal-card { background: #fff; border-radius: 18px; padding: 28px; max-width: 520px; width: 100%; box-shadow: 0 30px 80px -20px rgba(0,0,0,0.5); max-height: 88vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-title { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 21px; color: var(--ink); }
.modal-close { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 15px; color: var(--secondary); }
.modal-close:hover { background: var(--hover-2); }
.modal-subtext { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin-bottom: 18px; }

.editor-list { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.editor-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.editor-row-name { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.editor-row-meta { font-size: 12.5px; color: #8A908A; }
.you-badge { font-size: 10px; font-weight: 800; color: var(--green-dark); background: var(--green-tint); border: 1px solid var(--green-tint-border); border-radius: 5px; padding: 2px 6px; margin-left: 8px; }
.remove-link { margin-left: auto; background: none; border: none; color: var(--red-text); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.remove-link:hover { text-decoration: underline; }
.dashed-btn { width: 100%; padding: 11px; border: 1.5px dashed var(--border); border-radius: 10px; background: transparent; color: var(--green-dark); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.dashed-btn:hover { background: var(--hover-2); }

/* Login */
.login-bg { position: fixed; inset: 0; background: linear-gradient(160deg, var(--green-deepest-1), var(--green-deepest-2)); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.login-card { background: #fff; border-radius: 18px; max-width: 400px; width: 100%; padding: 36px 32px 30px; text-align: center; }
.login-logo { width: 60px; height: 60px; border-radius: 14px; margin-bottom: 16px; }
.login-title { font-family: 'Archivo', sans-serif; font-weight: 800; font-size: 21px; color: var(--ink); }
.login-sub { font-size: 13.5px; color: var(--muted); margin: 10px 0 24px; line-height: 1.5; }
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; color: var(--muted-2); text-transform: uppercase; margin-bottom: 6px; }
.field input { width: 100%; height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); font-size: 14.5px; color: var(--ink); }
.field input.err { border-color: #E8A0A2; }
.field-error { color: var(--red-text); font-size: 12.5px; margin-top: 8px; text-align: left; }
.login-submit { width: 100%; height: 46px; border-radius: 10px; border: none; background: var(--green); color: #fff; font-weight: 700; font-size: 14.5px; cursor: pointer; margin-top: 6px; }
.login-submit:hover { background: var(--green-dark); }
.login-back { margin-top: 16px; background: none; border: none; color: var(--muted); font-size: 13px; cursor: pointer; }
.login-back:hover { text-decoration: underline; }

/* Toasts */
.toast-wrap { position: fixed; bottom: 26px; left: 0; right: 0; display: flex; justify-content: center; z-index: 200; pointer-events: none; }
.toast { background: var(--ink); color: #fff; border-radius: 11px; padding: 12px 20px; font-size: 13.5px; font-weight: 600; box-shadow: 0 18px 40px -12px rgba(0,0,0,0.4); opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translateY(0); }

.empty-state { color: var(--muted); font-size: 14px; padding: 60px 20px; text-align: center; }

/* ── Responsive ── */
@media (max-width: 860px) {
  .topbar { gap: 10px; padding: 0 14px; height: 56px; }
  .brandwrap { min-width: 0; flex: 1; overflow: hidden; }
  .brandwrap > div { min-width: 0; overflow: hidden; }
  .brand-name, .brand-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .spacer { flex: none; width: 8px; }
  .mode-switch { flex: none; }
  .mode-btn { padding: 6px 8px; font-size: 11.5px; }
  .hide-mobile { display: none !important; }
  .hamburger { display: inline-flex; }
  .sidebar { position: fixed; top: 56px; left: 0; bottom: 0; width: 84vw; max-width: 320px; transform: translateX(-100%); transition: transform .28s ease; z-index: 70; box-shadow: 8px 0 50px rgba(20,24,27,.22); }
  .sidebar.open { transform: translateX(0); }
  .main-pad { padding: 26px 18px 100px; }
  .h1 { font-size: 38px; }
  .admin-bar { padding: 10px 18px; flex-wrap: wrap; gap: 4px 10px; }
  .savebar { padding: 12px 18px; flex-wrap: wrap; }
  .toolbar { padding: 0 14px; }
  .check-grid { grid-template-columns: 1fr; }
}
