/* ============================================================================
   Constitution of India Project — Reimagined stylesheet
   Mobile-first • Accessible • Elegant • Responsive
   ============================================================================ */

/* --------------------------
   Design tokens / variables
   -------------------------- */
:root{
  --bg: #ffffff;
  --page-bg: #fbfcfd;
  --text: #0f1720;
  --muted: #556072;
  --accent: #0b66d1;
  --accent-visited: #084fa8;
  --soft: #e9eef6;
  --surface: #ffffff;
  --shadow: 0 6px 20px rgba(8,20,40,0.06);
  --radius: 8px;
  --focus: 3px solid rgba(11,102,209,0.18);
  --max-width: min(90%, 1200px);
}

/* --------------------------
   Reset
   -------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body{
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--page-bg);
  -webkit-font-smoothing:antialiased;
  line-height: 1.6;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0ms !important; transition-duration: 0ms !important; }
}

/* --------------------------
   Wrapper (centred layout)
   -------------------------- */
.wrapper {
  width: var(--max-width);
  margin: 0 auto;
  padding: 1.25rem;
}

/* ===========================================
   SITE HEADER — Elegant, Institutional
   =========================================== */
.site-header {
  background:
  linear-gradient(
    to right,
    rgba(255, 153, 51, 0.10) 0%,
    rgba(255, 153, 51, 0.10) 33.33%,
    rgba(255, 255, 255, 0.10) 33.33%,
    rgba(255, 255, 255, 0.10) 66.66%,
    rgba(19, 136, 8, 0.10) 66.66%,
    rgba(19, 136, 8, 0.10) 100%
  );
  padding: 1.1rem 0 1.2rem;
  border-bottom: 1px solid var(--soft);
  text-align: center;
  position: relative;
  z-index: 1; /* ensures no conflict with top-access-bar */
}

/* Ashoka Chakra watermark behind title + subtitle */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("https://upload.wikimedia.org/wikipedia/commons/1/17/Ashoka_Chakra.svg")
              center 8px / 180px no-repeat;
  opacity: 0.06;
  filter: grayscale(100%);
  pointer-events: none;
  z-index: 0;
}

/* Keep text above the watermark */
.site-title,
.site-subtitle {
  position: relative;
  z-index: 2;
}

/* Dark mode watermark */
html.dark-mode .site-header::before {
  opacity: 0.12;
  filter: brightness(1.4) grayscale(100%);
}

/* =========================================================
   FIX: Dark mode page titles (Constitution Project)
   ========================================================= */

html.dark-mode .page-content h1,
html.dark-mode main h1,
html.dark-mode h1 {
  color: #e7edf5 !important;
  border-color: #2a3542 !important;
}

/* Fix H2–H6 also */
html.dark-mode h2,
html.dark-mode h3,
html.dark-mode h4,
html.dark-mode h5,
html.dark-mode h6 {
  color: #e7edf5 !important;
  border-color: #2a3542 !important;
}

/* Page title underline */
html.dark-mode .page-content h1 {
  border-bottom-color: #2a3542 !important;
}

/* Title Styling */
.site-title a{
  text-decoration: none;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 2.2rem;
  line-height: 1.05;
  display: inline-block;

  /* Subtle lift + clarity */
  letter-spacing: -0.3px;
  text-rendering: optimizeLegibility;
}

/* Title hover: dignified, not flashy */
.site-title a:hover{
  color: var(--accent);
  transition: color 0.25s ease;
}

/* ===========================================
   Site Description / Subtitle — Refined
   =========================================== */
.site-subtitle{
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 75ch;
  margin: 0.55rem auto 0;
  line-height: 1.48;
  text-align: center;

  /* Subtle visual refinement */
  letter-spacing: 0.25px;
  opacity: 0.96;

  /* Very soft gradient for sophistication */
  background: linear-gradient(to bottom, var(--muted), #606b7c);
  -webkit-background-clip: text;
  color: transparent;
}

/* Dark mode additions: ensures beauty in night mode */
html.dark-mode .site-title a {
  color: #eaf1f9;
}

html.dark-mode .site-title a:hover{
  color: #9cc9ff;
}

html.dark-mode .site-subtitle{
  background: linear-gradient(to bottom, #bcc4d2, #d5dae2);
  -webkit-background-clip: text;
  color: transparent;
  opacity: 1;
}

/* --------------------------
   Skip link (accessibility)
   -------------------------- */
.skip-to-content {
  position: absolute;
  left: -999px;
}
.skip-to-content:focus {
  position: fixed;
  left: 1rem;
  top: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  z-index: 999;
}

/* --------------------------
   PAGE HEADER (page titles LEFT aligned)
   -------------------------- */
.page-header {
  margin: 0.5rem 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid transparent;
  text-align: left; /* KEY FIX */
}

.page-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.9rem;
  margin: 0;
  color: var(--text);
  line-height: 1.1;
  text-align: left; /* IMPORTANT FIX */
}

.page-subtitle {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 1rem;
  font-style: italic;
  text-align: left; /* FIX */
}

/* --------------------------
   MAIN CONTENT
   -------------------------- */
.site-main {
  margin-top: 1rem;
  margin-bottom: 1.0rem;
}

.page-content {
  background: var(--surface);
  padding: 1.4rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  text-align: left; /* FIX */
}

p {
  margin: 0 0 1rem 0;
  font-size: 1.05rem;
  color: var(--text);
}

/* --------------------------
   Links
   -------------------------- */
a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:visited { color: var(--accent-visited); }
a:focus-visible { outline: var(--focus); }

/* --------------------------
   Lists & quotes
   -------------------------- */
ul, ol { margin: 0 0 1rem 1.35rem; }
li { margin: 0.35rem 0; }

blockquote {
  margin: 0 0 1rem 0;
  padding: 0.9rem 1rem;
  border-left: 4px solid var(--soft);
  background: #f8fafc;
  color: var(--muted);
  font-style: italic;
}

/* --------------------------
   Code / Pre
   -------------------------- */
pre {
  background: #0f1720;
  color: #e6eef8;
  padding: 0.9rem;
  border-radius: 6px;
  overflow-x: auto;
}

/* --------------------------
   Headings
   -------------------------- */
h2 { font-size: 1.35rem; margin: 0.5rem 0 0.4rem; color: #07243a; }
h3 { font-size: 1.15rem; margin: 0.4rem 0 0.35rem; color: #083049; }
h4 { font-size: 1rem; margin: 0.3rem 0 0.25rem; }

/* --------------------------
   Tables
   -------------------------- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
th, td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid #e9eef6;
}
th { background: #f3f7fb; }

/* --------------------------
   Buttons
   -------------------------- */
.btn {
  display: inline-block;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}
.btn:hover { filter: brightness(0.97); }

/* --------------------------
   FOOTER (centre aligned)
   -------------------------- */
.site-footer {
  text-align: center; /* KEY FIX */
  padding: 0.5rem 0;
  border-top: 1px solid var(--soft);
  color: var(--muted);
  background: var(--surface);
}

.site-footer .footer-note {
  margin-top: 0.4rem;
  font-size: 0.92rem;
  color: var(--muted);
  text-align: center;
}

/* --------------------------
   Responsive
   -------------------------- */
@media (min-width: 820px){
  .site-title a { font-size: 2.3rem; }
  .page-title { font-size: 2.15rem; }
}

@media (max-width: 480px){
  .wrapper { padding: 0.8rem; }
  .site-title a { font-size: 1.55rem; }
  .page-title { font-size: 1.55rem; }
  .page-content { padding: 1rem; }
}

/* --------------------------
   Print
   -------------------------- */
@media print {
  .site-header, .site-footer { display:none; }
  .page-content { box-shadow:none; padding:0; }
}

/* =========================================================
   FINAL OVERRIDE — Dark mode page title fix
   ========================================================= */

html.dark-mode .page-title,
html.dark-mode .page-header h1,
html.dark-mode h1.page-title {
  color: #e7edf5 !important;
  border-bottom-color: #2a3542 !important;
}
