:root {
  --paper: #f3f0e8;
  --paper-deep: #e7e1d5;
  --ink: #11110f;
  --muted: #69675f;
  --line: #c9c2b5;
  --white: #fffefa;
  --blue: #2347ff;
  --blue-dark: #1734c8;
  --lime: #d7ff5f;
  --danger: #b52c22;
  --radius: 22px;
  --shadow: 0 18px 60px rgba(25, 22, 15, 0.08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 85% 5%, rgba(35, 71, 255, 0.08), transparent 24rem),
    var(--paper);
  color: var(--ink);
}

body,
button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

button,
select,
summary {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--lime);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
}

.skip-link:focus {
  transform: none;
}

.shell {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  width: min(1320px, calc(100% - 48px));
  min-height: 84px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

.top-nav,
.site-footer nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 0.88rem;
  font-weight: 700;
}

.top-nav a,
.site-footer nav a {
  text-decoration: none;
}

.top-nav a:hover,
.site-footer nav a:hover {
  text-decoration: underline;
}

.hero {
  min-height: 540px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: end;
  gap: 80px;
  padding-block: 104px 76px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 18px;
  font-size: 0.72rem;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 5px rgba(35, 71, 255, 0.11);
}

.hero h1,
.content-intro h2,
.section-heading-row h2,
.faq-heading h2,
.source-callout h2,
.page-hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.055em;
}

.hero h1 {
  max-width: 900px;
  font-size: clamp(4rem, 8.5vw, 8rem);
  line-height: 0.84;
}

.hero h1 em {
  color: var(--blue);
  font-weight: inherit;
}

.hero-deck {
  max-width: 650px;
  margin: 34px 0 0;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.5;
  color: var(--muted);
}

.hero-note {
  align-self: end;
  border-top: 1px solid var(--ink);
  padding-top: 18px;
}

.hero-note span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3rem;
}

.hero-note p {
  margin: 38px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}

.converter-shell {
  padding: 48px;
  border: 1px solid var(--ink);
  border-radius: 30px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.converter-heading,
.section-heading-row,
.quick-heading,
.source-callout > div {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 32px;
}

.converter-heading h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.privacy-note {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.82rem;
}

.privacy-note span {
  margin-right: 8px;
  color: #26a269;
}

.category-tabs {
  display: flex;
  gap: 8px;
  margin: 38px -3px 32px;
  padding: 3px 3px 12px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.category-tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  transition: 160ms ease;
}

.category-tab:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.category-tab[aria-selected="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.conversion-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.measure-card {
  min-width: 0;
  padding: 24px 26px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #faf8f2;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.measure-card:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(35, 71, 255, 0.1);
}

.result-card {
  background: #eef1ff;
  border-color: #b8c3ff;
}

.field-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-topline label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.unit-select-wrap {
  position: relative;
  min-width: 0;
}

.unit-select-wrap select {
  width: min(220px, 100%);
  min-height: 40px;
  padding: 8px 38px 8px 12px;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-select-wrap > span {
  position: absolute;
  right: 13px;
  top: 7px;
  pointer-events: none;
  color: var(--muted);
}

.value-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  margin-top: 38px;
}

.value-row input {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(2.65rem, 6vw, 4.7rem);
  line-height: 1;
  font-weight: 740;
  letter-spacing: -0.065em;
  font-variant-numeric: tabular-nums;
}

.value-row input::placeholder {
  color: #b4afa5;
  opacity: 1;
}

.large-symbol {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 800;
  white-space: nowrap;
}

.unit-name {
  min-height: 21px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.swap-button {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  font-size: 1.25rem;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.swap-button:hover {
  transform: rotate(180deg);
  background: var(--ink);
  color: white;
}

.answer-bar {
  min-height: 118px;
  margin-top: 18px;
  padding: 22px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-radius: 18px;
  background: var(--ink);
  color: white;
}

.answer-label {
  margin: 0 0 8px;
  color: #a9a89f;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.answer-text {
  margin: 0;
  font-size: clamp(1.05rem, 2.6vw, 1.55rem);
  line-height: 1.25;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.formula-text {
  margin: 7px 0 0;
  color: #a9a89f;
  font-size: 0.8rem;
  line-height: 1.4;
}

.copy-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #4d4d47;
  border-radius: 999px;
  background: transparent;
  color: white;
  font-size: 0.8rem;
  font-weight: 750;
}

.copy-button:not(:disabled):hover {
  border-color: white;
}

.copy-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.copy-icon {
  position: relative;
  width: 12px;
  height: 12px;
  border: 1px solid currentColor;
  border-radius: 2px;
}

.copy-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  left: -5px;
  top: 3px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: var(--ink);
}

.validation-message {
  min-height: 20px;
  margin: 9px 3px 0;
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 650;
}

.quick-reference {
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.quick-heading h3 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -0.035em;
}

.quick-heading > p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.reference-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.reference-row {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease;
}

.reference-row:hover {
  border-color: var(--blue);
  background: #f0f2ff;
}

.reference-row strong,
.reference-row span {
  display: block;
  overflow-wrap: anywhere;
}

.reference-row strong {
  font-size: 0.92rem;
}

.reference-row span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.75rem;
}

.content-section,
.examples-section,
.faq-section {
  padding-block: 150px 0;
}

.content-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  column-gap: 80px;
  align-items: end;
}

.content-intro .section-kicker {
  grid-column: 1 / -1;
}

.content-intro h2,
.section-heading-row h2,
.faq-heading h2,
.source-callout h2 {
  font-size: clamp(2.7rem, 5.5vw, 5rem);
  line-height: 0.98;
}

.content-intro > p:last-child,
.section-heading-row > p {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 52px;
}

.guide-card {
  min-height: 330px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 254, 250, 0.5);
}

.guide-card-dark {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

.card-number {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.4rem;
}

.guide-card h3 {
  margin: auto 0 12px;
  font-size: 1.25rem;
  letter-spacing: -0.035em;
}

.guide-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.guide-card-dark p {
  color: #dce2ff;
}

.section-heading-row > p {
  max-width: 320px;
  padding-bottom: 4px;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 48px;
}

.example-card {
  min-height: 270px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.accent-card {
  background: var(--lime);
  border-color: var(--ink);
}

.example-equation {
  margin: 0 0 76px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  letter-spacing: -0.04em;
}

.example-equation span {
  color: var(--blue);
}

.example-card h3 {
  margin: 0 0 9px;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.example-card > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.accent-card > p:last-child {
  color: #32352a;
}

.faq-section {
  display: grid;
  grid-template-columns: minmax(250px, 0.72fr) minmax(0, 1.28fr);
  gap: 80px;
}

.faq-heading {
  position: sticky;
  top: 28px;
  align-self: start;
}

.faq-list {
  border-top: 1px solid var(--ink);
}

.faq-list details {
  border-bottom: 1px solid var(--line);
}

.faq-list summary {
  padding: 25px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  list-style: none;
  font-weight: 750;
  line-height: 1.35;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary span {
  flex: 0 0 auto;
  font-size: 1.4rem;
  font-weight: 400;
  transition: transform 180ms ease;
}

.faq-list details[open] summary span {
  transform: rotate(45deg);
}

.faq-list details p {
  max-width: 700px;
  margin: -5px 0 26px;
  color: var(--muted);
  line-height: 1.7;
}

.source-callout {
  margin-top: 150px;
  margin-bottom: 150px;
  padding: 44px;
  border-radius: 26px;
  background: var(--ink);
  color: white;
}

.source-callout h2 {
  max-width: 680px;
  color: white;
}

.source-callout .section-kicker {
  color: #aaa99f;
}

.text-link {
  flex: 0 0 auto;
  font-weight: 750;
}

.site-footer {
  padding: 58px 0 26px;
  background: #ded8cb;
}

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

.footer-brand {
  margin-bottom: 16px;
}

.footer-top p,
.footer-bottom p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer nav {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.footer-bottom {
  margin-top: 66px;
  padding-top: 22px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid #aaa396;
}

/* Informational pages */
.page-main {
  min-height: 70vh;
}

.page-hero {
  padding-block: 100px 72px;
  border-bottom: 1px solid var(--line);
}

.page-hero h1 {
  max-width: 900px;
  font-size: clamp(3.7rem, 8vw, 7.6rem);
  line-height: 0.88;
}

.page-hero .hero-deck {
  max-width: 720px;
}

.prose-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 760px);
  gap: 90px;
  padding-block: 80px 130px;
}

.prose-aside {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.prose-aside strong {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.prose h2 {
  margin: 64px 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose h3 {
  margin: 36px 0 10px;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.prose p,
.prose li {
  color: #4f4d47;
  font-size: 1rem;
  line-height: 1.8;
}

.prose ul,
.prose ol {
  padding-left: 22px;
}

.prose a {
  color: var(--blue-dark);
}

.formula-block,
.note-block {
  margin: 26px 0;
  padding: 24px;
  border-radius: 16px;
  background: var(--white);
  border: 1px solid var(--line);
}

.formula-block code {
  display: block;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.note-block strong {
  color: var(--ink);
}

.table-wrap {
  margin: 28px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.prose th,
.prose td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.prose th {
  background: #ebe7dd;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.back-link {
  display: inline-flex;
  margin-top: 28px;
  font-weight: 750;
}

.error-page {
  min-height: 72vh;
  display: grid;
  place-items: center;
  padding: 70px 24px;
  text-align: center;
}

.error-page span {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--blue);
  font-size: 7rem;
  line-height: 1;
}

.error-page h1 {
  margin: 12px 0;
  font-size: 2rem;
}

.error-page p {
  color: var(--muted);
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 56px;
  }

  .hero-note {
    max-width: 300px;
  }

  .converter-shell {
    padding: 32px;
  }

  .conversion-workspace {
    grid-template-columns: 1fr;
  }

  .swap-button {
    position: relative;
    z-index: 2;
    margin-block: -6px;
    justify-self: center;
    transform: rotate(90deg);
  }

  .swap-button:hover {
    transform: rotate(270deg);
  }

  .content-intro,
  .faq-section {
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .content-intro .section-kicker {
    grid-column: auto;
  }

  .faq-heading {
    position: static;
  }

  .reference-list,
  .guide-grid,
  .example-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-card:last-child,
  .example-card:last-child {
    grid-column: 1 / -1;
  }

  .prose-layout {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 640px) {
  .shell,
  .site-header {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    min-height: 70px;
  }

  .top-nav {
    gap: 14px;
    font-size: 0.75rem;
  }

  .top-nav a:first-child {
    display: none;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .hero {
    min-height: auto;
    padding-block: 74px 54px;
    gap: 46px;
  }

  .hero h1 {
    font-size: clamp(3.55rem, 17.5vw, 5.4rem);
    line-height: 0.88;
  }

  .hero-deck {
    margin-top: 26px;
    font-size: 1.02rem;
  }

  .hero-note {
    display: none;
  }

  .converter-shell {
    width: 100%;
    padding: 28px 14px 20px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .converter-heading {
    align-items: start;
    padding-inline: 2px;
  }

  .converter-heading .privacy-note {
    display: none;
  }

  .category-tabs {
    margin-top: 26px;
    margin-right: -14px;
  }

  .measure-card {
    padding: 20px 18px 18px;
    border-radius: 18px;
  }

  .field-topline {
    align-items: flex-start;
  }

  .unit-select-wrap {
    max-width: 72%;
  }

  .unit-select-wrap select {
    max-width: 100%;
  }

  .value-row {
    margin-top: 34px;
  }

  .value-row input {
    font-size: clamp(2.65rem, 15vw, 4rem);
  }

  .answer-bar {
    align-items: flex-start;
    padding: 20px;
  }

  .copy-button {
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    justify-content: center;
  }

  .copy-button #copy-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .quick-heading,
  .section-heading-row,
  .source-callout > div {
    display: block;
  }

  .quick-heading > p,
  .section-heading-row > p {
    margin-top: 12px;
  }

  .reference-list,
  .guide-grid,
  .example-grid {
    grid-template-columns: 1fr;
  }

  .guide-card:last-child,
  .example-card:last-child {
    grid-column: auto;
  }

  .content-section,
  .examples-section,
  .faq-section {
    padding-top: 100px;
  }

  .content-intro h2,
  .section-heading-row h2,
  .faq-heading h2,
  .source-callout h2 {
    font-size: clamp(2.6rem, 13vw, 4rem);
  }

  .guide-card {
    min-height: 280px;
  }

  .example-equation {
    margin-bottom: 55px;
  }

  .source-callout {
    width: 100%;
    margin-block: 100px;
    padding: 38px 22px;
    border-radius: 0;
  }

  .source-callout .text-link {
    display: inline-block;
    margin-top: 28px;
  }

  .footer-top,
  .footer-bottom {
    display: block;
  }

  .site-footer nav {
    justify-content: flex-start;
    gap: 18px;
    margin-top: 34px;
  }

  .footer-bottom p + p {
    margin-top: 12px;
  }

  .page-hero {
    padding-block: 74px 55px;
  }

  .page-hero h1 {
    font-size: clamp(3.45rem, 16vw, 5rem);
  }

  .prose-layout {
    padding-block: 55px 90px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
