/* Minimal editorial layout: hairline rules, one accent, typography-led hierarchy. */

:root {
  --bg:          #ffffff;
  --bg-sunken:   #fafafa;
  --fg:          #14161a;
  --fg-muted:    #5d626b;
  --fg-faint:    #8b9098;
  --rule:        #e7e8ea;
  --rule-strong: #d2d4d8;
  --accent:      #22439b;
  --sebi:        #2a4f86;
  --ifsca:       #8a5323;
  --danger:      #a02622;
  --highlight:   #fdf2c4;
  --wrap:        64rem;
  --date-col:    6.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0e0f12;
    --bg-sunken:   #15171b;
    --fg:          #e8e9ec;
    --fg-muted:    #9ba0a9;
    --fg-faint:    #6f747d;
    --rule:        #23262c;
    --rule-strong: #34383f;
    --accent:      #93b0f0;
    --sebi:        #93b0f0;
    --ifsca:       #d9a26b;
    --danger:      #f0a5a1;
    --highlight:   #453c17;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.5rem;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus {
  left: 1rem; top: 1rem; z-index: 20;
  background: var(--bg);
  color: var(--fg);
  padding: .5rem .8rem;
  border: 1px solid var(--rule-strong);
}

/* --- Masthead ----------------------------------------------------------- */

.masthead { padding: 4rem 0 2.25rem; }

.eyebrow {
  margin: 0 0 1rem;
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.masthead h1 {
  margin: 0 0 1.125rem;
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-size: clamp(1.75rem, 4.6vw, 2.75rem);
  line-height: 1.16;
  letter-spacing: -.018em;
  text-wrap: balance;
}

.masthead h1 .amp {
  color: var(--fg-faint);
  font-style: italic;
}

.meta {
  margin: 0;
  font-size: .875rem;
  color: var(--fg-muted);
}

.meta strong {
  color: var(--fg);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* --- Toolbar ------------------------------------------------------------ */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

@supports (backdrop-filter: blur(1px)) {
  .toolbar {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(12px);
  }
}

.search {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .875rem 0;
  border-bottom: 1px solid var(--rule);
}

.search-icon {
  flex: none;
  width: 1.0625rem;
  height: 1.0625rem;
  color: var(--fg-faint);
}

#q {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  color: var(--fg);
  background: none;
  border: 0;
  padding: 0;
}

#q::placeholder { color: var(--fg-faint); }
#q:focus { outline: none; }
#q::-webkit-search-cancel-button { filter: grayscale(1); opacity: .5; }

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  padding: .6875rem 0;
}

/* Regulator toggle */

.segmented {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.seg {
  font: inherit;
  font-size: .875rem;
  color: var(--fg-muted);
  background: none;
  border: 0;
  padding: .1875rem 0;
  cursor: pointer;
  border-bottom: 1.5px solid transparent;
  white-space: nowrap;
}

.seg:hover { color: var(--fg); }

.seg[aria-pressed="true"] {
  color: var(--fg);
  font-weight: 500;
  border-bottom-color: var(--fg);
}

.seg .n {
  margin-left: .375rem;
  font-size: .75rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--fg-faint);
}

/* Selects */

.fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem 1.25rem;
}

.field {
  display: flex;
  align-items: center;
  gap: .4375rem;
  margin: 0;
}

.field label {
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.field select {
  font: inherit;
  font-size: .8125rem;
  color: var(--fg);
  background-color: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  border-radius: 0;
  padding: .1875rem 1.125rem .1875rem .125rem;
  max-width: 11.5rem;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right .5rem center, right .25rem center;
  background-size: .25rem .25rem, .25rem .25rem;
  background-repeat: no-repeat;
}

.field select:hover { border-bottom-color: var(--fg-muted); }
.field select option { background: var(--bg); color: var(--fg); }

.reset {
  font: inherit;
  font-size: .8125rem;
  color: var(--fg-muted);
  background: none;
  border: 0;
  padding: .1875rem 0;
  border-bottom: 1px solid var(--rule-strong);
  cursor: pointer;
}

.reset:hover { color: var(--fg); border-bottom-color: var(--fg); }

/* --- Results ------------------------------------------------------------ */

.result-count {
  margin: 1.75rem 0 .25rem;
  font-size: .8125rem;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
}

.items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item {
  display: grid;
  grid-template-columns: var(--date-col) 1fr;
  gap: 0 1.75rem;
  padding: 1.375rem 0;
  border-top: 1px solid var(--rule);
}

.item:last-child { border-bottom: 1px solid var(--rule); }

.item-date {
  font-size: .8125rem;
  line-height: 1.7;
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.item-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .3125rem;
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.reg--SEBI  { color: var(--sebi); }
.reg--IFSCA { color: var(--ifsca); }

.kicker-sep { color: var(--rule-strong); font-weight: 400; }
.kicker-type { color: var(--fg-muted); }

.flag-new {
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 0 .3125rem;
  font-size: .625rem;
  letter-spacing: .08em;
}

.item-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.42;
  letter-spacing: -.005em;
  text-wrap: pretty;
}

.item-title a {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size .18s ease;
}

.item-title a:hover {
  color: var(--accent);
  background-size: 100% 1px;
}

.item-tags {
  margin: .4375rem 0 0;
  font-size: .78125rem;
  color: var(--fg-faint);
}

.item-tags .kw + .kw::before {
  content: "\00b7";
  margin: 0 .375rem;
  color: var(--rule-strong);
}

.item-tags .src {
  margin-left: .75rem;
  color: var(--fg-faint);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.item-tags .src:hover { color: var(--fg-muted); border-bottom-color: var(--fg-muted); }

mark {
  background: var(--highlight);
  color: inherit;
  padding: 0 .08em;
  border-radius: 1px;
}

.notice {
  margin: 0;
  padding: 4.5rem 1rem;
  text-align: center;
  font-size: .9375rem;
  color: var(--fg-muted);
  border-top: 1px solid var(--rule);
}

.notice--error { color: var(--danger); }

/* --- Footer ------------------------------------------------------------- */

.footer {
  margin-top: 4rem;
  padding: 2rem 0 4rem;
  border-top: 1px solid var(--rule);
  background: var(--bg-sunken);
  font-size: .8125rem;
  color: var(--fg-faint);
}

.footer p { margin: 0 0 .5rem; max-width: 42rem; }
.footer a { color: var(--fg-muted); text-decoration-color: var(--rule-strong); }
.footer a:hover { color: var(--fg); }

/* --- Narrow screens ----------------------------------------------------- */

@media (max-width: 40rem) {
  .masthead { padding: 2.5rem 0 1.5rem; }

  .controls { gap: .875rem; }
  .segmented { gap: 1rem; width: 100%; }
  .fields { gap: .625rem 1rem; }
  .field select { max-width: 8.5rem; }

  .item {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 1.125rem 0;
  }

  .item-date {
    order: 2;
    margin-top: .5rem;
    line-height: 1.4;
  }

  .item-body { order: 1; }
  .item-title { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: .01ms !important; }
}

/* --- Summary button and dialog ------------------------------------------ */

.summary-btn {
  font: inherit;
  font-size: .78125rem;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  margin-right: .75rem;
  cursor: pointer;
  border-bottom: 1px solid currentColor;
}

.summary-btn:hover { color: var(--fg); }

.sheet {
  width: min(38rem, calc(100vw - 2rem));
  padding: 2rem 2.25rem 1.75rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
}

.sheet::backdrop {
  background: rgba(14, 15, 18, .48);
  backdrop-filter: blur(2px);
}

.sheet-close-form { margin: 0; float: right; }

.sheet-close {
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--fg-faint);
  background: none;
  border: 0;
  padding: 0 0 0 1rem;
  cursor: pointer;
}

.sheet-close:hover { color: var(--fg); }

.sheet .item-kicker { margin-bottom: .5rem; }

.sheet-title {
  margin: 0 0 1rem;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.3125rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.01em;
  text-wrap: pretty;
}

.sheet-summary {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  line-height: 1.62;
}

.sheet-caveat {
  margin: 0 0 1.25rem;
  padding-left: .875rem;
  border-left: 2px solid var(--rule-strong);
  font-size: .78125rem;
  line-height: 1.5;
  color: var(--fg-faint);
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem 1rem;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.sheet-link {
  font-size: .875rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.sheet-model {
  font-size: .6875rem;
  letter-spacing: .04em;
  color: var(--fg-faint);
}

@media (max-width: 40rem) {
  .sheet { padding: 1.5rem 1.375rem 1.25rem; }
  .sheet-title { font-size: 1.1875rem; }
}
