:root {
  --gold: #cc9b2e;
  --gold-deep: #8d6912;
  --ink: #1c160c;
  --muted: #6b5e4c;
  --bg: #fbf7ef;
  --bg-2: #f3ead6;
  --card: #ffffff;
  --line: rgba(204, 155, 46, 0.55);
  --danger: #b4232c;
  --ok: #1f7a4d;
  --shadow: 0 12px 32px rgba(28, 22, 12, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hind Madurai", "Source Sans 3", sans-serif;
  font-size: 0.95rem;
  line-height: 1.65;
}
img { max-width: 100%; height: auto; }
a { color: var(--gold-deep); text-decoration: none; }
a:hover { color: #5c450c; }
h1, h2, h3, h4 { font-family: "Tiro Tamil", "Hind Madurai", serif; line-height: 1.4; font-weight: 400; color: var(--ink); }
h1 { font-size: clamp(1.45rem, 2.8vw, 2.15rem); }
h2 { font-size: clamp(1.15rem, 2vw, 1.5rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1rem; }

.wrap { width: min(1120px, calc(100% - 2rem)); margin-inline: auto; }
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 252, 246, 0.96);
  border-bottom: 2px solid var(--gold);
  backdrop-filter: blur(10px);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 84px; }
.brand img { height: 58px; width: auto; display: block; }
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.nav-burger { display: none; margin-left: auto; color: var(--gold-deep); font-size: 1.6rem; cursor: pointer; }
.nav { display: flex; align-items: center; gap: 0.85rem; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.nav a { color: var(--ink); font-weight: 600; font-size: 0.9rem; }
.nav a.active, .nav a:hover, .nav-item.active > a { color: var(--gold-deep); }
.nav-item { position: relative; }
.nav-item > a::after { content: " ▾"; font-size: 0.72em; }
.nav-sub {
  display: none;
  position: absolute;
  top: calc(100% - 0.15rem);
  right: 0;
  min-width: 11.5rem;
  padding: 0.35rem;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 30;
}
.nav-item:hover .nav-sub,
.nav-item:focus-within .nav-sub { display: grid; }
.nav-sub a { display: block; padding: 0.45rem 0.7rem; border-radius: 8px; white-space: nowrap; }
.nav-sub a:hover, .nav-sub a.active { background: rgba(204, 155, 46, 0.16); }
.lang { display: flex; gap: 0.25rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem; }
.lang a { padding: 0.1rem 0.55rem; border-radius: 999px; color: var(--muted); }
.lang a.active { background: var(--gold); color: #1a1203; }

.hero {
  min-height: 72vh;
  display: grid;
  align-items: end;
  background:
    linear-gradient(100deg, rgba(251, 247, 239, 0.96) 0%, rgba(251, 247, 239, 0.88) 42%, rgba(251, 247, 239, 0.28) 100%),
    url("/images/hero.jpg") center/cover no-repeat;
  padding: 4rem 0 3.5rem;
}
.eyebrow { color: var(--gold-deep); letter-spacing: 0.04em; font-weight: 700; margin-bottom: 0.8rem; }
.hero h1 { max-width: 16em; margin: 0 0 1.4rem; color: var(--ink); }
.hero-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; }

.section { padding: 4.2rem 0; }
.section.alt { background: var(--bg-2); }
.section h2 { margin-top: 0; }
.gold-rule { width: 72px; height: 3px; background: var(--gold); margin: 0.6rem 0 1.2rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1.3rem;
  box-shadow: var(--shadow);
}
.card h3 { margin-top: 0; color: var(--gold-deep); }
.support {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 1.5rem;
  align-items: center;
}
.support img { width: 180px; background: #fff; border-radius: 12px; padding: 8px; border: 1px solid var(--line); }

.site-footer { border-top: 2px solid var(--gold); padding: 2.2rem 0 1.4rem; background: #fffdf8; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1rem; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 0.9rem; }

.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; padding: 0.55rem 1.1rem; font-weight: 700;
  border: 1px solid transparent; cursor: pointer; font: inherit; color: #1a1203; background: var(--gold);
}
.btn:hover { filter: brightness(1.05); color: #1a1203; }
.btn-ghost { background: #fffdf8; color: var(--ink); border-color: var(--gold); }
.btn-ghost:hover { color: var(--gold-deep); background: #fff; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-small { padding: 0.3rem 0.75rem; font-size: 0.92rem; }
.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.btn-row h1, .btn-row h2 { margin: 0; }
.btn-row .btn { flex: none; align-self: center; white-space: nowrap; }

.page-head { padding: 2.4rem 0 0.4rem; }
.stack { display: grid; gap: 1rem; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.person { display: grid; grid-template-columns: 72px 1fr; gap: 0.8rem; align-items: center; }
.person img, .avatar-preview { width: 72px; height: 72px; object-fit: cover; border-radius: 50%; border: 2px solid var(--gold); }

.form { display: grid; gap: 0.85rem; }
label { display: grid; gap: 0.3rem; font-weight: 600; }
input, textarea, select {
  width: 100%; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; padding: 0.65rem 0.75rem; font: inherit;
}
textarea { min-height: 140px; resize: vertical; }
.roles { display: grid; gap: 0.6rem; }
.role {
  display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; align-items: start;
  border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem; background: #fff;
}
.role input { width: auto; margin-top: 0.35rem; }
.error { color: var(--danger); font-size: 0.92rem; }
.alert { padding: 0.75rem 1rem; border-radius: 12px; margin: 1rem auto; width: min(1120px, calc(100% - 2rem)); }
.alert-ok { background: #e8f6ee; border: 1px solid var(--ok); color: #145c38; }
.alert-bad { background: #fdecee; border: 1px solid var(--danger); color: #8d1d24; }

.dash { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1.2rem; padding-bottom: 3rem; }
.side { display: grid; align-content: start; gap: 0.35rem; }
.side a { color: var(--ink); padding: 0.4rem 0.6rem; border-radius: 10px; }
.side a.active, .side a:hover { background: rgba(204, 155, 46, 0.16); color: var(--gold-deep); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.65rem 0.45rem; border-bottom: 1px solid rgba(28, 22, 12, 0.1); vertical-align: top; }
th { color: var(--gold-deep); font-size: 0.92rem; }
td.actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}
td.actions form { display: inline-flex; margin: 0; }
td.actions .btn { white-space: nowrap; width: auto; }
td.role-cell select { width: auto; min-width: 9rem; }
.pill { display: inline-block; border-radius: 999px; padding: 0.05rem 0.55rem; border: 1px solid var(--gold); color: var(--gold-deep); background: #fff8e8; font-size: 0.85rem; }
.steps { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0.6rem 0; }
.steps li { border: 1px solid var(--line); border-radius: 999px; padding: 0.05rem 0.65rem; color: var(--muted); }
.steps li.on { background: var(--gold); color: #1a1203; border-color: var(--gold); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.7rem; }
.stat strong { display: block; font-size: 1.5rem; color: var(--gold-deep); }
.comment { border-top: 1px solid rgba(28, 22, 12, 0.1); padding-top: 0.8rem; margin-top: 0.8rem; }
.reply { margin-left: 1.2rem; }
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: end; margin-top: 1rem; }
.filters label { min-width: 140px; }
.filters .grow { flex: 1 1 16rem; }
.filters .btn { margin-bottom: 0.15rem; }
.pager { display: flex; gap: 0.4rem; list-style: none; padding: 0; }
.pager a, .pager span { display: inline-block; padding: 0.25rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; }
.pager .active span { background: var(--gold); color: #1a1203; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) {
  .grid-3, .support, .footer-grid, .dash, .split { grid-template-columns: 1fr; }
  .hero {
    background:
      linear-gradient(180deg, rgba(251, 247, 239, 0.94), rgba(251, 247, 239, 0.82)),
      url("/images/hero.jpg") center/cover no-repeat;
  }
  .nav-burger { display: block; }
  .nav { display: none; width: 100%; padding-bottom: 1rem; }
  .nav-toggle:checked ~ .nav { display: flex; flex-direction: column; align-items: flex-start; }
  .nav-sub {
    position: static;
    display: grid;
    min-width: 0;
    margin: 0.15rem 0 0.35rem 0.8rem;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .header-inner { flex-wrap: wrap; }
}

.article-form { display: grid; gap: 0.8rem; }
.article-title input { font-family: "Tiro Tamil", "Hind Madurai", serif; font-size: 1.6rem; }
.article-editor { display: grid; gap: 0.6rem; }
.editor-toolbar { display: flex; flex-wrap: wrap; gap: 0.35rem; position: sticky; top: 86px; z-index: 5; padding: 0.45rem; background: #fffdf8; border: 1px solid var(--line); border-radius: 14px; }
.editor-toolbar button { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 0.28rem 0.7rem; font: inherit; cursor: pointer; }
.editor-toolbar button:hover { background: rgba(204, 155, 46, 0.16); }
.article-sheet {
  min-height: 22rem;
  padding: 1.4rem 1.3rem 2rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  font-family: "Tiro Tamil", "Hind Madurai", serif;
  font-size: 1.12rem;
  line-height: 1.85;
}
.article-sheet:focus { outline: 2px solid rgba(204, 155, 46, 0.45); }
.article-sheet[data-empty="1"]:before { content: attr(data-placeholder); color: var(--muted); font-family: "Hind Madurai", sans-serif; }
.article-prose { font-family: "Tiro Tamil", "Hind Madurai", serif; font-size: 1.12rem; line-height: 1.9; }
.article-prose h2, .article-sheet h2 { font-size: 1.45rem; margin: 1.4rem 0 0.6rem; }
.article-prose h3, .article-sheet h3 { font-size: 1.2rem; margin: 1.1rem 0 0.45rem; }
.article-prose p, .article-sheet p { margin: 0 0 1rem; }
.article-prose blockquote, .article-sheet blockquote { margin: 1rem 0; padding: 0.2rem 0 0.2rem 1rem; border-left: 3px solid var(--gold); color: var(--gold-deep); }
.article-prose img, .article-sheet img { border-radius: 12px; margin: 0.6rem 0; }
.article-prose ul, .article-prose ol, .article-sheet ul, .article-sheet ol { padding-left: 1.3rem; }
.editor-toolbar select { width: auto; min-width: 6.5rem; padding: 0.28rem 0.55rem; border-radius: 999px; }
.editor-toolbar select[data-template] { min-width: 11rem; }
.article-prose figure, .article-sheet figure { margin: 1rem 0; }
.article-prose figure img, .article-sheet figure img { display: block; width: 100%; height: auto; margin: 0; }
.article-prose figcaption, .article-sheet figcaption { margin-top: 0.35rem; color: var(--muted); font-family: "Hind Madurai", sans-serif; font-size: 0.92rem; }
.article-prose .layout-left, .article-sheet .layout-left { float: left; width: min(46%, 280px); margin: 0.2rem 1rem 0.8rem 0; }
.article-prose .layout-right, .article-sheet .layout-right { float: right; width: min(46%, 280px); margin: 0.2rem 0 0.8rem 1rem; }
.article-prose .layout-pair, .article-sheet .layout-pair,
.article-prose .layout-trio, .article-sheet .layout-trio { display: grid; gap: 0.7rem; clear: both; }
.article-prose .layout-pair, .article-sheet .layout-pair { grid-template-columns: 1fr 1fr; }
.article-prose .layout-trio, .article-sheet .layout-trio { grid-template-columns: 1fr 1fr 1fr; }
.article-prose .layout-pair figcaption, .article-sheet .layout-pair figcaption,
.article-prose .layout-trio figcaption, .article-sheet .layout-trio figcaption { grid-column: 1 / -1; }
.article-prose .video-frame, .article-sheet .video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; clear: both; }
.article-prose .video-frame iframe, .article-sheet .video-frame iframe,
.article-prose .video-frame video, .article-sheet .video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 12px; background: #1c160c; }
.article-prose table, .article-sheet table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-family: "Hind Madurai", sans-serif; font-size: 1rem; }
.article-prose th, .article-prose td, .article-sheet th, .article-sheet td { border: 1px solid var(--line); padding: 0.45rem 0.6rem; vertical-align: top; text-align: left; }
.article-prose th, .article-sheet th { background: #fff8e8; color: var(--gold-deep); }
.article-prose::after, .article-sheet::after { content: ""; display: block; clear: both; }
@media (max-width: 700px) {
  .article-prose .layout-left, .article-sheet .layout-left,
  .article-prose .layout-right, .article-sheet .layout-right { float: none; width: 100%; margin: 0.6rem 0; }
  .article-prose .layout-pair, .article-sheet .layout-pair,
  .article-prose .layout-trio, .article-sheet .layout-trio { grid-template-columns: 1fr; }
}
