/* ==========================================================================
   LawSaathi — editorial design system
   Original palette/type for lawsaathi.com. Not derived from any other outlet.
   ========================================================================== */

:root {
  /* core palette */
  --ink:        #16202c;
  --ink-soft:   #384453;
  --muted:      #5b6472;
  --paper:      #f7f4ec;
  --paper-raised: #ffffff;
  --rule:       #dcd5c3;
  --rule-soft:  #ece7d8;
  --brand:      #7a1f2b;   /* masthead oxblood */
  --brand-dark: #4f1119;
  --brand-tint: #f4e6e4;
  --link:       #7a1f2b;
  --focus:      #1f6f5c;

  /* category color-coding */
  --cat-supreme-court:   #7a1f2b;
  --cat-high-courts:     #1f6f5c;
  --cat-legislation:     #4a3b7a;
  --cat-legal-ed:        #b3661a;
  --cat-tribunals:       #2c5f8a;
  --cat-civil-consumer:  #6a6f1f;
  --cat-criminal-law:    #8a3a1f;
  --cat-other:           #5b6472;

  --radius: 3px;
  --shadow-1: 0 1px 2px rgba(22,32,44,0.06), 0 1px 1px rgba(22,32,44,0.04);
  --shadow-2: 0 4px 16px rgba(22,32,44,0.10);
  --container: 1160px;
}

[data-theme="dark"] {
  --ink: #ece7da; --ink-soft: #cfc9ba; --muted: #a19b8c;
  --paper: #14110d; --paper-raised: #1c1813; --rule: #3a3428; --rule-soft: #26221b;
  --brand: #e0a3a3; --brand-dark: #f2c9c9; --brand-tint: #2a1414; --link: #e0a3a3; --focus: #7fd4bd;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ece7da; --ink-soft: #cfc9ba; --muted: #a19b8c;
    --paper: #14110d; --paper-raised: #1c1813; --rule: #3a3428; --rule-soft: #26221b;
    --brand: #e0a3a3; --brand-dark: #f2c9c9; --brand-tint: #2a1414; --link: #e0a3a3; --focus: #7fd4bd;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Source Sans 3", -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1, h2, h3, h4, .headline-font {
  font-family: "Lora", Georgia, "Times New Roman", serif;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.18;
  margin: 0 0 .4em;
}

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.rule { border: none; border-top: 1px solid var(--rule); margin: 0; }

/* ---------- masthead / nav ---------- */
.topbar {
  background: var(--ink); color: #efe9db; font-size: 13px;
}
.topbar .container { display: flex; justify-content: space-between; align-items: center; height: 34px; }
.topbar a { color: #efe9db; opacity: .85; }
.topbar a:hover { opacity: 1; }
.topbar-date { opacity: .7; }

.masthead { background: var(--paper-raised); border-bottom: 3px solid var(--ink); }
.masthead .container { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 14px; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { flex: none; }
.brand-name { font-family: "Lora", serif; font-weight: 700; font-size: 30px; letter-spacing: -0.01em; color: var(--ink); }
.brand-tagline { display: block; font-family: "Source Sans 3", sans-serif; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-top: 1px; }

.search-form { display: flex; align-items: center; gap: 6px; }
.search-form input[type="search"] {
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  padding: 8px 10px; border-radius: var(--radius); font-size: 14px; min-width: 190px;
}
.search-form button {
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  padding: 8px 12px; border-radius: var(--radius); font-size: 14px; cursor: pointer;
}

nav.primary-nav { background: var(--ink); }
nav.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
nav.primary-nav a {
  display: block; color: #efe9db; padding: 11px 16px; font-size: 14.5px; font-weight: 600;
  letter-spacing: .01em; border-right: 1px solid rgba(239,233,219,.12);
}
nav.primary-nav a:hover { background: rgba(239,233,219,.08); text-decoration: none; }

/* mobile nav toggle */
.nav-toggle { display: none; }
@media (max-width: 720px) {
  .nav-toggle {
    display: block; background: var(--ink); color: #efe9db; border: none; width: 100%;
    text-align: left; padding: 10px 20px; font-size: 14px; font-weight: 700; cursor: pointer;
  }
  nav.primary-nav ul { flex-direction: column; display: none; }
  nav.primary-nav.open ul { display: flex; }
  nav.primary-nav a { border-right: none; border-bottom: 1px solid rgba(239,233,219,.12); }
}

/* ---------- category chip ---------- */
.chip {
  display: inline-block; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; color: #fff; white-space: nowrap;
}

/* ---------- layout grids ---------- */
.page-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; padding: 32px 0 56px; }
@media (max-width: 900px) { .page-grid { grid-template-columns: 1fr; } }

.top-stories { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; padding: 28px 0; border-bottom: 1px solid var(--rule); }
@media (max-width: 800px) { .top-stories { grid-template-columns: 1fr; } }

.lead-story {
  position: relative; overflow: hidden; background: var(--paper-raised);
  border: 1px solid var(--rule); border-top: 4px solid var(--brand);
  padding: 26px 26px 34px; box-shadow: var(--shadow-1);
}
.lead-story .chip { margin-bottom: 10px; }
.lead-story h2 { font-size: 32px; position: relative; z-index: 1; }
.lead-story p.dek { color: var(--ink-soft); font-size: 17px; margin: 10px 0 0; position: relative; z-index: 1; max-width: 90%; }
.lead-story .byline-line { position: relative; z-index: 1; }
.lead-decor { position: absolute; right: -18px; bottom: -24px; width: 190px; height: 190px; opacity: .05; pointer-events: none; color: var(--ink); }
.secondary-stories { display: flex; flex-direction: column; gap: 0; }
.secondary-stories .story-row { padding: 0 0 16px; margin-bottom: 16px; border-bottom: 1px solid var(--rule-soft); }
.secondary-stories .story-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.secondary-stories .story-row h3 { font-size: 17.5px; margin-bottom: 4px; }

.category-rail { padding: 26px 0; border-bottom: 1px solid var(--rule); }
.category-rail-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.category-rail-head h2 { font-size: 20px; margin: 0; }
.category-rail-head a { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.rail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 800px) { .rail-grid { grid-template-columns: 1fr; } }

.story-card h3 { font-size: 18px; margin: 8px 0 6px; }
.story-card .dek, .story-row .dek { color: var(--muted); font-size: 14.5px; margin: 0; }
.byline-line { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.byline-line .sep { margin: 0 6px; }

/* ---------- sidebar ---------- */
.sidebar-box { background: var(--paper-raised); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.sidebar-box h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 12px; }
.sidebar-list { list-style: none; margin: 0; padding: 0; }
.sidebar-list li { padding: 9px 0; border-bottom: 1px solid var(--rule-soft); font-size: 14.5px; }
.sidebar-list li:last-child { border-bottom: none; }

.newsletter-box { background: var(--brand-tint); border: 1px solid var(--brand); }
.newsletter-box p { font-size: 13.5px; color: var(--ink-soft); margin: 0 0 12px; }
.newsletter-box form { display: flex; flex-direction: column; gap: 8px; }
.newsletter-box input[type="email"] { padding: 9px 10px; border: 1px solid var(--rule); border-radius: var(--radius); font-size: 14px; }
.btn {
  display: inline-block; background: var(--brand); color: #fff; border: none; padding: 10px 14px;
  border-radius: var(--radius); font-weight: 700; font-size: 14px; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn-outline { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.form-note { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- article page ---------- */
.article-head { padding: 30px 0 18px; border-bottom: 1px solid var(--rule); max-width: 760px; margin: 0 auto; }
.article-head h1 { font-size: 38px; margin: 10px 0 12px; }
.article-head .dek { font-size: 19px; color: var(--ink-soft); font-family: "Lora", serif; font-style: italic; margin: 0 0 14px; }
.article-meta { font-size: 13.5px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.article-body { max-width: 760px; margin: 0 auto; padding: 28px 0; font-size: 19px; line-height: 1.7; }
.article-body p { margin: 0 0 1.15em; }
.article-body h2 { font-size: 24px; margin-top: 1.4em; }
.article-body blockquote {
  margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--brand);
  font-family: "Lora", serif; font-style: italic; color: var(--ink-soft); font-size: 19px;
}
.citation-box { max-width: 760px; margin: 0 auto 28px; background: var(--paper-raised); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; font-size: 14px; }
.citation-box strong { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.related-block { max-width: 760px; margin: 0 auto; padding: 24px 0 48px; border-top: 1px solid var(--rule); }
.related-block h2 { font-size: 18px; text-transform: uppercase; letter-spacing: .03em; }
.related-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 12px; }

/* ---------- case law library ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; padding: 20px 0; border-bottom: 1px solid var(--rule); }
.filter-bar select, .filter-bar input[type="text"] {
  padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--radius); font-size: 14px; background: var(--paper-raised); color: var(--ink);
}
.case-table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 15px; }
.case-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 2px solid var(--ink); padding: 8px 10px; }
.case-table td { border-bottom: 1px solid var(--rule-soft); padding: 12px 10px; vertical-align: top; }
.case-table tr:hover td { background: var(--paper-raised); }
.holding-text { color: var(--ink-soft); font-size: 14px; }

/* ---------- search ---------- */
.search-result { padding: 16px 0; border-bottom: 1px solid var(--rule-soft); }
.search-result .kind { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }

/* ---------- static pages ---------- */
.prose { max-width: 760px; margin: 0 auto; padding: 32px 0 56px; font-size: 17.5px; }
.prose h1 { font-size: 32px; }
.prose h2 { font-size: 22px; margin-top: 1.3em; }
.prose p { margin: 0 0 1.1em; }

/* ---------- footer ---------- */
footer.site-footer { background: var(--ink); color: #d8d2c2; padding: 40px 0 28px; margin-top: 20px; }
footer.site-footer .container { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; }
@media (max-width: 720px) { footer.site-footer .container { grid-template-columns: 1fr 1fr; } }
footer.site-footer h4 { color: #efe9db; font-family: "Source Sans 3", sans-serif; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin: 0 0 12px; }
footer.site-footer ul { list-style: none; margin: 0; padding: 0; }
footer.site-footer li { margin-bottom: 7px; font-size: 14px; }
footer.site-footer a { color: #d8d2c2; }
footer.site-footer .brand-name { color: #efe9db; }
.footer-bottom { border-top: 1px solid rgba(216,210,194,.18); margin-top: 26px; padding-top: 16px; font-size: 12.5px; color: #a9a290; }

/* ---------- admin ---------- */
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.admin-header h1 { font-size: 24px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.badge-pending { background: #fdecd2; color: #8a5a12; }
.badge-published { background: #dcf0e6; color: #1f6f5c; }
.badge-rejected { background: #f6dede; color: #8a3a1f; }
.admin-table { width: 100%; border-collapse: collapse; background: var(--paper-raised); border: 1px solid var(--rule); }
.admin-table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--ink); }
.admin-table td { padding: 12px; border-bottom: 1px solid var(--rule-soft); font-size: 14.5px; }
.admin-actions { display: flex; gap: 8px; }
.admin-actions form { display: inline; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-approve { background: #1f6f5c; }
.btn-approve:hover { background: #164f42; }
.btn-reject { background: #8a3a1f; }
.btn-reject:hover { background: #6a2c17; }
.login-box { max-width: 360px; margin: 80px auto; background: var(--paper-raised); border: 1px solid var(--rule); padding: 28px; border-radius: var(--radius); }
.login-box label { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 5px; }
.login-box input { width: 100%; padding: 9px 10px; border: 1px solid var(--rule); border-radius: var(--radius); font-size: 15px; }
.editor-form label { display: block; font-size: 13px; font-weight: 700; margin: 16px 0 5px; }
.editor-form input[type="text"], .editor-form textarea, .editor-form select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--rule); border-radius: var(--radius); font-size: 15px; font-family: inherit;
}
.editor-form textarea { min-height: 320px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 14px; }
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #f6dede; color: #6a2c17; }
.alert-ok { background: #dcf0e6; color: #164f42; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 10px; top: 10px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 100; }

.pagination { display: flex; gap: 8px; padding: 20px 0; }
.pagination a { padding: 7px 12px; border: 1px solid var(--rule); border-radius: var(--radius); font-size: 14px; }
