/*
Theme Name: STG Minimal
Theme URI: https://savestogrow.com/
Author: Prashant Thakur
Description: A purpose-built, minimal theme for SavesToGrow — an India-first personal finance tool site. Single-column, no sidebar, no page builder, one webfont. Designed around the calculators: same 760px measure, same emerald system, and tables treated as first-class content.
Version: 1.1.0
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: stg-minimal
Tags: blog, one-column, custom-menu, custom-logo, editor-style
*/

/* ============================================================
   Tokens — the same system the calculators already use, so the
   theme and the widgets read as one product.
   ============================================================ */
:root {
  --ink: #0f1e17;
  --muted: #5a6b62;
  --emerald: #0b6b4f;
  --emerald-dk: #095a42;
  --emerald-soft: #e6f2ec;
  --line: #e4e7e4;
  --bg: #ffffff;
  --bg-soft: #f7f8f6;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: Lora, Georgia, "Times New Roman", serif;

  --measure: 760px;   /* matches the calculators' max-width */
  --wide: 1120px;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

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

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

/* ---------- Accessibility floor ---------- */
.stg-skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--emerald); color: #fff; padding: 10px 16px; z-index: 999;
  border-radius: 0 0 var(--radius) 0; text-decoration: none; font-weight: 600;
}
.stg-skip:focus { left: 0; }

a { color: var(--emerald); text-underline-offset: 2px; }
a:hover { color: var(--emerald-dk); }
:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; border-radius: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   Header
   ============================================================ */
.stg-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.stg-header__in {
  max-width: var(--wide); margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.stg-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex-shrink: 0; }
.stg-brand img { display: block; max-height: 42px; width: auto; }
.stg-brand__text { font-family: var(--serif); font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.stg-brand__tag { display: block; font-family: var(--sans); font-size: 11.5px; font-weight: 400; color: var(--muted); letter-spacing: .01em; }

/* ---------- Nav ---------- */
.stg-nav ul { list-style: none; margin: 0; padding: 0; }
.stg-nav > ul { display: flex; align-items: center; gap: 4px; }
.stg-nav a {
  display: block; padding: 8px 12px; text-decoration: none; color: var(--ink);
  font-size: 15px; font-weight: 500; border-radius: 8px; white-space: nowrap;
}
.stg-nav a:hover { background: var(--emerald-soft); color: var(--emerald-dk); }
.stg-nav .current-menu-item > a,
.stg-nav .current_page_item > a { color: var(--emerald); font-weight: 600; }

/* one level of dropdown — enough for the calculator list, no more */
.stg-nav li { position: relative; }
.stg-nav .menu-item-has-children > a::after { content: "▾"; margin-left: 5px; font-size: 11px; color: var(--muted); }
.stg-nav .sub-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 232px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(15,30,23,.10); padding: 6px;
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: .15s ease; z-index: 60;
}
.stg-nav li:hover > .sub-menu,
.stg-nav li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.stg-nav .sub-menu a { font-weight: 400; font-size: 14.5px; }

.stg-burger {
  display: none; background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; cursor: pointer; line-height: 0;
}
.stg-burger span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; }
.stg-burger span + span { margin-top: 4px; }

@media (max-width: 900px) {
  .stg-burger { display: block; }
  .stg-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(15,30,23,.08); padding: 10px 16px 18px; z-index: 50;
  }
  .stg-header { position: relative; }
  .stg-nav.is-open { display: block; }
  .stg-nav > ul { flex-direction: column; align-items: stretch; gap: 0; }
  .stg-nav a { padding: 11px 8px; border-radius: 6px; }
  .stg-nav .menu-item-has-children > a::after { content: ""; }
  .stg-nav .sub-menu {
    position: static; opacity: 1; visibility: visible; transform: none;
    box-shadow: none; border: 0; border-left: 2px solid var(--emerald-soft);
    border-radius: 0; margin: 0 0 6px 10px; padding: 0 0 0 8px; min-width: 0;
  }
}

/* ============================================================
   Layout
   ============================================================ */
.stg-main { display: block; }
.stg-wrap { max-width: var(--measure); margin: 0 auto; padding: 0 20px; }
.stg-wrap--wide { max-width: var(--wide); }

/* Article + ad sidebar. Single column until there is genuinely room for a
   300px rail beside a comfortable measure — below 1080px the rail would
   squeeze the text, so it collapses away (and is never initialised). */
.stg-wrap--withside { max-width: var(--measure); }
.stg-col-main { min-width: 0; }
@media (min-width: 1080px) {
  .stg-wrap--withside {
    max-width: var(--wide);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 44px;
    align-items: start;
  }
}

/* ---------- Article ---------- */
.stg-article { padding: 34px 0 8px; }
.stg-crumbs { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.stg-crumbs a { color: var(--muted); }
.stg-crumbs a:hover { color: var(--emerald); }

.stg-title {
  font-family: var(--serif); font-weight: 700; letter-spacing: -.015em;
  font-size: clamp(28px, 4.6vw, 40px); line-height: 1.18; margin: 0 0 14px;
}
.stg-meta {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
  font-size: 13.5px; color: var(--muted);
  padding-bottom: 18px; margin-bottom: 24px; border-bottom: 1px solid var(--line);
}
.stg-meta strong { color: var(--ink); font-weight: 600; }
.stg-cat {
  display: inline-block; background: var(--emerald-soft); color: var(--emerald-dk);
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; text-decoration: none; margin-bottom: 12px;
}
.stg-featured { margin: 0 0 26px; }
.stg-featured img { width: 100%; height: auto; border-radius: var(--radius); display: block; }

/* ---------- Content typography ---------- */
.stg-content > * { margin-top: 0; margin-bottom: 1.15em; }
.stg-content h2 {
  font-family: var(--serif); font-weight: 700; letter-spacing: -.01em;
  font-size: clamp(22px, 3vw, 27px); line-height: 1.28; margin: 1.9em 0 .6em;
}
.stg-content h3 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(18.5px, 2.4vw, 21px); line-height: 1.35; margin: 1.6em 0 .5em;
}
.stg-content h4 { font-weight: 700; font-size: 17px; margin: 1.5em 0 .4em; }
.stg-content p, .stg-content li { font-size: 17px; }
.stg-content ul, .stg-content ol { padding-left: 1.3em; }
.stg-content li { margin-bottom: .5em; }
.stg-content li::marker { color: var(--emerald); }
.stg-content strong { font-weight: 650; }
.stg-content img { max-width: 100%; height: auto; border-radius: var(--radius); }
.stg-content hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0; }

.stg-content blockquote {
  margin: 1.6em 0; padding: 4px 0 4px 20px;
  border-left: 3px solid var(--emerald); color: var(--muted);
  font-family: var(--serif); font-size: 18.5px; font-style: italic;
}
.stg-content blockquote p:last-child { margin-bottom: 0; }

.stg-content code {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 5px;
  padding: 1px 5px; font-size: .9em;
}
.stg-content pre {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; overflow-x: auto;
}

/* ---------- Signature: tables as first-class content ----------
   Finance content is rate bands, fee comparisons, slabs. These
   should read like data, and stay usable on a phone.            */
.stg-content .wp-block-table,
.stg-content figure.wp-block-table { margin: 1.7em 0; overflow-x: auto; }
.stg-content table {
  width: 100%; border-collapse: collapse; font-size: 15.5px;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.stg-content thead th {
  background: var(--emerald-soft); color: var(--emerald-dk);
  font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  text-align: left; padding: 11px 14px; white-space: nowrap;
}
.stg-content tbody td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.stg-content tbody tr:nth-child(even) { background: var(--bg-soft); }
.stg-content table a { font-weight: 500; }

/* ============================================================
   Post list (blog index, archives, search)
   ============================================================ */
.stg-arch-head { padding: 38px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.stg-arch-head h1 {
  font-family: var(--serif); font-weight: 700; letter-spacing: -.015em;
  font-size: clamp(26px, 4vw, 36px); line-height: 1.2; margin: 0 0 8px;
}
.stg-arch-head p { margin: 0; color: var(--muted); font-size: 15.5px; }

.stg-list { list-style: none; margin: 0; padding: 0; }
.stg-item { padding: 24px 0; border-bottom: 1px solid var(--line); }
.stg-item:last-child { border-bottom: 0; }
.stg-item h2 {
  font-family: var(--serif); font-weight: 700; font-size: clamp(19px, 2.6vw, 23px);
  line-height: 1.3; margin: 6px 0 8px; letter-spacing: -.01em;
}
.stg-item h2 a { color: inherit; text-decoration: none; }
.stg-item h2 a:hover { color: var(--emerald); }
.stg-item__meta { font-size: 12.5px; color: var(--muted); }
.stg-item__ex { margin: 0; color: var(--muted); font-size: 15.5px; }

.stg-pager { display: flex; gap: 8px; flex-wrap: wrap; padding: 28px 0 8px; }
.stg-pager .page-numbers {
  display: inline-block; padding: 8px 13px; border: 1px solid var(--line);
  border-radius: 8px; text-decoration: none; color: var(--ink); font-size: 14.5px;
}
.stg-pager .page-numbers:hover { border-color: var(--emerald); color: var(--emerald); }
.stg-pager .page-numbers.current { background: var(--emerald); border-color: var(--emerald); color: #fff; font-weight: 600; }

/* ============================================================
   Footer
   ============================================================ */
.stg-footer {
  margin-top: 56px; border-top: 1px solid var(--line);
  background: var(--bg-soft); padding: 30px 0 34px;
}
.stg-footer__in { max-width: var(--wide); margin: 0 auto; padding: 0 20px; }
.stg-footer ul { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.stg-footer a { color: var(--ink); text-decoration: none; font-size: 14.5px; }
.stg-footer a:hover { color: var(--emerald); text-decoration: underline; }
.stg-footer__note { font-size: 13px; color: var(--muted); margin: 0; max-width: 720px; }
.stg-footer__note + .stg-footer__note { margin-top: 8px; }

/* ============================================================
   404 / search form
   ============================================================ */
.stg-404 { padding: 60px 0; text-align: center; }
.stg-404 h1 { font-family: var(--serif); font-size: clamp(28px,5vw,40px); margin: 0 0 10px; }
.stg-404 p { color: var(--muted); margin: 0 0 22px; }
.stg-search { display: flex; gap: 8px; max-width: 420px; margin: 0 auto; }
.stg-search input[type=search] {
  flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; font-family: inherit; color: var(--ink); background: var(--bg);
}
.stg-search button {
  background: var(--emerald); color: #fff; border: 0; border-radius: 8px;
  padding: 11px 18px; font-weight: 600; font-size: 15px; cursor: pointer; font-family: inherit;
}
.stg-search button:hover { background: var(--emerald-dk); }

/* Let full-width pages (the tool hub) run edge to edge */
.stg-fullwidth { padding: 0; }
.stg-fullwidth .stg-wrap { max-width: none; padding: 0; }
