/* ============================================================
   styles.css - Main Stylesheet
   Nguyen Thanh Trung lawyer newspaper site
   ============================================================ */

@import 'tokens.css';


/* Reset */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

img, picture, video {
  height: auto;
}

button, input, select, textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

ul, ol {
  list-style-position: inside;
}


/* Base typography */

body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--color-text);
  background: var(--color-surface-muted);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

a {
  color: var(--color-link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

code, pre, kbd {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}


/* Homepage */

.site-masthead {
  background: var(--color-brand-dark);
  color: var(--color-surface);
}

.masthead-inner {
  max-width: var(--container);
  min-height: 140px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  text-align: center;
}

.brand-seal {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  font-family: var(--font-heading);
  font-weight: 700;
}

.site-masthead h1,
.masthead-lawyer-name {
  color: var(--color-surface);
  font-size: var(--text-3xl);
  text-transform: uppercase;
  margin: 0;
  font-weight: 700;
}

.site-masthead p {
  margin-top: var(--space-2);
  color: rgba(255, 255, 255, .78);
  font-family: var(--font-heading);
  font-size: var(--text-md);
  font-style: italic;
}

.site-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  max-width: var(--container);
  margin: 0 auto;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  overflow-x: auto;
  padding: 0 var(--space-4);
  border-bottom: 3px solid var(--color-brand-dark);
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.site-topbar a {
  color: var(--color-text);
}

.site-topbar a:hover,
.site-topbar .active {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 5px;
}

.nav-search {
  margin-left: auto;
}

.home-page {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-7);
  background: var(--color-surface);
}

.empty-state {
  padding: var(--space-7) var(--space-4);
  border: 1px solid var(--color-border);
  background: var(--color-surface-muted);
  text-align: center;
}

.lead-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 260px;
  gap: var(--space-5);
  align-items: start;
}

.ribbon {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: var(--space-3);
  padding: 0 var(--space-4);
  background: var(--color-accent);
  color: var(--color-surface);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.story img,
.mini-story img,
.main-story img,
.poster img,
.video-card img {
  width: 100%;
  object-fit: cover;
  background: var(--color-surface-muted);
}

.story-feature img {
  aspect-ratio: 16 / 9;
}

.story h2,
.main-story h2 {
  margin-top: var(--space-3);
  font-size: var(--text-xl);
}

.story h3,
.link-list a,
.popular a,
.form-card h3,
.video-card h3 {
  font-size: var(--text-base);
  font-weight: 700;
  line-height: var(--leading-tight);
}

.story p,
.main-story p,
.form-card p {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.mini-story {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
}

.mini-story img {
  aspect-ratio: 4 / 3;
}

.mini-story h3 {
  font-size: var(--text-sm);
  font-family: var(--font-ui);
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.subnav a {
  padding: 5px 9px;
  border: 1px solid var(--color-border-light);
  background: var(--color-surface-muted);
  color: var(--color-text);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
}

.main-story img {
  aspect-ratio: 16 / 9;
}

.story-meta {
  margin-top: var(--space-3);
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
}

.main-story h2 {
  max-width: 680px;
  font-size: clamp(28px, 4vw, 44px);
}

.popular ol {
  list-style: none;
  counter-reset: popular;
}

.popular li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-light);
  counter-increment: popular;
}

.popular li::before {
  content: counter(popular);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--color-brand-dark);
  color: var(--color-surface);
  font-weight: 700;
}

.section-block {
  margin-top: var(--space-7);
  border-top: 2px solid var(--color-brand-dark);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin: 0 0 var(--space-5);
  transform: translateY(-50%);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  text-transform: uppercase;
}

.section-title span {
  padding: var(--space-1) var(--space-4);
  background: var(--color-brand-dark);
  color: var(--color-surface);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
}

.section-title a {
  background: var(--color-surface);
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: 700;
}

.section-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 260px;
  gap: var(--space-5);
}

.side-column {
  display: grid;
  gap: var(--space-4);
}

.side-column img {
  aspect-ratio: 16 / 10;
}

.side-column h3 {
  margin-top: var(--space-2);
}

.poster {
  position: relative;
  min-height: 340px;
  overflow: hidden;
  background: var(--color-brand-dark);
}

.poster img {
  height: 100%;
  min-height: 340px;
}

.poster::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 58%;
  background: linear-gradient(transparent, rgba(0, 0, 0, .82));
}

.poster h3 {
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 1;
  font-size: var(--text-xl);
}

.poster h3 a {
  color: var(--color-surface);
}

.link-list {
  display: grid;
  align-content: start;
}

.link-list a {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text);
}

.form-grid,
.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.form-card {
  padding: var(--space-4);
  border: 1px solid var(--color-border-light);
  background: var(--color-surface-muted);
}

.file-badge,
.download-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 var(--space-3);
  background: var(--color-accent);
  color: var(--color-surface);
  font-size: var(--text-xs);
  font-weight: 700;
}

.form-card h3 {
  margin-top: var(--space-3);
}

.download-link {
  margin-top: var(--space-3);
  background: var(--color-brand-dark);
}

.video-card a {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--color-brand-dark);
}

.video-card img {
  aspect-ratio: 16 / 9;
}

.play-icon {
  position: absolute;
  left: var(--space-3);
  bottom: var(--space-3);
  padding: 4px 8px;
  background: rgba(0, 0, 0, .76);
  color: var(--color-surface);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
}

.video-card h3 {
  margin-top: var(--space-2);
}

.lawyer-strip {
  margin-top: var(--space-7);
  padding: var(--space-4);
  border-block: 2px solid var(--color-brand-dark);
  background: var(--color-surface-muted);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-style: italic;
  text-align: center;
}

.site-masthead.compact .masthead-inner {
  min-height: 120px;
}

.public-page,
.article-page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}

.page-heading {
  border-bottom: 3px solid var(--color-brand-dark);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
}

.page-heading p {
  margin: 0 0 var(--space-2);
  color: var(--color-accent);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 800;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
}

.content-panel {
  width: min(var(--container-article), 100%);
  display: grid;
  gap: var(--space-4);
  font-size: var(--text-lg);
  line-height: var(--leading-article);
}

.archive-list {
  display: grid;
  gap: var(--space-4);
}

.archive-item {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  padding-bottom: var(--space-4);
}

.archive-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.archive-item h2 {
  margin: var(--space-1) 0 var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
}

.archive-item p,
.video-card p {
  color: var(--color-text-muted);
}

.archive-grid {
  margin-top: var(--space-4);
}

.article-detail {
  width: min(var(--container-article), 100%);
  margin: 0 auto;
}

.article-detail h1 {
  margin: var(--space-2) 0 var(--space-3);
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  line-height: 1.12;
}

.article-excerpt {
  color: var(--color-text-muted);
  font-size: var(--text-xl);
  line-height: 1.55;
}

.article-cover {
  width: 100%;
  max-height: 460px;
  margin: var(--space-5) 0;
  object-fit: cover;
}

.article-body {
  font-size: var(--text-lg);
  line-height: var(--leading-article);
  overflow-wrap: break-word;
  word-break: break-word;
}

.article-body pre {
  overflow-x: auto;
}

.article-body table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

.article-body img {
  max-width: 100%;
  height: auto;
}

.article-body h2 {
  margin-top: var(--space-6);
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.article-tags span {
  border: 1px solid var(--color-border-light);
  padding: 4px 8px;
  background: var(--color-surface-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.search-panel input {
  border: 1px solid var(--color-border);
  padding: 12px 14px;
  font-size: var(--text-base);
}

.search-panel button {
  border: 0;
  padding: 0 var(--space-5);
  background: var(--color-brand-dark);
  color: var(--color-surface);
  font-weight: 800;
}

.search-summary {
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
}

.site-footer {
  background: var(--color-brand-dark);
  color: var(--color-surface);
}

.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: var(--space-6);
  align-items: start;
}

.brand-mark {
  display: grid;
  gap: var(--space-2);
}

.brand-mark strong {
  font-size: var(--text-lg);
}

address {
  display: grid;
  gap: var(--space-2);
  color: rgba(255, 255, 255, .8);
  font-style: normal;
}

.footer-note {
  padding: var(--space-4);
  border: 1px solid rgba(255, 255, 255, .18);
}

.footer-note p {
  margin-top: var(--space-2);
  color: rgba(255, 255, 255, .76);
}

.error-masthead .masthead-inner {
  min-height: 120px;
}

.error-page {
  min-height: calc(100vh - 120px);
  padding: var(--space-7) var(--space-4);
  background: var(--color-surface-muted);
}

.error-panel {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-6);
  border: 1px solid var(--color-border-light);
  background: var(--color-surface);
}

.error-code {
  color: var(--color-accent);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.error-panel h2 {
  margin-top: var(--space-2);
  font-size: var(--text-2xl);
}

.error-message {
  margin-top: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-md);
}

.error-intro {
  margin-top: var(--space-5);
  padding: var(--space-4);
  border-left: 4px solid var(--color-accent);
  background: var(--color-surface-muted);
}

.error-intro p {
  margin-top: var(--space-2);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.error-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--space-4);
  background: var(--color-brand-dark);
  color: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 700;
}


/* Admin CMS */

.admin-body {
  background: var(--admin-bg);
}

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-4);
}

.admin-card {
  border: 1px solid var(--color-border-light);
  background: var(--color-surface);
  padding: var(--space-5);
}

.login-card {
  width: min(420px, 100%);
}

.login-card h1,
.admin-main h1,
.admin-card h2 {
  font-family: var(--font-ui);
}

.login-card p {
  margin: var(--space-2) 0 var(--space-4);
  color: var(--color-text-muted);
}

.admin-demo-login {
  display: grid;
  gap: 4px;
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--color-border-light);
  background: var(--color-surface-muted);
  font-size: var(--text-sm);
}

.admin-demo-login span {
  color: var(--color-text-muted);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--admin-sidebar-width) minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--admin-sidebar-bg);
  color: var(--color-surface);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  flex-shrink: 0;
}

.admin-brand-seal {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--color-accent);
  color: #fff;
  font-weight: 800;
  font-size: var(--text-xs);
  flex-shrink: 0;
}

.admin-brand span {
  font-weight: 700;
  font-size: var(--text-base);
  color: #fff;
}

.admin-nav {
  flex: 1;
  padding: var(--space-3) 0;
  overflow-y: auto;
}

.sidebar-group {
  margin-bottom: var(--space-3);
}

.sidebar-group-label {
  display: block;
  padding: 0 var(--space-3) var(--space-1);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .38);
}

.admin-sidebar a,
.admin-sidebar-footer button {
  width: 100%;
  display: block;
  border: 0;
  border-left: 3px solid transparent;
  padding: 9px 12px;
  background: transparent;
  color: var(--admin-sidebar-text);
  text-align: left;
  font-size: var(--text-sm);
  font-weight: 600;
}

.admin-sidebar a.active {
  border-left-color: var(--color-accent);
  padding-left: 9px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  text-decoration: none;
}

.admin-sidebar a:hover,
.admin-sidebar-footer button:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
  text-decoration: none;
}

.admin-sidebar-footer {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid rgba(255, 255, 255, .1);
  display: grid;
  gap: var(--space-2);
}

.admin-user-email {
  display: block;
  font-size: 11px;
  color: rgba(255, 255, 255, .45);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-view-site {
  display: block;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, .6) !important;
  padding: 4px 0 !important;
  border-left: none !important;
  background: none !important;
}

.admin-sidebar-footer form {
  margin: 0;
}

.admin-main {
  padding: var(--space-6);
}

.admin-mobile-bar {
  display: none;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--admin-sidebar-bg);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-mobile-bar span {
  font-weight: 700;
  font-size: var(--text-base);
}

.admin-nav-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid rgba(255, 255, 255, .3);
  background: transparent;
  color: #fff;
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
}

.admin-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 149;
  background: rgba(0, 0, 0, .45);
}

.admin-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.admin-button,
.admin-form button,
.login-card button,
.admin-actions button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 0;
  padding: 0 var(--space-4);
  background: var(--color-brand-dark);
  color: var(--color-surface);
  font-weight: 700;
}

.admin-button.secondary {
  background: var(--color-text-muted);
}

.admin-alert {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--color-border);
  background: var(--color-surface);
}

.admin-alert.ok {
  border-left-color: #2f7d32;
}

.admin-alert.error {
  border-left-color: var(--color-accent);
}

.admin-alert.key {
  border-left-color: #1565c0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-wrap: anywhere;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.admin-stats div {
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
}

.admin-stats strong {
  display: block;
  font-size: var(--text-2xl);
}

.admin-stats span,
.admin-table small {
  color: var(--color-text-muted);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--color-border-light);
  padding: var(--space-3);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  background: var(--color-surface-muted);
  font-weight: 700;
}

.admin-table a {
  font-weight: 700;
}

.admin-thumb {
  display: block;
  width: 88px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--color-border-light);
  background: var(--color-surface-muted);
}

.status-pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border-light);
  font-size: var(--text-xs);
  font-weight: 700;
}

.status-pill.published {
  background: var(--status-published-bg);
  color: var(--status-published-text);
  border-color: var(--status-published-border);
}

.status-pill.draft {
  background: var(--status-draft-bg);
  color: var(--status-draft-text);
  border-color: var(--status-draft-border);
}

.status-pill.scheduled {
  background: var(--status-scheduled-bg);
  color: var(--status-scheduled-text);
  border-color: var(--status-scheduled-border);
}

.status-pill.active {
  background: var(--status-active-bg);
  color: var(--status-active-text);
  border-color: var(--status-active-border);
}

.status-pill.inactive {
  background: var(--status-inactive-bg);
  color: var(--status-inactive-text);
  border-color: var(--status-inactive-border);
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.admin-actions form {
  display: inline;
}

.admin-actions button,
.admin-actions a {
  min-height: 28px;
  padding: 4px 8px;
  font-size: var(--text-xs);
}

.admin-actions button.danger {
  background: var(--color-accent);
}

.admin-form {
  display: grid;
  gap: var(--space-4);
}

.admin-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  align-items: end;
}

.admin-form label,
.admin-filters label,
.login-card label {
  display: grid;
  gap: var(--space-2);
  font-weight: 700;
}

.admin-form input,
.admin-form select,
.admin-form textarea,
.admin-filters input,
.admin-filters select,
.login-card input {
  width: 100%;
  border: 1px solid var(--color-border);
  padding: 10px 12px;
  background: var(--color-surface);
  color: var(--color-text);
}

.admin-filters button {
  min-height: 40px;
  border: 0;
  padding: 0 var(--space-4);
  background: var(--color-brand-dark);
  color: var(--color-surface);
  font-weight: 700;
}

.admin-fieldset {
  border: 1px solid var(--color-border-light);
  padding: var(--space-4);
}

.admin-fieldset legend {
  padding: 0 var(--space-2);
  font-weight: 700;
}

.admin-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.admin-check-grid label,
.check-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
}

.admin-check-grid input,
.check-label input {
  width: auto;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

/* Stat cards */

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.stat-card {
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-top: 3px solid var(--color-border-light);
}

.stat-card.stat-total { border-top-color: var(--color-accent); }
.stat-card.stat-published { border-top-color: var(--status-published-text); }
.stat-card.stat-draft { border-top-color: var(--color-text-muted); }
.stat-card.stat-forms { border-top-color: var(--status-active-text); }
.stat-card.stat-videos { border-top-color: var(--status-scheduled-text); }

.stat-card strong {
  display: block;
  font-size: var(--text-2xl);
  line-height: 1;
  margin-bottom: var(--space-1);
}

.stat-card span {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}


/* Quick actions */

.admin-quick-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}

.quick-action {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 var(--space-4);
  border: 1px dashed var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
  font-weight: 700;
  transition: background .12s, border-color .12s, color .12s;
}

.quick-action:hover {
  border-color: var(--color-brand-dark);
  background: var(--color-brand-dark);
  color: #fff;
  text-decoration: none;
}


/* Table responsive wrap */

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table .col-desc {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* Form helpers */

.form-hint {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 400;
}


/* Sticky save bar */

.admin-sticky-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, .06);
  margin-top: var(--space-5);
  margin-left: calc(-1 * var(--space-5));
  margin-right: calc(-1 * var(--space-5));
  margin-bottom: calc(-1 * var(--space-6));
}

.save-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}


/* Media grid */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}

.media-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--color-border-light);
  background: var(--color-surface-muted);
  display: block;
}

.media-info {
  padding: var(--space-2) var(--space-1);
  font-size: 11px;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-info small {
  display: block;
  color: var(--color-text-muted);
}

.media-item-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: var(--color-surface-muted);
  border: 1px solid var(--color-border-light);
  color: var(--color-text-muted);
  font-size: var(--text-xl);
}


@media (max-width: 900px) {
  /* Sidebar: hidden by default, slides in as overlay */
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 150;
    width: 260px;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform .22s ease;
    overflow-y: auto;
  }

  .admin-shell.nav-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-shell.nav-open .admin-overlay {
    display: block;
  }

  .admin-mobile-bar {
    display: flex;
  }

  .admin-main {
    padding: var(--space-4);
  }

  /* Stats: 3 columns then wrap naturally */
  .admin-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Filters: 2 columns instead of jumping to 1 */
  .admin-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Checks: 2 columns */
  .admin-check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Form grids */
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  /* Sticky bar: align margins to reduced padding */
  .admin-sticky-bar {
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    margin-bottom: calc(-1 * var(--space-4));
  }
}

@media (max-width: 1023px) {
  .lead-layout,
  .section-layout,
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }

  /* footer-note always spans full width in footer */
  .footer-note {
    grid-column: span 2;
  }

  /* lead-layout: news-stack + hero-feed side by side (1fr each), popular full width */
  .popular {
    grid-column: span 2;
  }

  /* section-layout: side-column + poster side by side (1fr each), link-list full width */
  .link-list {
    grid-column: span 2;
  }

  /* Form/video grids: 2-col on tablet instead of jumping to 1 */
  .form-grid,
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .masthead-inner {
    min-height: 112px;
  }

  .brand-seal {
    display: none;
  }

  .site-masthead h1,
  .masthead-lawyer-name {
    font-size: var(--text-xl);
  }

  .site-topbar {
    justify-content: flex-start;
  }

  .home-page {
    padding-inline: var(--space-3);
  }

  .lead-layout,
  .section-layout,
  .form-grid,
  .video-grid,
  .archive-item,
  .search-panel,
  .footer-inner {
    grid-template-columns: 1fr;
  }

  .hero-feed,
  .poster,
  .popular,
  .footer-note,
  .link-list {
    grid-column: auto;
  }

  .main-story h2 {
    font-size: var(--text-2xl);
  }

  .section-title {
    transform: none;
    margin-top: var(--space-3);
    align-items: flex-start;
  }

  .poster,
  .poster img {
    min-height: 260px;
  }

  .page-heading h1,
  .article-detail h1 {
    font-size: var(--text-3xl);
  }
}

/* =====================================================
   Article page v2 — TOC sidebar, hero, progress bar
   ===================================================== */

.article-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--color-accent, #c79857);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.1s linear;
  z-index: 100;
  pointer-events: none;
}

.article-page-v2 {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-8);
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.article-layout.has-toc {
  grid-template-columns: 260px minmax(0, 1fr);
}

.article-page-v2 .article-detail {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.article-layout.has-toc .article-detail {
  margin: 0;
}

.article-layout:not(.has-toc) .article-toc {
  display: none;
}

.article-toc {
  position: sticky;
  top: calc(var(--space-5));
  max-height: calc(100vh - var(--space-6));
  overflow: hidden;
}

.article-toc-inner {
  border-left: 3px solid var(--color-brand-dark, #1a3a52);
  padding: var(--space-2) 0 var(--space-2) var(--space-3);
  max-height: calc(100vh - var(--space-7));
  overflow-y: auto;
}

.article-toc-title {
  margin: 0 0 var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
}

.article-toc-nav .toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.article-toc-nav .toc-item a {
  display: block;
  padding: 4px 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.45;
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -2px;
  padding-left: var(--space-2);
  transition: color 0.15s, border-color 0.15s, transform 0.15s;
}

.article-toc-nav .toc-item.toc-h3 a {
  padding-left: calc(var(--space-2) + 12px);
  font-size: 13px;
}

.article-toc-nav .toc-item a:hover {
  color: var(--color-brand-dark);
}

.article-toc-nav .toc-item a.active {
  color: var(--color-brand-dark);
  font-weight: 700;
  border-left-color: var(--color-accent);
}

.article-toc-mobile {
  display: none;
  margin: var(--space-4) 0;
  border: 1px solid var(--color-border-light);
  border-radius: 4px;
  background: var(--color-surface-muted);
}

.article-toc-mobile > summary {
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-brand-dark);
}

.article-toc-mobile[open] > summary {
  border-bottom: 1px solid var(--color-border-light);
}

.article-toc-mobile .article-toc-nav {
  padding: var(--space-2) var(--space-3);
}

.article-hero {
  margin-bottom: var(--space-5);
}

.article-category-pill {
  display: inline-block;
  padding: 4px 12px;
  background: var(--color-accent, #c79857);
  color: #fff;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  border-radius: 2px;
  margin-bottom: var(--space-3);
}

.article-category-pill:hover {
  filter: brightness(1.08);
}

.article-page-v2 .article-detail h1 {
  margin: var(--space-2) 0 var(--space-3);
  font-family: var(--font-heading);
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.article-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: var(--space-3) 0 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.article-meta-author {
  font-weight: 700;
  color: var(--color-text);
}

.article-meta-sep {
  opacity: 0.5;
}

.article-page-v2 .article-cover {
  width: 100%;
  max-height: 480px;
  margin: var(--space-5) 0 0;
  object-fit: cover;
  border-radius: 4px;
}

.article-page-v2 .article-body {
  font-size: var(--text-lg);
  line-height: var(--leading-article, 1.7);
}

.article-page-v2 .article-body > p:first-of-type::first-letter {
  font-family: var(--font-heading);
  font-size: 3.2em;
  float: left;
  line-height: 0.9;
  padding: 6px 10px 0 0;
  color: var(--color-brand-dark);
}

.article-page-v2 .article-body h2 {
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  scroll-margin-top: 80px;
}

.article-page-v2 .article-body h3 {
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  scroll-margin-top: 80px;
}

.article-page-v2 .article-body blockquote {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--color-accent);
  background: var(--color-surface-muted);
  font-style: italic;
  color: var(--color-text);
}

.article-page-v2 .article-body img {
  max-width: 100%;
  height: auto;
  margin: var(--space-3) auto;
  display: block;
  border-radius: 4px;
}

.article-page-v2 .article-body a {
  color: var(--color-brand-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article-page-v2 .article-body a:hover {
  color: var(--color-accent);
}

.back-to-top {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--color-brand-dark);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-accent);
}

@media (max-width: 980px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
  .article-toc {
    display: none;
  }
  .article-toc-mobile {
    display: block;
  }
  .article-page-v2 .article-body > p:first-of-type::first-letter {
    font-size: 2.6em;
  }
}
