/* HDFC Bank research web — light "Googlish" tabbed analysis UI */
:root {
  --bg: #ffffff;
  --bg-soft: #f8f9fa;
  --surface: #ffffff;
  --surface-soft: #f8f9fa;
  --surface-hover: #f1f3f4;
  --text: #202124;
  --text-secondary: #5f6368;
  --text-tertiary: #80868b;
  --accent: #1a73e8;
  --accent-hover: #1967d2;
  --accent-soft: #e8f0fe;
  --accent-soft-2: #d2e3fc;
  --border: #dadce0;
  --border-soft: #e8eaed;
  --tab-active-bg: #ffffff;
  --tab-active-border: #1a73e8;
  --shadow-sm: 0 1px 2px rgba(60, 64, 67, 0.10), 0 1px 3px 1px rgba(60, 64, 67, 0.06);
  --shadow-md: 0 1px 3px rgba(60, 64, 67, 0.12), 0 4px 8px 3px rgba(60, 64, 67, 0.08);
  --radius: 8px;
  /* Approx visible height of the sticky site header; tab bar sticks below it */
  --header-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg-soft);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-title { font-size: 1.1rem; font-weight: 500; font-family: "Roboto Slab", "Roboto", serif; }
.site-title a { color: var(--text); }
.site-title a:hover { text-decoration: none; color: var(--accent); }

.site-nav { display: flex; gap: 1.5rem; list-style: none; }
.site-nav a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  font-weight: 500;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.container { max-width: 980px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }

h1 {
  font-family: "Roboto Slab", "Roboto", serif;
  font-size: 1.7rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
h2 {
  font-family: "Roboto Slab", "Roboto", serif;
  font-size: 1.25rem;
  margin: 1.5rem 0 0.7rem;
  color: var(--text);
  font-weight: 500;
}
.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  max-width: 42rem;
  line-height: 1.7;
}

/* Home hero */
.home-hero {
  text-align: center;
  padding: 3rem 1.25rem 2rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
}
.home-hero h1 { font-size: 2rem; font-weight: 500; }
.lead {
  color: var(--text-secondary);
  max-width: 42rem;
  margin: 0.85rem auto 0;
  line-height: 1.75;
  font-size: 1rem;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.quick-link {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.4rem 1.35rem;
  border: 1px solid var(--border-soft);
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  display: block;
}
.quick-link:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  transform: translateY(-1px);
}
.quick-link-title {
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.quick-link-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  font-size: 0.92rem;
  background: var(--accent);
  color: #ffffff;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s ease, box-shadow 0.15s ease;
  letter-spacing: 0.02em;
}
.btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.footer {
  border-top: 1px solid var(--border-soft);
  text-align: center;
  padding: 1.4rem;
  color: var(--text-tertiary);
  font-size: 0.82rem;
  margin-top: 2.5rem;
  background: var(--bg);
}
.footer code { font-size: 0.85em; color: var(--text-secondary); }

/* Tabs — horizontal scroll on small screens, sticky to follow the reader */
.tab-bar-outer {
  position: sticky;
  top: var(--header-h);
  z-index: 9;
  background: var(--bg-soft);
  margin: 0 -1.25rem;          /* break out of .container padding */
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border-soft);
}
.tab-bar-outer::before,
.tab-bar-outer::after {
  /* Fade-out gradients hinting that the tab strip can be scrolled sideways.
     Anchored to the inner padding so they sit at the visible strip edges. */
  content: '';
  position: absolute;
  top: 0;
  bottom: 1px;                 /* keep the bottom border visible underneath */
  width: 28px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.tab-bar-outer::before {
  left: 1.25rem;
  background: linear-gradient(to right, var(--bg-soft), rgba(248,249,250,0));
}
.tab-bar-outer::after {
  right: 1.25rem;
  background: linear-gradient(to left, var(--bg-soft), rgba(248,249,250,0));
}
.tab-bar-outer.has-overflow-left::before  { opacity: 1; }
.tab-bar-outer.has-overflow-right::after  { opacity: 1; }

.tab-bar-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tab-bar-wrap::-webkit-scrollbar { height: 0; }    /* hide the scrollbar on the tab strip */
.tab-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.15rem;
  min-width: min-content;
}
.tab-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.7rem 1.1rem;
  font-size: 0.88rem;
  font-family: inherit;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin-bottom: -1px;
  /* Comfortable tap target on touch screens */
  min-height: 44px;
}
.tab-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--tab-active-border);
  background: transparent;
  font-weight: 500;
}

.tab-panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1.75rem 1.85rem;
  min-height: 320px;
  box-shadow: var(--shadow-sm);
}
.tab-panel.active { display: block; }

.tab-panel .loading { color: var(--text-tertiary); font-style: italic; }
.tab-panel .err { color: #c5221f; }

/* Markdown body */
.md-body {
  font-family: "Roboto", sans-serif;
  max-width: 100%;
  overflow-x: auto;
  color: var(--text);
}
.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
  font-family: "Roboto Slab", "Roboto", serif;
  margin-top: 1.4em;
  margin-bottom: 0.5em;
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.md-body h1:first-child { margin-top: 0; }
.md-body h1 { font-size: 1.55rem; color: var(--text); }
.md-body h2 {
  font-size: 1.2rem;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 0.3rem;
  color: var(--text);
}
.md-body h3 { font-size: 1.05rem; color: var(--text); }
.md-body h4 { font-size: 0.96rem; color: var(--text-secondary); }
.md-body p { margin-bottom: 0.95em; line-height: 1.7; }
.md-body ul, .md-body ol { margin: 0.6em 0 1em 1.4rem; }
.md-body li { margin-bottom: 0.4em; line-height: 1.65; }
.md-body strong { color: var(--text); font-weight: 500; }
.md-body em { color: var(--text); }

.md-body code {
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-family: "Roboto Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.86em;
  color: #c5221f;
}
.md-body pre {
  background: var(--surface-soft);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 1.1em 0;
  font-size: 0.85rem;
  line-height: 1.55;
}
.md-body pre code {
  background: none;
  padding: 0;
  border: none;
  color: var(--text);
}
.md-body blockquote {
  border-left: 4px solid var(--accent-soft-2);
  background: var(--accent-soft);
  margin: 1.1em 0;
  padding: 0.6rem 1rem;
  color: var(--text);
  border-radius: 0 6px 6px 0;
}
.md-body blockquote p:last-child { margin-bottom: 0; }

/* Wrap each markdown <table> in <div class="table-scroll"> (added by JS) so
   wide tables scroll inside the panel instead of breaking the page width. */
.md-body .table-scroll {
  margin: 1.2em 0;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* Lea Verou's "scrolling shadows" technique: the white gradients are
     anchored to the content (background-attachment: local) so they slide
     away when the table is scrolled, revealing the shadow gradients which
     stay fixed to the scroll port. Net result: a soft inner shadow appears
     on whichever side has hidden content. */
  background:
    linear-gradient(to right, var(--surface) 30%, rgba(255,255,255,0)) 0 0,
    linear-gradient(to right, rgba(255,255,255,0), var(--surface) 70%) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(60,64,67,0.18), rgba(60,64,67,0)) 0 0,
    radial-gradient(farthest-side at 100% 50%, rgba(60,64,67,0.18), rgba(60,64,67,0)) 100% 0;
  background-repeat: no-repeat;
  background-size: 32px 100%, 32px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
.md-body .table-scroll table {
  margin: 0;
  border: none;
  border-radius: 0;
  /* Allow the table to be as wide as its content; .table-scroll handles overflow. */
  width: auto;
  min-width: 100%;
}
.md-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.2em 0;
  font-size: 0.88rem;
  background: var(--surface);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.md-body th, .md-body td {
  border-bottom: 1px solid var(--border-soft);
  padding: 0.55rem 0.8rem;
  text-align: left;
  vertical-align: top;
}
.md-body th {
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--border);
}
.md-body tr:last-child td { border-bottom: none; }
.md-body tr:hover { background: var(--surface-hover); }

.md-body hr {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 1.75rem 0;
}
.md-body a { color: var(--accent); word-break: break-word; }
.md-body a:hover { color: var(--accent-hover); }

/* Floating "back to top" button (visible only on mobile when scrolled down) */
.to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  z-index: 20;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
}
.to-top.visible {
  display: flex;
  opacity: 0.92;
  transform: translateY(0);
}
.to-top:hover { background: var(--accent-hover); opacity: 1; }
.to-top:focus-visible {
  outline: 2px solid var(--accent-soft-2);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  /* On phones / narrow tablets the tab bar is the most important nav,
     so it takes top: 0 and the site header scrolls away normally. */
  :root { --header-h: 0px; }
  .site-header { position: static; }
}

@media (max-width: 600px) {
  body { font-size: 14.5px; }

  .site-header {
    padding: 0.55rem 0.9rem;
    gap: 0.75rem;
    row-gap: 0.35rem;
  }
  .site-title { font-size: 1rem; }
  .site-nav { gap: 1rem; }
  .site-nav a { font-size: 0.88rem; }

  .container { padding: 1rem 0.9rem 2.25rem; }

  .home-hero { padding: 1.75rem 1rem 1.25rem; }
  .home-hero h1 { font-size: 1.45rem; }
  .lead { font-size: 0.95rem; line-height: 1.65; }

  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.1rem; }
  .subtitle { font-size: 0.9rem; }

  .quick-links { grid-template-columns: 1fr; gap: 0.75rem; margin: 1.25rem 0; }
  .quick-link { padding: 1.1rem 1.1rem; }

  /* Tab bar break-out matches the new container side padding */
  .tab-bar-outer { margin: 0 -0.9rem; padding: 0 0.9rem; }
  .tab-bar-outer::before { left: 0.9rem; }
  .tab-bar-outer::after  { right: 0.9rem; }
  .tab-btn {
    padding: 0.65rem 0.85rem;
    font-size: 0.85rem;
  }

  .tab-panel {
    padding: 1.1rem 1rem 1.25rem;
    border-radius: 0 0 6px 6px;
  }

  .md-body { font-size: 0.95rem; }
  .md-body h1 { font-size: 1.3rem; }
  .md-body h2 { font-size: 1.08rem; }
  .md-body h3 { font-size: 1rem; }
  .md-body pre { font-size: 0.8rem; padding: 0.85rem 0.9rem; }
  .md-body table { font-size: 0.82rem; }
  .md-body th, .md-body td { padding: 0.45rem 0.6rem; }

  .footer { padding: 1.1rem 1rem; font-size: 0.78rem; }
}
