/* Nellai Eruvadi — "Rivertown" editorial regional-guide theme
   Palette: paddy/Ghats green + temple sand/gold on warm paper. Custom layout (CSS Grid/Flexbox). */

:root {
  --green-900: #123a26;
  --green-800: #17492f;
  --green-700: #1f7a3d;
  --green-600: #2a8b4a;
  --green-500: #37a15c;
  --gold: #c9962e;
  --gold-dark: #a97c1e;
  --sand: #f2ead8;
  --sand-deep: #e7dcc2;
  --paper: #faf7f0;
  --ink: #221f1a;
  --ink-soft: #5c564b;
  --line: #e2d9c6;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(30,20,0,.08);
  --shadow-md: 0 8px 24px rgba(30,20,0,.12);
  --radius: 12px;
  --maxw: 1120px;
  --container-pad: clamp(1rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.7;
  font-size: 17px;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--gold-dark); text-decoration: underline; }

h1, h2, h3 { font-family: 'Fraunces', Georgia, 'Times New Roman', serif; line-height: 1.18; color: var(--green-900); font-weight: 600; }
h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 .5rem; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.25rem; margin: 1.6rem 0 .5rem; }
p { margin: 0 0 1.1rem; }

.container { max-width: var(--maxw); margin: 0 auto; padding-left: var(--container-pad); padding-right: var(--container-pad); }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--green-800); color: #fff; padding: .6rem 1rem; z-index: 200; }
.skip-link:focus { left: 0; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,247,240,.94);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .25s ease;
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .7rem; padding-bottom: .7rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: 'Fraunces', serif; font-weight: 600; color: var(--green-900); font-size: 1.25rem; }
.brand:hover { text-decoration: none; color: var(--green-900); }
.brand .mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--green-700), var(--green-900)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; box-shadow: var(--shadow-sm); }
.brand small { display: block; font-family: 'Inter', sans-serif; font-weight: 500; font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-dark); }

.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; cursor: pointer; color: var(--green-900); font-size: 1.1rem; line-height: 1; }
.main-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: .1rem; margin: 0; padding: 0; justify-content: flex-end; }
.main-nav a { display: block; padding: .4rem .62rem; border-radius: 7px; color: var(--ink-soft); font-size: .84rem; font-weight: 500; }
.main-nav a:hover { background: var(--sand); color: var(--green-800); text-decoration: none; }
.main-nav a.active { color: var(--green-800); background: var(--sand-deep); }

/* ---------- Hero ---------- */
.hero { position: relative; color: #fff; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18,58,38,.28) 0%, rgba(18,58,38,.72) 100%); }
.hero-inner { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; padding: clamp(3rem, 12vw, 7rem) var(--container-pad) clamp(2.4rem, 8vw, 4.5rem); }
.hero h1 { color: #fff; max-width: 18ch; text-shadow: 0 2px 18px rgba(0,0,0,.35); }
.hero .eyebrow { display: inline-block; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: #ffe9b8; background: rgba(18,58,38,.5); border: 1px solid rgba(255,255,255,.25); padding: .3rem .7rem; border-radius: 999px; margin-bottom: 1rem; }
.hero .hero-sub { max-width: 46ch; font-size: 1.05rem; color: #f3ecdd; margin-bottom: 0; text-shadow: 0 1px 10px rgba(0,0,0,.35); }

/* Page header (no image) */
.page-head { background: linear-gradient(160deg, var(--green-800), var(--green-900)); color: #fff; }
.page-head .hero-inner { padding-top: clamp(2.4rem, 8vw, 4rem); padding-bottom: clamp(2rem, 6vw, 3rem); }
.page-head h1 { color: #fff; }
.page-head .eyebrow { display: inline-block; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: #ffe9b8; margin-bottom: .8rem; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: .82rem; color: var(--ink-soft); padding: .9rem 0 0; }
.breadcrumb a { color: var(--green-700); }

/* ---------- Article ---------- */
.article { padding: 1.2rem 0 3rem; }
.article-body { max-width: 72ch; }
.article-body > p:first-of-type { font-size: 1.12rem; color: #3a352c; }
.article-body ul, .article-body ol { margin: 0 0 1.2rem 1.2rem; }
.article-body li { margin-bottom: .4rem; }
.article-body strong { color: var(--green-900); }
figure { margin: 1.8rem 0; }
figure img { border-radius: var(--radius); box-shadow: var(--shadow-md); width: 100%; }
figcaption { font-size: .82rem; color: var(--ink-soft); margin-top: .5rem; font-style: italic; }

/* ---------- Home: intro + section cards ---------- */
.section { padding: 2.6rem 0; }
.section-alt { background: var(--sand); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-title { text-align: center; margin-bottom: 1.6rem; }
.section-title p { color: var(--ink-soft); max-width: 60ch; margin: .4rem auto 0; }

.quickfacts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.fact { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); }
.fact .k { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-dark); font-weight: 600; }
.fact .v { font-family: 'Fraunces', serif; font-size: 1.35rem; color: var(--green-900); margin-top: .2rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.2rem; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card .icon { width: 42px; height: 42px; border-radius: 10px; background: var(--sand); color: var(--green-700); display: grid; place-items: center; font-size: 1.1rem; margin-bottom: .8rem; }
.card h3 { margin: 0 0 .4rem; }
.card p { font-size: .93rem; color: var(--ink-soft); margin-bottom: .9rem; }
.card .more { margin-top: auto; font-weight: 600; font-size: .9rem; color: var(--green-700); }
.card a.card-link { position: absolute; inset: 0; }
.card { position: relative; }

/* ---------- Callout ---------- */
.callout { background: var(--white); border-left: 4px solid var(--gold); border-radius: 0 var(--radius) var(--radius) 0; padding: 1.1rem 1.3rem; box-shadow: var(--shadow-sm); margin: 1.8rem 0; font-size: .95rem; }
.callout strong { color: var(--green-900); }

/* ---------- Related nav ---------- */
.related { border-top: 1px solid var(--line); margin-top: 2.4rem; padding-top: 1.4rem; }
.related h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
.related .pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.related .pills a { background: var(--sand); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .9rem; font-size: .85rem; color: var(--green-800); }
.related .pills a:hover { background: var(--sand-deep); text-decoration: none; }

/* ---------- Footer ---------- */
.site-footer { background: var(--green-900); color: #d8e2d5; margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 2rem; padding: 3rem 0 1.5rem; }
.site-footer h4 { font-family: 'Fraunces', serif; color: #fff; font-size: 1.05rem; margin: 0 0 .8rem; }
.site-footer a { color: #cfe0cd; }
.site-footer a:hover { color: #fff; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .45rem; font-size: .9rem; }
.footer-brand p { font-size: .9rem; color: #b6c7b3; max-width: 40ch; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 1.1rem 0; font-size: .82rem; color: #a9bba7; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }

/* ---------- Entrance animation (CSS-only, ends visible) ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal { animation: fadeUp .6s ease both; }
/* Safeguard: content must never be stuck hidden waiting on JS */
[data-aos] { opacity: 1 !important; transform: none !important; }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; } html { scroll-behavior: auto; } }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 5rem 0; }
.notfound .big { font-family: 'Fraunces', serif; font-size: clamp(4rem, 18vw, 9rem); color: var(--green-800); line-height: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav-toggle { display: block; }
  .main-nav { position: fixed; inset: 0 0 0 auto; width: min(78vw, 320px); background: var(--paper); border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .28s ease; padding: 4.5rem 1.2rem 2rem; overflow-y: auto; box-shadow: var(--shadow-md); }
  .main-nav.open { transform: translateX(0); }
  .main-nav ul { flex-direction: column; gap: .1rem; justify-content: flex-start; }
  .main-nav a { padding: .7rem .6rem; font-size: .98rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav-backdrop { display: none; position: fixed; inset: 0; background: rgba(18,58,38,.4); z-index: 99; }
  .nav-backdrop.show { display: block; }
}
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.4rem; }
  body { font-size: 16px; }
}
