/* =========================================================
   calculator.css — PAGE-SPECIFIC (Personal Loan Calculator)
   Depends on tokens/base defined in style.css — load style.css first.
   ========================================================= */

.wrap{
  max-width:1080px;
  margin:0 auto;
  padding:56px 28px 40px;
}

header.page-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:24px;
  margin-bottom:44px;
  border-bottom:2px solid var(--ink);
  padding-bottom:20px;
}
.eyebrow{
  font-family:'IBM Plex Mono', monospace;
  font-size:12px;
  letter-spacing:.14em;
  text-transform:uppercase;
  color:var(--emerald);
  font-weight:600;
  margin:0 0 10px;
}
h1{
  font-family:'Space Grotesk', sans-serif;
  font-size:clamp(28px, 4vw, 42px);
  line-height:1.08;
  margin:0;
  font-weight:600;
  letter-spacing:-.01em;
  max-width:560px;
}
.ledger-id{
  font-family:'IBM Plex Mono', monospace;
  font-size:12px;
  color:var(--muted);
  text-align:right;
  line-height:1.6;
  white-space:nowrap;
}

.grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:32px;
  align-items:start;
}
@media (max-width:820px){
  .grid{grid-template-columns:1fr;}
  .ledger-id{display:none;}
}

/* ---------- Input panel ---------- */
.panel{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:32px 30px 8px;
}
.panel-title{
  font-family:'Space Grotesk', sans-serif;
  font-size:14px;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.08em;
  margin:0 0 26px;
  display:flex;
  align-items:center;
  gap:10px;
}
.panel-title::after{
  content:'';
  flex:1;
  height:1px;
  background:var(--line);
}

.field{
  margin-bottom:30px;
}
.field-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom:12px;
  gap:8px 12px;
}
.field-label{
  font-size:13px;
  font-weight:500;
  color:var(--ink);
}

.value-input-wrap{
  display:flex;
  align-items:baseline;
  gap:5px;
  border-bottom:1.5px solid var(--line);
  padding-bottom:2px;
  transition:border-color .15s ease;
}
.value-input-wrap:focus-within{border-color:var(--emerald);}
.value-input-wrap .prefix{
  font-family:'IBM Plex Mono', monospace;
  font-size:15px;
  color:var(--muted);
}
.value-input-wrap input{
  font-family:'IBM Plex Mono', monospace;
  font-size:17px;
  font-weight:600;
  color:var(--emerald);
  border:none;
  background:transparent;
  outline:none;
  width:11ch;
  min-width:0;
  text-align:right;
  font-variant-numeric:tabular-nums;
}
.value-input-wrap input#amountInput{width:11ch;}
.value-input-wrap input[type=number]{
  -moz-appearance:textfield;
}
.value-input-wrap input[type=number]::-webkit-outer-spin-button,
.value-input-wrap input[type=number]::-webkit-inner-spin-button{
  -webkit-appearance:none;
  margin:0;
}
.value-input-wrap input#rateInput{width:6.5ch;}
.value-input-wrap input#tenureInput{width:4ch;}
.value-input-wrap .unit{
  font-size:12px;
  color:var(--muted);
  font-weight:400;
}

input[type=range]{
  -webkit-appearance:none;
  appearance:none;
  width:100%;
  height:2px;
  background:var(--line);
  border-radius:2px;
  outline:none;
  margin:6px 0;
  cursor:grab;
}
input[type=range]:active{cursor:grabbing;}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;
  width:16px; height:16px;
  border-radius:50%;
  background:var(--emerald);
  border:3px solid var(--card);
  box-shadow:0 0 0 1px var(--emerald);
  cursor:grab;
  transition:transform .12s ease;
}
input[type=range]::-webkit-slider-thumb:hover{transform:scale(1.15);}
input[type=range]:active::-webkit-slider-thumb{cursor:grabbing; transform:scale(1.2);}
input[type=range]::-moz-range-thumb{
  width:14px; height:14px;
  border-radius:50%;
  background:var(--emerald);
  border:3px solid var(--card);
  box-shadow:0 0 0 1px var(--emerald);
  cursor:grab;
}
input[type=range]:focus-visible::-webkit-slider-thumb{
  box-shadow:0 0 0 3px var(--emerald-dim), 0 0 0 1px var(--emerald);
}

.range-scale{
  display:flex;
  justify-content:space-between;
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  color:var(--muted);
  margin-top:4px;
}

.toggle-row{
  display:inline-flex;
  border:1px solid var(--line);
  border-radius:20px;
  padding:2px;
  margin-top:4px;
}
.toggle-row button{
  border:none;
  background:transparent;
  font-family:'IBM Plex Mono', monospace;
  font-size:12px;
  padding:6px 14px;
  border-radius:18px;
  cursor:pointer;
  color:var(--muted);
  transition:.15s ease;
}
.toggle-row button.active{
  background:var(--ink);
  color:var(--card);
}

/* ---------- Statement panel ---------- */
.statement{
  position:relative;
  background:var(--card);
  border:1px solid var(--line);
  border-top:none;
  border-radius:0 0 var(--radius) var(--radius);
  padding:44px 30px 30px;
}
.statement::before{
  content:'';
  position:absolute;
  top:-1px; left:0; right:0;
  height:16px;
  background-image: radial-gradient(circle at 11px 8px, var(--paper) 7px, transparent 7.5px);
  background-size:22px 16px;
  background-repeat:repeat-x;
  background-position: -3px 0;
}
.statement::after{
  content:'STATEMENT';
  position:absolute;
  top:16px; right:30px;
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  letter-spacing:.14em;
  color:var(--muted);
}

.emi-label{
  font-family:'IBM Plex Mono', monospace;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.1em;
  color:var(--muted);
  margin:0 0 8px;
}
.emi-value{
  font-family:'IBM Plex Mono', monospace;
  font-size:clamp(38px, 5.5vw, 54px);
  font-weight:700;
  line-height:1;
  color:var(--ink);
  font-variant-numeric:tabular-nums;
  letter-spacing:-.01em;
}
.emi-value .cur{
  font-size:.5em;
  color:var(--emerald);
  vertical-align:top;
  margin-right:4px;
  font-weight:600;
}
.emi-sub{
  font-size:12.5px;
  color:var(--muted);
  margin-top:8px;
}

.divider-dashed{
  border:none;
  border-top:1px dashed var(--line);
  margin:26px 0;
}

.row{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  padding:9px 0;
  font-size:13.5px;
}
.row + .row{border-top:1px solid #eceae2;}
.row .k{color:var(--muted);}
.row .v{
  font-family:'IBM Plex Mono', monospace;
  font-weight:600;
  font-variant-numeric:tabular-nums;
}
.row.total .v{color:var(--ink); font-size:15px;}
.row .v.interest{color:var(--amber-text);}

.bar-wrap{margin-top:22px;}
.bar{
  display:flex;
  height:10px;
  width:100%;
  border-radius:5px;
  overflow:hidden;
  background:var(--line);
}
.bar .seg-principal{background:var(--emerald); transition:width .25s ease;}
.bar .seg-interest{background:var(--amber); transition:width .25s ease;}
.bar-legend{
  display:flex;
  justify-content:space-between;
  margin-top:10px;
  font-family:'IBM Plex Mono', monospace;
  font-size:11.5px;
}
.bar-legend span{display:inline-flex; align-items:center; gap:6px; color:var(--muted);}
.dot{width:8px; height:8px; border-radius:50%; display:inline-block;}
.dot.p{background:var(--emerald);}
.dot.i{background:var(--amber);}

.chart-toggle-row{
  margin-top:28px;
  display:flex;
  justify-content:center;
}
.chart-toggle-btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background:var(--card);
  border:1px solid var(--line);
  color:var(--ink);
  font-family:'IBM Plex Mono', monospace;
  font-size:12.5px;
  font-weight:600;
  letter-spacing:.02em;
  padding:10px 20px;
  border-radius:20px;
  cursor:pointer;
  transition:border-color .15s ease, color .15s ease;
}
.chart-toggle-btn:hover{border-color:var(--emerald); color:var(--emerald);}
.chart-toggle-icon{font-size:14px;}
.chart-toggle-btn[aria-expanded="true"]{background:var(--ink); color:var(--card); border-color:var(--ink);}

.chart-panel{
  margin-top:22px;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:28px 30px 24px;
}
.chart-panel .panel-title{margin-bottom:20px;}

.amort-top{
  display:flex;
  align-items:center;
  gap:36px;
  flex-wrap:wrap;
  padding-bottom:8px;
}
.donut-wrap{
  position:relative;
  width:180px;
  height:180px;
  flex:0 0 auto;
}
.donut-wrap svg{width:100%; height:100%; transform:rotate(-90deg);}
.donut-center{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
}
.donut-center-label{
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--muted);
}
.donut-center-value{
  font-family:'Space Grotesk', sans-serif;
  font-size:26px;
  font-weight:700;
  color:var(--amber);
  margin-top:2px;
}
.donut-legend{
  flex:1 1 200px;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.donut-legend-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:20px;
  padding-bottom:14px;
  border-bottom:1px solid #eceae2;
  font-size:13.5px;
}
.donut-legend-row:last-child{border-bottom:none; padding-bottom:0;}
.donut-legend-row span{display:inline-flex; align-items:center; gap:8px; color:var(--muted);}
.donut-legend-row b{
  font-family:'IBM Plex Mono', monospace;
  font-size:15px;
  color:var(--ink);
}

.amort-controls{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  flex-wrap:wrap;
  gap:6px 14px;
  margin-top:30px;
  padding-top:24px;
  border-top:1px dashed var(--line);
}
.amort-controls .panel-title{margin:0; border:none;}
.amort-controls .panel-title::after{display:none;}
.amort-hint{
  font-size:12px;
  color:var(--muted);
  margin:0;
}

.accordion-head, .year-header, .month-row{
  display:grid;
  grid-template-columns:1.5fr 1fr 1fr 1fr;
  align-items:center;
  gap:10px;
}
.accordion-head{
  background:var(--ink);
  color:var(--card);
  font-family:'IBM Plex Mono', monospace;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.06em;
  font-weight:600;
  padding:10px 14px;
  border-radius:var(--radius) var(--radius) 0 0;
  margin-top:16px;
}
.accordion-head span:not(:first-child){text-align:right;}

.accordion-wrap{
  max-height:380px;
  overflow-y:auto;
  border:1px solid var(--line);
  border-top:none;
  border-radius:0 0 var(--radius) var(--radius);
}
.year-block + .year-block{border-top:1px solid var(--line);}

.year-header{
  width:100%;
  background:var(--card);
  border:none;
  padding:12px 14px;
  cursor:pointer;
  font-family:'IBM Plex Mono', monospace;
  font-size:12.5px;
  color:var(--ink);
  text-align:left;
  transition:background .12s ease;
}
.year-header:hover{background:var(--paper);}
.year-header.open{background:var(--paper);}
.year-name{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:600;
}
.year-chevron{
  display:inline-block;
  font-size:10px;
  color:var(--emerald);
  transition:transform .15s ease;
}
.year-header.open .year-chevron{transform:rotate(90deg);}
.year-header span:not(.year-name){
  text-align:right;
  font-variant-numeric:tabular-nums;
}
.yf.p{color:var(--emerald);}
.yf.i{color:var(--amber-text);}
.yf.b{color:var(--ink);}

.month-panel{
  background:#f5f4ef;
  border-top:1px dashed var(--line);
}
.month-row{
  padding:7px 14px 7px 34px;
  font-family:'IBM Plex Mono', monospace;
  font-size:12px;
  color:var(--muted);
}
.month-row:not(:last-child){border-bottom:1px solid #eae8e0;}
.month-row span:first-child{color:var(--ink); font-weight:500;}
.month-row span:not(:first-child){text-align:right; font-variant-numeric:tabular-nums;}
.month-row .m-interest{color:var(--amber-text);}
.month-row .m-balance{color:var(--ink);}

.disclaimer{
  margin-top:36px;
  font-family:'IBM Plex Mono', monospace;
  font-size:11.5px;
  color:var(--muted);
}

/* ---------- FAQ (SEO content) ---------- */
.faq-section{
  margin-top:56px;
  padding-top:36px;
  border-top:2px solid var(--ink);
}
.faq-section h2{
  font-family:'Space Grotesk', sans-serif;
  font-size:22px;
  font-weight:600;
  margin:0 0 24px;
}
.faq-item{
  border-bottom:1px solid var(--line);
  padding:18px 0;
}
.faq-item h3{
  font-family:'Inter', sans-serif;
  font-size:14.5px;
  font-weight:600;
  margin:0 0 8px;
}
.faq-item p{
  font-size:13.5px;
  line-height:1.65;
  color:var(--muted);
  margin:0;
  max-width:760px;
}

/* ---------- Mobile refinements ---------- */
@media (max-width:600px){
  .wrap{padding:36px 18px 32px;}

  header.page-head{
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
  }

  .panel{padding:24px 18px 6px;}
  .statement{padding:36px 18px 22px;}
  .statement::after{right:18px;}

  .emi-value{font-size:clamp(32px, 10vw, 44px);}

  .value-input-wrap input{font-size:16px;}
  .value-input-wrap input#amountInput{width:11ch;}

  .chart-panel{padding:22px 16px 18px;}

  .amort-top{gap:20px;}
  .donut-wrap{width:132px; height:132px;}
  .donut-center-value{font-size:20px;}

  .amort-controls{flex-direction:column; align-items:flex-start; gap:6px;}

  /* Accordion rows: allow horizontal scroll instead of crushing columns */
  .accordion-head, .year-header, .month-row{
    grid-template-columns:96px 88px 88px 88px;
    gap:8px;
  }
  .accordion-head{overflow-x:auto;}
  .accordion-wrap{overflow-x:auto;}
  .year-block{min-width:360px;}
  .accordion-head{min-width:360px;}
  .month-row{padding-left:26px;}

  .faq-section{margin-top:40px; padding-top:26px;}
  .faq-section h2{font-size:19px;}
}

@media (max-width:360px){
  .value-input-wrap input#amountInput{width:10ch;}
  .donut-wrap{width:112px; height:112px;}
}
