:root {
  --ag-black: #000;
  --ag-ink: #161616;
  --ag-ink-2: #202020;
  --ag-text: #fff;
  --ag-muted: rgba(255, 255, 255, 0.72);
  --ag-soft: rgba(255, 255, 255, 0.1);
  --ag-line: rgba(255, 255, 255, 0.24);
  --ag-yellow: #ffe626;
  --ag-yellow-hover: #ecda23;
  --ag-page: #f9f9f9;
  --max-width: 1124px;
  --header-height: 80px;
  --bottom-nav-height: 64px;
  color-scheme: dark;
  font-family: "Booton-Regular", Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ag-black);
  font-size: 16px;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--ag-black);
  color: var(--ag-text);
  font-family: "Booton-Regular", Arial, Helvetica, sans-serif;
  font-weight: 500;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  background: var(--ag-ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-inner {
  width: min(100%, calc(var(--max-width) + 8rem));
  height: 100%;
  margin: 0 auto;
  padding: 0 4rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 3rem;
}

.brand {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.08em;
  color: var(--ag-text);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.brand span {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
}

.brand svg {
  width: 0.44em;
  height: 0.84em;
  margin-top: -0.25em;
  fill: currentColor;
  flex: none;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 3.4rem;
  justify-content: flex-start;
}

.desktop-nav a {
  color: var(--ag-text);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}

.desktop-nav a:hover,
.desktop-nav a:focus-visible {
  color: var(--ag-yellow);
}

.button {
  min-height: 3.5rem;
  padding: 1rem 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 19px;
  border: 2px solid transparent;
  color: var(--ag-ink);
  font-weight: 700;
  text-decoration: none;
  line-height: 1.3;
  white-space: nowrap;
}

.button-primary {
  background: var(--ag-yellow);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--ag-yellow-hover);
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: calc(100svh - var(--header-height));
  background:
    radial-gradient(circle at 22% 26%, rgba(255, 255, 255, 0.075), transparent 28rem),
    linear-gradient(145deg, #020202 0%, #050505 54%, #000 100%);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 90px 90px;
  mask-image: linear-gradient(180deg, transparent, black 12%, black 84%, transparent);
  opacity: 0.18;
}

.hero-block {
  position: absolute;
  pointer-events: none;
  background: linear-gradient(130deg, #1d1d1d 0%, #050505 58%, #000 100%);
  border: 1px solid rgba(255, 255, 255, 0.035);
  opacity: 0.92;
}

.block-top {
  top: 0;
  right: -8vw;
  width: 38vw;
  height: 14vw;
}

.block-right {
  top: 22%;
  right: -5vw;
  width: 28vw;
  height: 28vw;
}

.block-bottom {
  right: 5vw;
  bottom: -6vw;
  width: 36vw;
  height: 17vw;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: min(100%, calc(var(--max-width) + 8rem));
  margin: 0 auto;
  padding: 3rem 4rem 2rem;
}

.hero-copy {
  max-width: 64rem;
}

h1 {
  max-width: 58rem;
  margin: 0;
  color: var(--ag-text);
  font-size: clamp(3.7rem, 6.7vw, 7.4rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 45rem;
  margin: 1.35rem 0 0;
  color: var(--ag-text);
  font-size: 1.15rem;
  line-height: 1.38;
}

.calculator {
  width: min(100%, 60rem);
  margin: 1.1rem 0 0;
  padding: 1.4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 0.82fr);
  gap: 1.45rem;
  border: 1px solid var(--ag-line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)),
    rgba(22, 22, 22, 0.72);
  box-shadow: 0 2rem 5rem rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem 1rem;
}

.control-block {
  min-width: 0;
  display: grid;
  gap: 0.55rem;
}

.control-block-wide {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 0.55rem;
}

.field > span:first-child,
.result-row > span:first-child {
  color: var(--ag-text);
  font-weight: 800;
  font-size: 1rem;
}

.value-input {
  min-height: 3.35rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--ag-text);
  font-size: 1.85rem;
  font-weight: 800;
}

.value-input > span {
  color: rgba(255, 255, 255, 0.72);
}

.value-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ag-text);
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
}

.value-input input::-webkit-outer-spin-button,
.value-input input::-webkit-inner-spin-button {
  margin: 0;
  appearance: none;
}

.range-row {
  display: grid;
  gap: 0.55rem;
}

input[type="range"] {
  --range-progress: 50%;
  width: 100%;
  height: 1.25rem;
  margin: 0;
  background: transparent;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 0.34rem;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--ag-yellow) 0%,
    var(--ag-yellow) var(--range-progress),
    rgba(255, 255, 255, 0.22) var(--range-progress),
    rgba(255, 255, 255, 0.22) 100%
  );
}

input[type="range"]::-moz-range-track {
  height: 0.34rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

input[type="range"]::-moz-range-progress {
  height: 0.34rem;
  border-radius: 999px;
  background: var(--ag-yellow);
}

input[type="range"]::-webkit-slider-thumb {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: -0.45rem;
  border: 0;
  border-radius: 50%;
  background: var(--ag-yellow);
  appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border: 0;
  border-radius: 50%;
  background: var(--ag-yellow);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.9rem;
}

.results {
  display: grid;
  gap: 0;
  padding-left: 1.45rem;
  border-left: 1px solid rgba(255, 255, 255, 0.36);
}

.result-row {
  padding: 0.1rem 0 0.8rem;
  display: grid;
  gap: 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.24);
}

.result-row + .result-row {
  padding-top: 0.8rem;
}

.result-row strong {
  color: var(--ag-text);
  font-size: 2.42rem;
  font-weight: 800;
  line-height: 1;
}

.result-row.featured strong {
  color: var(--ag-yellow);
}

.result-row small {
  margin-left: 0.16em;
  color: var(--ag-text);
  font-size: 0.52em;
  font-weight: 700;
}

.formula {
  padding-top: 0.65rem;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.95rem;
}

.example {
  max-width: 36rem;
  margin-top: 1rem;
  display: grid;
  gap: 1.2rem;
  color: var(--ag-text);
}

.example p {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.35;
}

.example .button {
  width: fit-content;
  min-width: 11.5rem;
}

.closing {
  position: relative;
  z-index: 2;
  min-height: 6.75rem;
  padding: 1.6rem 4rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.94);
}

.closing .brand {
  padding-right: 2rem;
  border-right: 1px solid rgba(255, 255, 255, 0.22);
}

.closing p {
  margin: 0;
  color: var(--ag-muted);
}

.bottom-nav {
  display: none;
}

.not-found {
  min-height: 100vh;
  padding: 4rem;
  display: grid;
  align-content: center;
  gap: 1.5rem;
  background: var(--ag-black);
}

.not-found h1 {
  font-size: clamp(3.5rem, 8vw, 7rem);
}

.not-found p {
  margin: 0;
  color: var(--ag-muted);
}

.not-found .button {
  width: fit-content;
}

:focus-visible {
  outline: 3px solid #6495ed;
  outline-offset: 3px;
}

@media (max-width: 900px) {
  :root {
    --header-height: 72px;
  }

  body {
    padding-bottom: var(--bottom-nav-height);
  }

  .site-header {
    position: fixed;
    right: 0;
    left: 0;
  }

  .header-inner {
    padding: 0 1rem;
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .brand span {
    font-size: 1.42rem;
  }

  .desktop-nav,
  .header-cta {
    display: none;
  }

  .hero {
    min-height: auto;
    padding-top: var(--header-height);
  }

  .hero::before {
    background-size: 64px 64px;
    opacity: 0.12;
  }

  .block-top {
    top: 72px;
    right: -5rem;
    width: 16rem;
    height: 7.25rem;
  }

  .block-right {
    top: 32rem;
    right: -6rem;
    width: 17rem;
    height: 15rem;
  }

  .block-bottom {
    right: auto;
    bottom: 4.5rem;
    left: -4rem;
    width: 12rem;
    height: 8rem;
  }

  .hero-inner {
    padding: 4rem 1rem 2.25rem;
  }

  h1 {
    max-width: 24rem;
    font-size: clamp(4rem, 17vw, 5.9rem);
    line-height: 0.95;
  }

  .hero-copy p {
    max-width: 28rem;
    margin-top: 1.45rem;
    font-size: 1rem;
  }

  .calculator {
    margin-top: 1rem;
    padding: 1rem;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.2rem;
    background:
      linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
      rgba(22, 22, 22, 0.82);
  }

  .controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .control-block-wide {
    grid-column: auto;
  }

  .value-input {
    min-height: 3rem;
    font-size: 1.55rem;
  }

  .results {
    padding-left: 0;
    border-left: 0;
  }

  .result-row strong {
    font-size: 2rem;
  }

  .example .button {
    width: 100%;
  }

  .closing {
    padding: 1.25rem 1rem;
    align-items: flex-start;
    flex-direction: column;
    gap: 0.85rem;
  }

  .closing .brand {
    padding-right: 0;
    border-right: 0;
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    min-height: var(--bottom-nav-height);
    padding-bottom: env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--ag-ink);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .bottom-nav a {
    min-width: 0;
    padding: 0.58rem 0.25rem;
    display: grid;
    place-items: center;
    gap: 0.32rem;
    color: var(--ag-text);
    font-size: 0.75rem;
    line-height: 1;
    text-decoration: none;
  }

  .bottom-nav svg {
    width: 1.55rem;
    height: 1.55rem;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
  }
}

@media (min-width: 901px) and (max-height: 760px) {
  .hero-inner {
    padding-top: 2rem;
  }

  h1 {
    font-size: clamp(3.5rem, 5.7vw, 5.7rem);
  }

  .hero-copy p {
    margin-top: 0.9rem;
    font-size: 1.02rem;
  }

  .calculator {
    margin-top: 0.85rem;
    padding: 1.05rem;
  }

  .controls {
    gap: 0.72rem 0.8rem;
  }

  .value-input {
    min-height: 3rem;
    font-size: 1.65rem;
  }

  .range-row {
    gap: 0.35rem;
  }

  .result-row {
    padding-bottom: 0.68rem;
  }

  .result-row + .result-row {
    padding-top: 0.68rem;
  }

  .result-row strong {
    font-size: 2.14rem;
  }

  .example {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    max-width: 60rem;
    margin-top: 0.75rem;
  }

  .example p {
    font-size: 0.95rem;
  }
}

@media (max-width: 520px) {
  .hero-inner {
    padding-top: 3.4rem;
  }

  .calculator {
    width: 100%;
  }

  .example p {
    font-size: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
