/* AI Governance newsletter — light, editorial layout modelled on a modern
   newsletter homepage. Brand orange from MySecureGPT (#FC8B02). */
:root {
  --brand: #fc8b02;
  --brand-hover: #e57b00;
  --brand-ink: #b35f00;      /* orange for text on white (AA contrast) */
  --ink: #111827;
  --text: #374151;
  --muted: #6b7280;
  --bg: #ffffff;
  --panel: #f9fafb;
  --line: #e5e7eb;
  --radius: 8px;
  --max: 1120px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Open Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: var(--brand-ink); text-underline-offset: 3px; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); font-weight: 800; letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }

.container { width: min(100% - 32px, var(--max)); margin-inline: auto; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 24px 0; }
.hp { position: absolute !important; left: -9999px !important; opacity: 0 !important; height: 0; width: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link {
  position: absolute; left: 16px; top: -48px; background: var(--ink); color: #fff;
  padding: 8px 12px; border-radius: 6px; z-index: 10;
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid #ffd3a3; outline-offset: 2px; }

/* ----- Buttons & fields ---------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 6px; padding: 11px 18px;
  font: 700 0.95rem/1 "Open Sans", system-ui, sans-serif; cursor: pointer; text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--brand); color: #111827; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: #cfd4dc; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--panel); }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="password"],
textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #d1d5db; border-radius: 6px; padding: 11px 13px;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(252, 139, 2, 0.2); }
textarea { resize: vertical; }
.form-status { min-height: 1.4em; font-weight: 600; color: var(--ink); margin: 8px 0 0; font-size: 0.92rem; }
.form-status.error { color: #b42318; }
.form-status.ok { color: #067647; }

/* ----- Top bar ------------------------------------------------------------- */
.topbar, .masthead {
  position: sticky; top: 0; z-index: 5;
  background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner, .masthead-inner { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-logo { height: 30px; width: auto; }
.brand-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; }
.nav { margin-left: auto; display: flex; gap: 2px; flex-wrap: wrap; }
.nav a {
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.92rem;
  padding: 8px 12px; border-radius: 6px;
}
.nav a:hover { background: var(--panel); color: var(--ink); }

/* ----- Hero ---------------------------------------------------------------- */
.hero { padding: 72px 0 56px; text-align: center; border-bottom: 1px solid var(--line); }
.hero-inner { max-width: 680px; }
.kicker { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brand-ink); margin-bottom: 14px; }
.lede { font-size: 1.12rem; color: var(--text); margin: 0 auto 28px; max-width: 58ch; }
.join { display: flex; gap: 10px; max-width: 520px; margin: 0 auto; }
.join input[type="email"] { flex: 1; min-width: 0; padding: 13px 14px; }
.join .btn { padding: 13px 20px; }
.hero .form-status { text-align: center; }
.fine { font-size: 0.82rem; color: var(--muted); margin: 10px 0 0; }

/* ----- Sections ------------------------------------------------------------ */
.section { padding: 56px 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; font-size: 0.92rem; }

.meta { font-size: 0.82rem; color: var(--muted); margin: 0; }
.meta .dot { margin: 0 6px; }

/* Post cards (featured posts grid) */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px 24px; }
.card { display: flex; flex-direction: column; min-width: 0; }
.card-media { aspect-ratio: 16 / 9; background: var(--panel); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); margin-bottom: 16px; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card h3 { font-size: 1.12rem; margin: 6px 0 8px; }
.card h3 button {
  all: unset; cursor: pointer; color: var(--ink);
}
.card h3 button:hover { text-decoration: underline; text-underline-offset: 3px; }
.card h3 button:focus-visible { outline: 3px solid #ffd3a3; outline-offset: 2px; }
.card .excerpt { font-size: 0.95rem; color: var(--text); margin: 0 0 14px; flex: 1; }
.author { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #111827;
  display: grid; place-items: center; font-size: 0.72rem; font-weight: 800; flex: 0 0 auto;
}
.badge { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); margin-right: 6px; }

/* Pagination */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 40px; flex-wrap: wrap; }
.pager button {
  min-width: 36px; height: 36px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: 600 0.9rem "Open Sans", system-ui, sans-serif; cursor: pointer;
}
.pager button:hover:not(:disabled) { border-color: var(--brand); }
.pager button[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.pager button:disabled { opacity: 0.4; cursor: default; }
.pager .gap { color: var(--muted); padding: 0 4px; }

/* Media grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.media-tile { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.media-tile img, .media-tile video { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--panel); }
.media-tile figcaption { padding: 9px 12px; font-size: 0.85rem; color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Files */
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.file-item {
  display: flex; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; background: #fff;
}
.file-icon {
  flex: 0 0 44px; height: 44px; border-radius: 6px; background: #fff3e4; color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 0.7rem; letter-spacing: 0.04em;
}
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { font-size: 0.82rem; color: var(--muted); }

/* About */
.about-body { max-width: 720px; }
.services-list { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; max-width: 720px; }
.services-list li { padding: 12px 16px; border-left: 3px solid var(--brand); background: var(--panel); border-radius: 0 6px 6px 0; }

/* Contact */
.contact { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 40px; align-items: start; }
.contact-info h2 { margin-bottom: 16px; }
.contact-info p { margin: 0 0 12px; }
.contact-info a { color: var(--ink); font-weight: 600; }
.contact-form { border: 1px solid var(--line); padding: 24px; border-radius: var(--radius); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.contact-form .btn { margin-top: 4px; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 32px 0 40px; margin-top: 24px; background: var(--panel); }
.footer-inner { display: grid; gap: 16px; justify-items: center; text-align: center; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 20px; }
.footer-nav a { color: var(--ink); font-weight: 600; font-size: 0.92rem; text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; }
.footer .fine { margin: 0; }

/* Reader dialog */
.reader {
  width: min(720px, calc(100% - 24px)); max-height: calc(100vh - 48px); padding: 0; border: 0;
  border-radius: 10px; box-shadow: 0 24px 60px rgba(17, 24, 39, 0.3); overflow: hidden;
  background: #fff; color: var(--text);
}
.reader::backdrop { background: rgba(17, 24, 39, 0.5); }
.reader-bar { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); z-index: 1; }
.reader-body { padding: 24px 28px 32px; overflow-y: auto; max-height: calc(100vh - 100px); }
.reader-body h2 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); font-weight: 800; margin-top: 4px; }
.reader-body p { font-size: 1.02rem; }
.reader-body .cover { border-radius: 8px; margin: 0 0 16px; width: 100%; }
.reader-body video { width: 100%; border-radius: 8px; margin: 0 0 16px; background: #000; }
.reader-body .attachments { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.reader-body .attachments h3 { margin-bottom: 12px; }

/* ----- Responsive ---------------------------------------------------------- */
@media (max-width: 960px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar-inner, .masthead-inner { flex-wrap: wrap; padding: 12px 0; gap: 10px; }
  .nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .topbar .btn, .masthead .btn { margin-left: auto; }
  .hero { padding: 48px 0 40px; }
  .join { flex-direction: column; }
  .join .btn { width: 100%; }
  .card-grid { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .file-item { flex-wrap: wrap; }
  .file-item .btn { width: 100%; }
  .reader-body { padding: 20px 18px 28px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ----- Admin console ------------------------------------------------------- */
.admin-main { padding: 32px 0 60px; display: grid; gap: 24px; }
.admin .masthead-inner { gap: 16px; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.panel.login { max-width: 460px; margin: 40px auto; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.small { font-size: 0.85rem; }
.right { text-align: right; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.upload-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.upload-row input[type="file"] { flex: 1; min-width: 220px; font: inherit; }
.progress { height: 8px; background: #edf1f6; border-radius: 999px; overflow: hidden; margin: 14px 0 4px; }
.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width 0.2s ease; }
.fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.fieldset legend { font-size: 0.82rem; font-weight: 600; color: var(--ink); padding: 0 6px; }
.check-list { display: grid; gap: 8px; max-height: 220px; overflow-y: auto; }
.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 0.93rem; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: #fafbfd; }
.table tr:last-child td { border-bottom: 0; }
.table td { color: var(--ink); }
.table td:first-child { word-break: break-word; }
.btn.danger { color: #b42318; border-color: #f2c4bf; }
.pill { display: inline-block; font-size: 0.75rem; font-weight: 700; text-transform: capitalize; padding: 4px 10px; border-radius: 999px; background: #eef2f7; color: var(--ink); }
.pill.published { background: #e3f6ec; color: #067647; }
.pill.draft { background: #fff3e4; color: var(--brand-ink); }
.msg-list { display: grid; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.msg header { font-size: 0.92rem; color: var(--ink); margin-bottom: 6px; }
.msg p { margin: 0; white-space: pre-wrap; }
code { background: #eef2f7; padding: 2px 6px; border-radius: 6px; font-size: 0.88em; }
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
}

/* ----- Server-rendered pages ------------------------------------------------ */
.form-wrap { max-width: 520px; margin: 0 auto; width: 100%; }
.hero .form-wrap { text-align: center; }
.hero .form-status { text-align: center; min-height: 1.4em; margin-top: 10px; }
.see-all { margin: 28px 0 0; text-align: center; }
.see-all a, .section-head p a { font-weight: 700; color: var(--brand-ink); text-decoration: none; }
.see-all a:hover, .section-head p a:hover { text-decoration: underline; }
.page-top { padding-top: 56px; }
.page-title { font-size: clamp(2rem, 4.5vw, 2.6rem); font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.section-head .page-title { flex: 1 1 auto; }
.card-media { display: block; text-decoration: none; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.video-tile {
  width: 100%; height: 100%; display: grid; place-items: center; font-weight: 700;
  color: var(--ink); background: linear-gradient(135deg, #fff3e4, #f3f4f6);
}
.card h3 { margin: 6px 0 8px; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.card .meta .badge { margin-left: 6px; }

.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 40px; flex-wrap: wrap; }
.pg {
  min-width: 36px; height: 36px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: 600 0.9rem "Open Sans", system-ui, sans-serif;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
a.pg:hover { border-color: var(--brand); }
.pg.is-current { background: var(--ink); border-color: var(--ink); color: #fff; }
.pg.is-disabled { opacity: 0.4; }
.pager .gap { color: var(--muted); padding: 0 4px; }

.breadcrumb { font-size: 0.85rem; color: var(--muted); margin: 40px 0 18px; }
.breadcrumb a { color: var(--muted); }
.issue { max-width: 720px; padding-bottom: 8px; }
.issue-head h1 { font-size: clamp(2rem, 4.8vw, 2.9rem); font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 14px; }
.issue-lede { font-size: 1.1rem; margin-bottom: 16px; }
.issue-head .author { margin-bottom: 28px; }
.issue-cover, .issue-video { width: 100%; border-radius: 8px; border: 1px solid var(--line); margin: 0 0 28px; background: var(--panel); }
.issue-body p { font-size: 1.08rem; line-height: 1.75; }
.attachments { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); }
.attachments h2 { font-size: 1.25rem; margin-bottom: 14px; }
.back-link { text-align: center; margin: 24px auto 56px; }
.back-link a { font-weight: 700; color: var(--brand-ink); }
.cta-box {
  text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 36px 24px; margin-top: 40px; max-width: 720px;
}
.cta-box .join { margin-bottom: 0; }
.cta-box .form-status { text-align: center; }
.cta-box .fine { margin-bottom: 0; }

.prose { max-width: 720px; }
.prose h2 { font-size: 1.3rem; margin-top: 28px; }
.prose p, .prose li { font-size: 1.02rem; }
.prose ul { padding-left: 20px; }
.prose ul li { margin-bottom: 8px; }
.cta-line { margin-top: 28px; }
.cta-line a { font-weight: 700; color: var(--brand-ink); }
.empty { padding: 16px 0; }
