/* ==========================================================================
   Greenhills — Fee Structure page
   Page-scoped components only. Every value below is derived from the tokens
   already declared in styles.css (--navy-950, --accent, --line, --mist, 8px
   radius, the clamp() type scale). Nothing here introduces a second system.

   The site had no table styling at all before this page, so the fee tables
   are the first — they are built to degrade into stacked cards on phones
   rather than scroll, because a 6-column money table cannot be read at 320px.
   ========================================================================== */

.page-hero--fees { --hero-image: url('/assets/campus-drone.jpg'); }

/* The drone shot is brighter in its upper third than the other page heroes,
   which drops the accent-green breadcrumb to 4.27:1 over its lightest pixels.
   A top scrim pulls it back above 4.5:1 without changing the breadcrumb colour
   (keeping it consistent with every other page hero). Sits behind the hero
   content, which is already position:relative/z-index:1 in styles.css. */
.page-hero--fees::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 22, 37, .55), rgba(6, 22, 37, .15) 45%, rgba(6, 22, 37, 0));
}

/* Breadcrumb is a real <nav> with links here (the other pages use static
   text), so the separators must not be announced or selectable. */
.fee-breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  margin: 0;
  padding: 0;
}
.fee-breadcrumb li { display: flex; align-items: center; gap: .45rem; }
.fee-breadcrumb li + li::before {
  content: "/";
  color: rgba(255, 255, 255, .45);
  font-weight: 400;
}
.fee-breadcrumb a { text-decoration: underline; text-underline-offset: 3px; }
.fee-breadcrumb a:hover { color: #fff; }
.fee-breadcrumb [aria-current="page"] { color: rgba(255, 255, 255, .72); }

/* ── Intro ───────────────────────────────────────────────────────────── */
.fee-intro { max-width: 780px; margin: 0 auto; text-align: center; }
.fee-intro p {
  color: var(--muted);
  font-size: var(--text-lg);
  line-height: var(--lh-body);
  margin: 0;
}
.fee-intro a {
  color: var(--blue-700);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.fee-intro a:hover { color: var(--accent-hover); }

/* ── Shared table shell ──────────────────────────────────────────────── */
.fee-card {
  width: min(1080px, 100%);
  margin: 0 auto;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(8, 27, 49, .06);
  overflow: hidden;
}
.fee-card--feature {
  box-shadow: var(--shadow);
  border-color: rgba(8, 27, 49, .18);
}
/* The accent rule is decorative reinforcement of "this is the headline
   number" — the heading and copy carry the same meaning without it. */
.fee-card--feature::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--blue-700));
}

.fee-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.fee-table caption {
  caption-side: top;
  text-align: left;
  padding: 1.1rem 1.15rem .4rem;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--blue-700);
}
.fee-table th,
.fee-table td {
  padding: .85rem 1.15rem;
  text-align: left;
  border-bottom: 1px solid rgba(8, 27, 49, .09);
}
.fee-table thead th {
  background: var(--navy-950);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-xs);
  letter-spacing: .07em;
  text-transform: uppercase;
  border-bottom: 0;
  white-space: nowrap;
}
.fee-table tbody th[scope="row"] {
  font-weight: 700;
  color: var(--navy-850);
  white-space: nowrap;
}
.fee-table tbody tr:nth-child(even) { background: var(--mist); }
.fee-table tbody tr:last-child th,
.fee-table tbody tr:last-child td { border-bottom: 0; }

/* Money cells: right-aligned and tabular so digits line up column-wise,
   which is what makes a fee table scannable at a glance.
   NB: must out-specify `.fee-table th, .fee-table td { text-align:left }`
   above — a bare `.fee-num` loses to it and the figures render left-aligned
   while their headers stay right-aligned. */
.fee-table th.fee-num,
.fee-table td.fee-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}
.fee-nil { color: var(--muted); }

/* Emphasised total column / row */
.fee-total {
  font-weight: 700;
  color: var(--navy-950);
  background: rgba(46, 125, 50, .05);
}
.fee-table tbody tr:nth-child(even) .fee-total { background: rgba(46, 125, 50, .08); }

/* Total row. Kept light rather than solid navy: the navy .fee-headline banner
   below already carries the annual figure, and two full-width dark blocks in
   a row read as a repeat rather than as emphasis. The accent top rule plus
   weight and size mark it as the total without relying on colour alone. */
.fee-row-total th,
.fee-row-total td {
  background: rgba(46, 125, 50, .1);
  color: var(--navy-950);
  font-size: var(--text-base);
  font-weight: 700;
  padding-top: 1.05rem;
  padding-bottom: 1.05rem;
  border-top: 2px solid var(--accent);
}
.fee-table tbody tr.fee-row-total th[scope="row"] { color: var(--navy-950); }

/* ── Notes under a table ─────────────────────────────────────────────── */
.fee-note {
  width: min(1080px, 100%);
  margin: 1rem auto 0;
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  padding: .95rem 1.1rem;
  background: var(--blue-100);
  border-left: 3px solid var(--blue-700);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.fee-note svg { flex: none; margin-top: .15rem; color: var(--blue-700); }
.fee-note strong { color: var(--navy-850); }

/* ── One-time fees callout ───────────────────────────────────────────── */
.fee-oneoff {
  width: min(1080px, 100%);
  margin: 1.5rem auto 0;
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.35rem 1.5rem;
  box-shadow: 0 12px 32px rgba(8, 27, 49, .045);
}
.fee-oneoff h3 {
  font-size: var(--card-title);
  line-height: var(--lh-title);
  margin: 0 0 .3rem;
}
.fee-oneoff > p {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: 1.55;
}
.fee-oneoff dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
  margin: 0;
}
.fee-oneoff div {
  background: var(--mist);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .9rem 1rem;
}
.fee-oneoff dt {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--blue-700);
  margin: 0 0 .3rem;
}
.fee-oneoff dd {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--navy-950);
  font-variant-numeric: tabular-nums;
}

/* ── Inclusions note, attached to the foot of a table card ───────────── */
/* Replaces an earlier full-width navy banner that restated ₹1,20,000 at
   ~3rem. The figure is already the emphasised total row directly above, and
   repeating the largest number on the page in a dark slab makes cost the
   loudest element — the wrong signal on a fee page. This says what the fee
   buys instead, quietly, and stays inside the card it belongs to. */
.fee-card-note {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0;
  padding: .85rem 1.15rem;
  background: var(--mist);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.fee-card-note svg { flex: none; color: var(--accent); }

/* ── FAQs ────────────────────────────────────────────────────────────── */
.fee-faq { width: min(820px, 100%); margin: 0 auto; display: grid; gap: .75rem; }
.fee-faq details {
  background: var(--warm-white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(8, 27, 49, .045);
}
.fee-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-ui);
  font-size: var(--text-card);
  font-weight: 700;
  line-height: 1.4;
  color: var(--navy-850);
  border-radius: 8px;
}
.fee-faq summary::-webkit-details-marker { display: none; }
.fee-faq summary:hover { background: var(--blue-100); }
.fee-faq summary:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}
.fee-faq summary::after {
  content: "";
  flex: none;
  width: .6rem;
  height: .6rem;
  border-right: 2px solid var(--blue-700);
  border-bottom: 2px solid var(--blue-700);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .2s;
}
.fee-faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.fee-faq details[open] summary { border-radius: 8px 8px 0 0; }
.fee-faq .fee-faq-body {
  padding: 0 1.25rem 1.25rem;
  color: var(--muted);
  font-size: var(--text-card);
  line-height: 1.66;
}
.fee-faq .fee-faq-body p { margin: 0; }

/* ── Responsive ──────────────────────────────────────────────────────── */

/* Tablet: pull the horizontal padding in so wide tables keep breathing room. */
@media (max-width: 1100px) {
  .fee-table th,
  .fee-table td { padding: .8rem .85rem; }
}

/* Phone / small tablet — the card transform.
   Each <tr> becomes a self-contained card so nothing overflows and no font
   is shrunk. The DOM is untouched: this is the same single semantic table,
   which is what keeps the fee data crawlable and non-duplicated. Explicit
   ARIA roles in the markup preserve table semantics for screen readers,
   because display:block otherwise strips them. */
@media (max-width: 860px) {
  .fee-card--cards {
    background: none;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }
  .fee-card--cards.fee-card--feature::before { display: none; }

  .fee-table--cards,
  .fee-table--cards tbody,
  .fee-table--cards tr,
  .fee-table--cards th,
  .fee-table--cards td { display: block; }

  /* The caption must become a block too. Left as display:table-caption inside
     a table that is now display:block, it gets wrapped in an anonymous table
     box that shrink-to-fits — rendering as a ~90px ragged column. Blocking it
     restores full width; the tighter tracking and sentence case then keep it
     to two lines instead of six. */
  .fee-table--cards caption {
    display: block;
    width: 100%;
    padding: 0 0 .75rem;
    letter-spacing: .04em;
    text-transform: none;
    font-size: var(--text-sm);
  }

  /* Column headers are re-exposed per cell via data-label, so the header
     row is hidden visually but kept for assistive tech. */
  .fee-table--cards thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .fee-table--cards tbody tr {
    background: var(--warm-white) !important;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(8, 27, 49, .05);
    margin-bottom: .85rem;
    overflow: hidden;
  }
  .fee-table--cards tbody tr:last-child { margin-bottom: 0; }

  .fee-table--cards tbody th[scope="row"] {
    background: var(--navy-950);
    color: #fff;
    font-size: var(--text-card);
    padding: .8rem 1rem;
    border-bottom: 0;
    white-space: normal;
  }

  .fee-table--cards tbody td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem 1rem;
    border-bottom: 1px solid rgba(8, 27, 49, .08);
    text-align: right;
  }
  .fee-table--cards tbody td::before {
    content: attr(data-label);
    flex: none;
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    font-size: var(--text-xs);
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .fee-table--cards tbody tr td:last-child { border-bottom: 0; }
  .fee-table--cards tbody td.fee-total {
    background: rgba(46, 125, 50, .07) !important;
    font-size: var(--text-card);
  }
  .fee-table--cards tbody td.fee-total::before { color: var(--navy-850); }

  .fee-oneoff dl { grid-template-columns: 1fr; }

  /* The hostel card keeps its table at all widths (2 columns fit fine), so
     its foot note keeps the card's rounded bottom corners. */
  .fee-card-note { border-radius: 0 0 8px 8px; }
}

@media (max-width: 680px) {
  .fee-intro { text-align: left; }
  .fee-intro p { font-size: var(--text-base); }
  .fee-oneoff { padding: 1.15rem 1.1rem; }
  .fee-note { font-size: var(--text-xs); }
  .fee-faq summary { padding: .95rem 1.05rem; }
  .fee-faq .fee-faq-body { padding: 0 1.05rem 1.05rem; }
}

/* Very narrow phones (~320px): stack label above value so long ranges like
   ₹1,58,000–1,60,000 never collide with their label or clip. */
@media (max-width: 400px) {
  .fee-table--cards tbody td,
  .fee-table.fee-table--cards tbody td.fee-num {
    flex-direction: column;
    align-items: flex-start;
    gap: .15rem;
    text-align: left;
  }
  .fee-table--cards tbody td::before { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .fee-faq summary::after { transition: none; }
}
