/* ============================================================================
   SIH 2026 Research — Anthropic-inspired design system
   Palette: warm cream bg · "book cloth" terracotta accent · hairline borders
   Type: Source Serif 4 (display) + Inter (body/UI)
   ========================================================================== */

:root {
  --bg:        #FAF9F5;
  --surface:   #FFFFFF;
  --surface-2: #F4F2EC;
  --ink:       #191919;
  --ink-soft:  #4B4A45;
  --muted:     #6C6B66;
  --faint:     #9C9A92;

  --accent:    #CC785C;   /* book cloth terracotta */
  --accent-2:  #D97757;
  --accent-tint: rgba(204, 120, 92, 0.08);

  --border:    #E8E6DF;
  --border-2:  #DDDAD1;

  --green:     #3E8E5A;
  --green-tint:  rgba(62, 142, 90, 0.08);
  --green-border: rgba(62, 142, 90, 0.28);

  --amber:     #B97A2E;
  --amber-tint:  rgba(185, 122, 46, 0.09);
  --amber-border: rgba(185, 122, 46, 0.32);

  --red:       #C05B4D;
  --red-tint:    rgba(192, 91, 77, 0.08);
  --red-border:  rgba(192, 91, 77, 0.28);

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(25, 25, 25, 0.04), 0 8px 24px rgba(25, 25, 25, 0.04);
  --shadow-sm: 0 1px 2px rgba(25, 25, 25, 0.05);
  --nav-h: 60px;
}

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

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Subtle book-cloth noise (imperceptible) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

main, header, footer, .to-top { position: relative; z-index: 1; }

img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }

::selection { background: var(--accent-tint); }

/* ---------- Layout ---------- */
.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 88px 0; border-bottom: 1px solid var(--border); }
.section-alt { background: #F7F5EF; }
.section:last-of-type { border-bottom: none; }

/* ---------- Typography ---------- */
.kicker {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.section-subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 720px;
  margin-bottom: 36px;
}

.sub-head {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.005em;
  margin: 48px 0 16px;
  padding-top: 12px;
}

.small-note {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 18px;
  max-width: 760px;
}

/* ---------- Sticky nav ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 249, 245, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.nav-brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--ink);
  white-space: nowrap;
}
.nav-brand:hover { text-decoration: none; }
.brand-dot { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 8px 12px;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav-link:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-tint); }

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px 16px;
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-link { border-radius: 8px; padding: 10px 14px; }
}

/* ---------- Hero ---------- */
.hero {
  padding: 96px 0 72px;
  border-bottom: 1px solid var(--border);
}

.hero-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.4rem, 5.2vw, 3.9rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 900px;
  margin-bottom: 22px;
}

.hero-subtitle {
  font-size: 1.18rem;
  color: var(--muted);
  max-width: 640px;
  margin-bottom: 28px;
}

.hero-meta { font-size: 0.9rem; color: var(--muted); margin-bottom: 10px; }

.hero-goal {
  max-width: 780px;
  color: var(--ink-soft);
  padding: 18px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0 28px;
  font-size: 0.98rem;
}

.hero-verdict {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 24px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.hero-verdict .v-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero-verdict .v-domain {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.45rem;
  color: var(--accent);
}
.hero-verdict .v-note { color: var(--muted); font-size: 0.9rem; }

/* Callout */
.callout {
  padding: 20px 24px;
  border: 1px solid var(--accent-border, var(--border-2));
  border-left: 3px solid var(--accent-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--accent-tint);
  max-width: 820px;
}
.callout .c-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.callout .c-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  margin-bottom: 6px;
}
.callout .c-detail { font-size: 0.94rem; color: var(--ink-soft); }
.callout .c-detail a { font-weight: 600; }
.callout-amber {
  background: var(--amber-tint);
  border-color: var(--amber-border);
  border-left-color: var(--amber);
  max-width: 860px;
}
.callout-amber .c-label { color: var(--amber); }

/* ---------- Top 3 cards ---------- */
.top3-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 8px;
}

.top3-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.top3-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.top3-rank {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--accent);
}
.top3-score {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--surface);
  background: var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
}
.top3-title { font-family: var(--serif); font-weight: 600; font-size: 1.18rem; line-height: 1.3; }
.top3-tagline { font-size: 0.9rem; color: var(--muted); }

@media (max-width: 900px) {
  .top3-grid { grid-template-columns: 1fr; }
}

/* ---------- Evaluation weights ---------- */
.weights { display: flex; flex-direction: column; gap: 18px; max-width: 720px; }

.weight-row .w-label {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 7px;
}
.w-label .w-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.w-bar {
  height: 7px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}
.w-bar > i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  width: 0;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 640px;
}

th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--ink-soft);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--accent-tint); }

td.strong, .cell-title { color: var(--ink); font-weight: 600; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td .muted-inline { color: var(--muted); font-weight: 400; font-size: 0.85rem; }

th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover { color: var(--ink); }
th.sortable .caret { display: inline-block; margin-left: 4px; opacity: 0.45; font-size: 0.8em; }
th.sortable.sorted .caret { opacity: 1; color: var(--accent); }

/* Status dot + label */
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.dot-green  { background: var(--green); }
.dot-amber  { background: var(--amber); }
.dot-red    { background: var(--red); }

/* Feasibility stars */
.stars { white-space: nowrap; }
.star {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 3px;
}
.star.on  { background: var(--accent); }
.star.off { background: var(--border-2); }

/* Mini score bar (track 5) */
.score-cell { min-width: 90px; }
.score-cell .sc-num { font-variant-numeric: tabular-nums; font-size: 0.82rem; color: var(--muted); }
.score-cell .sc-bar { height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: 4px; }
.score-cell .sc-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.total-cell { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

tr.best-row td { background: var(--accent-tint); }
tr.best-row td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* Percent bar (track 3) */
.pct-cell { min-width: 140px; }
.pct-cell .pct-num { font-variant-numeric: tabular-nums; font-size: 0.82rem; color: var(--muted); margin-right: 8px; }
.pct-cell .pct-bar { display: inline-block; vertical-align: middle; width: 70px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; }
.pct-cell .pct-bar > i { display: block; height: 100%; background: var(--accent-2); border-radius: 3px; }

/* ---------- Chips ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.chip {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--faint); }
.chip.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.chip .chip-count { opacity: 0.6; margin-left: 4px; font-size: 0.74rem; }

/* ---------- Panels / two-col ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 36px;
}
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 26px 26px 12px;
  box-shadow: var(--shadow-sm);
}
.panel-title { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; margin-bottom: 8px; }
.panel-note { font-size: 0.85rem; color: var(--muted); margin-bottom: 10px; }

.panel-red   { border-color: var(--red-border); background: var(--red-tint); }
.panel-red .panel-title { color: var(--red); }
.panel-green { border-color: var(--green-border); background: var(--green-tint); }
.panel-green .panel-title { color: var(--green); }

/* ---------- Lists ---------- */
.pattern-list { list-style: none; counter-reset: pat; display: flex; flex-direction: column; gap: 12px; max-width: 840px; }
.pattern-list li {
  position: relative;
  padding-left: 40px;
  counter-increment: pat;
}
.pattern-list li::before {
  content: counter(pat, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--accent);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 1px 6px;
  background: var(--surface);
}

.bullet-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.bullet-list li { position: relative; padding-left: 22px; }
.bullet-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.panel-red .bullet-list li::before { background: var(--red); }
.panel-green .bullet-list li::before { background: var(--green); }
.bullet-muted li::before { background: var(--faint); }

/* ---------- Recommendation ---------- */
.rec-top3 { display: flex; flex-direction: column; gap: 14px; }
.rec-item {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.rec-item .rec-rank {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--surface);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rec-item .rec-body { flex: 1; }
.rec-item .rec-title { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; margin-bottom: 4px; }
.rec-item .rec-score { display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; color: var(--accent); border: 1px solid var(--accent); border-radius: 999px; padding: 2px 10px; margin-bottom: 8px; }
.rec-item .rec-why { font-size: 0.92rem; color: var(--ink-soft); }

/* Flag panels */
.flag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 8px;
}
.flag-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.flag-panel .fp-title { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; margin-bottom: 4px; }
.flag-panel .fp-note { font-size: 0.78rem; color: var(--muted); margin-bottom: 12px; }
.flag-panel ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.flag-panel li { font-size: 0.88rem; color: var(--ink-soft); padding-left: 18px; position: relative; }
.flag-panel li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.flag-panel.fp-green { border-color: var(--green-border); background: var(--green-tint); }
.flag-panel.fp-green .fp-title { color: var(--green); }
.flag-panel.fp-green li::before { background: var(--green); }
.flag-panel.fp-amber { border-color: var(--amber-border); background: var(--amber-tint); }
.flag-panel.fp-amber .fp-title { color: var(--amber); }
.flag-panel.fp-amber li::before { background: var(--amber); }
.flag-panel.fp-red { border-color: var(--red-border); background: var(--red-tint); }
.flag-panel.fp-red .fp-title { color: var(--red); }
.flag-panel.fp-red li::before { background: var(--red); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 34px 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { background: var(--accent); border-color: var(--accent); color: var(--surface); }

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.reveal.visible { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .reveal { opacity: 1; transform: none; }
  .w-bar > i { transition: none; }
}
