:root {
  --ink: #171717;
  --muted: #606060;
  --line: #d2d2d2;
  --surface: #ffffff;
  --soft: #f5f5f5;
  --blue: #111111;
  --teal: #111111;
  --teal-dark: #000000;
  --danger: #a03838;
  --radius: 4px;
  --shadow: 0 2px 7px rgba(0, 0, 0, .10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }

.wrap {
  width: min(1160px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #111111;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  font-weight: 700;
}
.brand::after { content: "CalcSetu"; }
.brand img {
  display: block;
  width: 42px;
  height: 42px;
  object-fit: cover;
}

.main-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 14px;
  font-weight: 600;
}

.main-nav a:hover,
.main-nav a:focus-visible { color: var(--teal-dark); }

.menu-button {
  display: none;
  margin-left: auto;
  border: 1px solid var(--line);
  background: white;
  border-radius: 3px;
  padding: 8px 11px;
  color: var(--ink);
}

.hero {
  padding: 42px 0 38px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
  gap: 42px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal-dark);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 13px;
  font-weight: 800;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 680px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 5vw, 50px);
  line-height: 1.12;
  letter-spacing: -.015em;
  margin-bottom: 18px;
}

.hero-text {
  max-width: 650px;
  color: var(--muted);
  font-size: 18px;
  margin-bottom: 24px;
}

.tool-search {
  display: flex;
  max-width: 660px;
  background: white;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: none;
}

.tool-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 15px 16px;
  color: var(--ink);
  background: transparent;
}

.tool-search button {
  border: 0;
  background: var(--teal-dark);
  color: white;
  padding: 0 21px;
  font-weight: 750;
}

.popular-links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 14px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.popular-links a {
  color: var(--blue);
  font-weight: 700;
}

.scientific-calculator {
  background: #111111;
  border: 1px solid #000000;
  border-radius: 4px;
  padding: 16px;
  box-shadow: 0 3px 10px rgba(0,0,0,.18);
}

.scientific-calculator .calculator-topline h2 { color: #ffffff; }
.scientific-calculator .calculator-topline p { color: #bdbdbd; }

.calculator-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.calculator-topline h2 {
  margin-bottom: 1px;
  font-size: 18px;
}

.calculator-topline p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.mode-button {
  border: 1px solid #777777;
  border-radius: 3px;
  background: #292929;
  color: #ffffff;
  padding: 7px 9px;
  font-weight: 800;
  font-size: 12px;
}

.calculator-display {
  min-height: 88px;
  background: #050505;
  border: 1px solid #4b4b4b;
  border-radius: 3px;
  padding: 12px 14px;
  margin-bottom: 10px;
  text-align: right;
  overflow: hidden;
}

.expression {
  min-height: 24px;
  color: #bcbcbc;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.result {
  display: block;
  margin-top: 4px;
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 780;
  color: #ffffff;
  overflow-wrap: anywhere;
}

.calculator-keys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.key {
  min-height: 44px;
  border: 1px solid #505050;
  background: #333333;
  border-radius: 3px;
  color: #ffffff;
  font-weight: 700;
}

.key:hover { background: #424242; }
.key:active { transform: translateY(1px); }

.key-soft { background: #5a5a5a; }
.key-fn { color: #ffffff; background: #252525; }
.key-op { color: #111111; background: #e4e4e4; border-color: #e4e4e4; }
.key-zero { grid-column: span 2; }
.key-equals {
  grid-column: span 2;
  background: #ffffff;
  border-color: #ffffff;
  color: #000000;
}

.categories { padding: 48px 0; }

.section-heading { margin-bottom: 24px; }
.section-heading h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 4vw, 34px);
  margin-bottom: 7px;
  letter-spacing: -.02em;
}
.section-heading p { color: var(--muted); margin: 0; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.category-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 19px;
  min-height: 178px;
  transition: border-color .15s ease, background .15s ease;
}

.category-card:hover {
  border-color: #a8a8a8;
  background: var(--soft);
}

.category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding-inline: 8px;
  border-radius: 3px;
  background: #eeeeee;
  color: var(--blue);
  font-weight: 850;
  margin-bottom: 17px;
}

.category-card h3 { margin-bottom: 7px; font-size: 18px; }
.category-card p { margin: 0; color: var(--muted); font-size: 14px; }

.why-section {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--soft);
  padding: 42px 0;
}

.why-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: start;
}

.why-grid h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
  margin-bottom: 11px;
}
.why-grid p { color: var(--muted); margin-bottom: 0; }

.feature-list {
  display: grid;
  gap: 12px;
}

.feature-list div {
  display: grid;
  grid-template-columns: 115px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.feature-list div:last-child { border-bottom: 0; }
.feature-list span { color: var(--muted); }

.site-footer {
  padding: 34px 0 22px;
  background: white;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.footer-grid p { color: var(--muted); margin: 5px 0 0; }
.footer-grid nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 14px;
}

.footer-grid nav a:hover { color: var(--blue); }

.copyright {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

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

:focus-visible {
  outline: 3px solid rgba(0, 0, 0, .22);
  outline-offset: 2px;
}

@media (max-width: 1040px) {
  .main-nav { display: none; }
  .main-nav.is-open {
    display: flex;
    position: absolute;
    top: 74px;
    left: 16px;
    right: 16px;
    flex-direction: column;
    align-items: stretch;
    background: white;
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 12px;
    box-shadow: var(--shadow);
  }
  .main-nav.is-open a { padding: 8px; }
  .menu-button { display: block; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .hero { padding-top: 36px; }
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .scientific-calculator { max-width: 520px; }
  .why-grid { grid-template-columns: 1fr; gap: 26px; }
}

@media (max-width: 560px) {
  .wrap { width: min(100% - 22px, 1160px); }
  .header-inner { min-height: 66px; }
  .brand { font-size: 22px; }
  .brand img { width: 38px; height: 38px; }
  .main-nav.is-open { top: 66px; left: 10px; right: 10px; }

  h1 { font-size: 35px; }
  .hero-text { font-size: 16px; }

  .tool-search { display: grid; border-radius: 3px; }
  .tool-search button { min-height: 44px; }
  .popular-links { font-size: 13px; }

  .scientific-calculator { padding: 12px; border-radius: 4px; }
  .calculator-keys { gap: 5px; }
  .key { min-height: 42px; font-size: 13px; }

  .categories { padding: 46px 0; }
  .category-grid { grid-template-columns: 1fr; }
  .category-card { min-height: 0; padding: 18px; }

  .footer-grid { flex-direction: column; }
}


/* Category and collection pages */
.page-hero {
  padding: 42px 0 34px;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}
.narrow { max-width: 860px; }
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
}
.breadcrumbs a { color: var(--blue); }
.page-icon {
  display: inline-flex;
  min-width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  padding-inline: 9px;
  border-radius: 3px;
  background: #eeeeee;
  color: var(--blue);
  font-weight: 850;
  margin-bottom: 14px;
}
.page-hero h1 {
  font-size: clamp(32px, 5vw, 46px);
  line-height: 1.08;
  letter-spacing: -.015em;
  font-family: Georgia, "Times New Roman", serif;
  margin-bottom: 11px;
}
.page-hero p {
  color: var(--muted);
  font-size: 17px;
  max-width: 760px;
  margin-bottom: 0;
}
.tool-list-section { padding: 42px 0 56px; }
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}
.tool-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px;
  background: white;
  min-height: 118px;
  transition: border-color .15s ease, background .15s ease;
}
.tool-card:hover {
  border-color: #aaaaaa;
  background: var(--soft);
}
.tool-card h2 {
  font-size: 17px;
  line-height: 1.3;
  margin-bottom: 9px;
}
.tool-card p {
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}
.tool-category {
  display: block;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 7px;
}
.category-copy {
  padding: 46px 0;
  background: var(--soft);
  border-top: 1px solid var(--line);
}
.category-copy h2 { font-size: 25px; margin-bottom: 10px; }
.category-copy p { color: var(--muted); }
.category-copy p:last-child { margin-bottom: 0; }

.all-search {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 620px;
}
.all-search input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  padding: 12px 14px;
  background: white;
  color: var(--ink);
  outline: none;
}
.all-search span {
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}
.no-results {
  color: var(--muted);
  text-align: center;
  padding: 20px 0 30px;
}

@media (max-width: 820px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .page-hero { padding: 30px 0 26px; }
  .tool-list-section { padding: 30px 0 42px; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 0; padding: 16px; }
  .all-search { align-items: stretch; flex-direction: column; }
}


/* Calculator detail pages */
.calculator-page-hero { padding-bottom: 30px; }
.calculator-page-section { padding: 34px 0 46px; }

.calculator-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 26px;
  align-items: start;
}

.calc-panel {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 22px;
  background: white;
  box-shadow: none;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.field-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}
.field span {
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
}
.field input,
.field select {
  width: 100%;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
  outline: none;
}
.field input:focus,
.field select:focus { border-color: #777777; }

.calc-actions {
  display: flex;
  gap: 9px;
  margin-top: 2px;
}
.primary-action,
.secondary-action {
  min-height: 44px;
  border-radius: 3px;
  padding: 10px 16px;
  font-weight: 800;
}
.primary-action {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: white;
}
.secondary-action {
  border: 1px solid #d0d0d0;
  background: white;
  color: var(--ink);
}

.result-box {
  margin-top: 20px;
  padding: 18px;
  border-radius: 3px;
  background: #f7f7f7;
  border: 1px solid #dedede;
}
.result-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
}
.result-main {
  display: block;
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.2;
  color: var(--ink);
}
.result-sub {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.calc-side-note {
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 18px;
  background: var(--soft);
}
.calc-side-note h2 { font-size: 17px; margin-bottom: 8px; }
.calc-side-note p { color: var(--muted); font-size: 13px; margin-bottom: 9px; }
.calc-side-note p:last-child { margin-bottom: 0; }

.calculator-content {
  padding: 42px 0 60px;
  border-top: 1px solid var(--line);
  background: var(--soft);
}
.content-stack {
  display: grid;
  gap: 34px;
}
.content-stack h2 { font-size: 24px; margin-bottom: 10px; }
.content-stack p { color: var(--muted); }
.faq-list { display: grid; gap: 8px; }
.faq-item {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: white;
  padding: 0 14px;
}
.faq-item summary {
  cursor: pointer;
  padding: 13px 0;
  font-weight: 750;
}
.faq-item p { padding-bottom: 13px; margin-bottom: 0; }

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.related-links a {
  border: 1px solid #d0d0d0;
  background: white;
  color: var(--blue);
  border-radius: 3px;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 820px) {
  .calculator-page-grid { grid-template-columns: 1fr; }
  .calc-side-note { display: none; }
  .field-grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .calc-panel { padding: 16px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .calc-actions { display: grid; grid-template-columns: 1fr 1fr; }
}


/* Student calculator helpers */
.repeat-rows {
  display: grid;
  gap: 10px;
}
.repeat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fafafa;
}
.repeat-row .field { margin-bottom: 0; }

.inline-add-button {
  margin: 10px 0 14px;
  border: 1px solid #d0d0d0;
  background: white;
  color: var(--blue);
  border-radius: 3px;
  padding: 8px 11px;
  font-weight: 750;
}

.notice-box {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #dedede;
  border-radius: 3px;
  background: #f7f7f7;
  color: var(--muted);
  font-size: 13px;
}
.notice-box strong { color: var(--ink); }

@media (max-width: 560px) {
  .repeat-row { grid-template-columns: 1fr; }
}


/* Finance calculator details */
.result-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 8px;
  margin-top: 14px;
}
.result-details:empty { display: none; }
.result-details div {
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.result-details span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}
.result-details strong {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.source-link {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 560px) {
  .result-details { grid-template-columns: 1fr 1fr; }
}


/* Category calculator sidebar */
.category-sidebar {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  background: white;
}

.category-sidebar h2 {
  font-size: 16px;
  line-height: 1.3;
  margin-bottom: 12px;
}

.category-side-links {
  display: grid;
  gap: 5px;
}

.category-side-link {
  display: block;
  padding: 8px 9px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.35;
  border: 1px solid transparent;
}

a.category-side-link:hover {
  background: var(--soft);
  border-color: var(--line);
  color: var(--blue);
}

.category-side-link.current {
  background: #f1f1f1;
  border: 1px solid #dedede;
  color: var(--blue);
  font-weight: 800;
}

.view-category-link {
  display: block;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 800;
}

@media (max-width: 820px) {
  .calc-side-note.category-sidebar {
    display: block;
    position: static;
    max-height: none;
    overflow: visible;
  }

  .category-side-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .category-side-links {
    grid-template-columns: 1fr;
  }

  .category-side-link {
    padding: 8px 7px;
  }
}


/* Standard information pages */
.legal-content section {
  padding-bottom: 4px;
}
.legal-content h2 {
  margin-bottom: 10px;
}
.legal-content p {
  max-width: 780px;
}
.contact-email-placeholder {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: white;
  color: var(--ink) !important;
  overflow-wrap: anywhere;
}



/* Homepage scientific calculator - final readable sizing */
.scientific-calculator { font-size: 17px; }
.scientific-calculator button {
  font-size: 19px;
  font-weight: 750;
  line-height: 1.15;
  min-height: 48px;
}
.scientific-calculator .calculator-display .expression { font-size: 17px; }
.scientific-calculator .calculator-display .result { font-size: 28px; font-weight: 780; }
.scientific-calculator .mode-button { font-size: 15px; font-weight: 750; }
@media (max-width: 560px) {
  .scientific-calculator { font-size: 18px; }
  .scientific-calculator button { font-size: 21px; min-height: 52px; }
  .scientific-calculator .calculator-display .expression { font-size: 18px; }
  .scientific-calculator .calculator-display .result { font-size: 29px; }
  .scientific-calculator .mode-button { font-size: 16px; }
}
