/* /calculator/ — Figma comparison layout (beige / ink / accent) */

.calc-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--surface);
  background: var(--page-bg);
}

.calc-page__header {
  width: 100%;
  display: flex;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--page-bg);
}

.calc-page__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: calc(100% - (var(--content-pad) * 2));
  max-width: var(--content-max);
  padding: 0 0 56px;
  gap: 0;
}

/* —— Hero —— */
.calc-page__hero {
  display: grid;
  grid-template-columns: minmax(0, 640px) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  width: 100%;
  padding: 64px 0 32px;
  animation: calc-page-rise 0.55s ease-out both;
}

/* Provisional: hide mock Pricetag total until real pricing lands */
.calc-total--pricetag[hidden] {
  display: none !important;
}

.calc-page__title {
  margin: 0;
  max-width: 640px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 40px;
  line-height: 48px;
  letter-spacing: -1px;
  color: var(--surface);
}

.calc-page__title em {
  font-style: italic;
  font-weight: 400;
}

.calc-page__totals {
  display: contents;
}

.calc-total {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.calc-total--manual {
  color: var(--surface);
  justify-self: end;
  align-items: flex-end;
  text-align: right;
}

.calc-total--manual .calc-price {
  color: var(--accent);
}

.calc-total--pricetag {
  color: var(--accent);
}

.calc-price {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  line-height: 1.12;
  font-family: var(--font-serif);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1.76px;
  color: inherit;
}

.calc-price__unit,
.calc-price__int {
  font-size: 72px;
  line-height: 81px;
}

.calc-total__sub {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.3;
  color: inherit;
}

/* —— Chart —— */
.calc-chart {
  width: 100%;
  margin: 0 0 48px;
  animation: calc-page-rise 0.65s ease-out 0.06s both;
}

.calc-chart__frame {
  position: relative;
  width: 100%;
  height: 404px;
}

.calc-chart__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  touch-action: pan-y;
}

.calc-chart__grid-line {
  stroke: rgba(46, 46, 46, 0.35);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.calc-chart__y-label,
.calc-chart__x-label {
  fill: #2e2e2e;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
}

.calc-chart__x-label {
  opacity: 0.5;
}

.calc-chart__area {
  transition: d 0.35s ease;
}

.calc-chart__area--manual {
  fill: rgba(0, 98, 255, 0.38);
}

.calc-chart__area--pricetag {
  fill: rgba(0, 98, 255, 0.38);
  display: none;
}

.calc-chart__line {
  fill: none;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  transition: d 0.35s ease;
  pointer-events: none;
}

.calc-chart__line--manual {
  stroke: rgba(0, 98, 255, 0.65);
}

.calc-chart__line--pricetag {
  stroke: rgba(0, 98, 255, 0.65);
  display: none;
}

.calc-chart__hover-line {
  stroke: rgba(46, 46, 46, 0.45);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.calc-chart__dot {
  stroke: #fff;
  stroke-width: 2;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.calc-chart__dot--manual {
  fill: var(--accent);
}

.calc-chart__dot--pricetag {
  fill: var(--accent);
  display: none;
}

.calc-chart__tip-pricetag {
  display: none;
}

.calc-chart__tip-changes {
  color: rgba(46, 46, 46, 0.65);
}

.calc-chart__tooltip {
  position: absolute;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 108px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(247, 247, 247, 0.96);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 12px 28px -16px rgba(46, 46, 46, 0.35);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.3;
  color: var(--surface);
  pointer-events: none;
}

.calc-chart__tooltip[hidden] {
  display: none !important;
}

.calc-chart__tooltip strong {
  font-weight: 500;
  margin-bottom: 2px;
}

.calc-chart__tip-manual {
  color: var(--accent);
  font-weight: 500;
}


/* —— Inputs —— */
.calc-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 48px;
  row-gap: 24px;
  width: 100%;
  animation: calc-page-rise 0.7s ease-out 0.12s both;
}

.calc-row {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.calc-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.calc-row__label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.calc-row label {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.3;
  color: rgba(46, 46, 46, 0.8);
}

.calc-row__label > label {
  flex: 0 1 auto;
}

.calc-info {
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(46, 46, 46, 0.35);
  border-radius: 50%;
  background: transparent;
  color: rgba(46, 46, 46, 0.65);
  font-family: var(--font-serif);
  font-size: 11px;
  font-style: italic;
  line-height: 16px;
  text-align: center;
  cursor: help;
}

.calc-info:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.calc-info__tip {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: min(280px, 70vw);
  padding: 10px 12px;
  border: 1px solid rgba(46, 46, 46, 0.12);
  border-radius: 4px;
  background: #f7f5f2;
  box-shadow: 0 8px 24px rgba(46, 46, 46, 0.12);
  color: var(--surface);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  pointer-events: none;
}

.calc-info__tip[hidden] {
  display: none !important;
}

.calc-row__value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-shrink: 0;
  min-height: 32px;
}

.calc-row__value input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
  box-sizing: border-box;
  width: auto;
  min-width: 2.5ch;
  max-width: 7.5ch;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  line-height: 32px;
  font-variant-numeric: tabular-nums;
  color: var(--surface);
  text-align: right;
}

.calc-row__value input[type="number"]::-webkit-inner-spin-button,
.calc-row__value input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  display: none;
}

.calc-row__unit {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  color: var(--surface);
  white-space: nowrap;
}

.calc-slider {
  --slider-progress: 0%;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 18px;
  margin: 0;
  background: transparent;
  outline: none;
  cursor: pointer;
}

.calc-slider::-webkit-slider-runnable-track {
  height: 1px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--slider-progress),
    rgba(46, 46, 46, 0.22) var(--slider-progress),
    rgba(46, 46, 46, 0.22) 100%
  );
}

.calc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5.5px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.calc-slider::-moz-range-track {
  height: 1px;
  border: 0;
  border-radius: 0;
  background: rgba(46, 46, 46, 0.22);
}

.calc-slider::-moz-range-progress {
  height: 1px;
  border: 0;
  border-radius: 0;
  background: var(--accent);
}

.calc-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.calc-row__value input[type="number"]:focus-visible,
.calc-slider:focus-visible::-webkit-slider-thumb,
.calc-slider:focus-visible::-moz-range-thumb {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.calc-footer {
  width: 100%;
  margin-top: auto;
  padding: 24px var(--content-pad) 40px;
  border-top: 1px solid var(--border-subtle);
  box-sizing: border-box;
}

.calc-fine {
  margin: 0 auto;
  max-width: var(--content-max);
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-faint);
}

@keyframes calc-page-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .calc-page__hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .calc-page__title {
    font-size: 36px;
    line-height: 1.2;
  }

  .calc-price__unit,
  .calc-price__int {
    font-size: clamp(2.8rem, 7vw, 4rem);
    line-height: 1.05;
  }
}

@media (max-width: 760px) {
  .calc-page__hero {
    grid-template-columns: 1fr;
    padding: 32px 0 24px;
    gap: 16px;
  }

  .calc-page__title {
    font-size: 30px;
    letter-spacing: -0.5px;
  }

  .calc-total__sub {
    font-size: 16px;
  }

  .calc-chart__frame {
    height: 280px;
  }

  .calc-chart__y-label,
  .calc-chart__x-label {
    font-size: 12px;
  }

  .calc-inputs {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
    row-gap: 20px;
  }

  .calc-page__main {
    padding-bottom: 40px;
  }
}

@media (max-width: 480px) {
  .calc-page__hero {
    grid-template-columns: 1fr;
  }

  .calc-price__unit,
  .calc-price__int {
    font-size: 2.6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calc-page__hero,
  .calc-chart,
  .calc-inputs,
  .calc-chart__area,
  .calc-chart__line {
    animation: none;
    transition: none;
  }
}
