:root {
  color-scheme: light;
  --ink: #203744;
  --muted: #4e646e;
  --blue: #375e72;
  --blue-dark: #284b5e;
  --paper: #f3f6f7;
  --white: #fcfdfd;
  --line: #d5dfe3;
  --serif: Georgia, "Times New Roman", serif;
  font-family: "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); isolation: isolate; }
body::before {
  content: "";
  position: fixed;
  inset: -26px;
  z-index: -1;
  pointer-events: none;
  background: url("/assets/formulas.webp") center / cover no-repeat;
  mix-blend-mode: multiply;
  opacity: .065;
  animation: wallpaper-drift 30s ease-in-out infinite alternate;
}
@keyframes wallpaper-drift {
  from { transform: translate(-8px, 6px) scale(1.02); }
  to { transform: translate(14px, -12px) scale(1.08); }
}
h1, h2, h3, p, figure, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
[hidden] { display: none !important; }
.wrap { width: min(1120px, calc(100% - 80px)); margin-inline: auto; }
section, #write-review { scroll-margin-top: 24px; }

.header { border-bottom: 1px solid var(--line); }
.header-inner, .footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.header-inner { min-height: 78px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 700; line-height: 1.15; white-space: nowrap; }
.brand small { display: block; color: var(--muted); font-size: .72rem; font-weight: 400; margin-top: 4px; }
.mark {
  width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center;
  background: #e3edf0; border: 1px solid #d3e0e5; color: var(--blue); font: 23px var(--serif);
}
nav { display: flex; gap: clamp(14px, 3.2vw, 40px); font-size: .9rem; color: var(--muted); }
nav a:hover, .footer a:hover, .text-link:hover { color: var(--blue-dark); text-decoration: underline; text-underline-offset: 4px; }
.header-link { border: 1px solid #bacdd6; border-radius: 8px; padding: 10px 13px; font-size: .83rem; font-weight: 650; white-space: nowrap; color: var(--blue-dark); }
.header-link:hover { background: #e6eef1; }
.header-link span { margin-left: 4px; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .86fr); gap: clamp(26px, 6vw, 76px); align-items: center; padding: clamp(38px, 6.5vw, 88px) 0; }
.kicker { margin-bottom: 13px; font-size: .73rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.052em; }
h1 { font-size: clamp(2.58rem, 5.65vw, 5.1rem); line-height: 1; }
h1 em { display: block; font-weight: inherit; color: var(--blue); }
h2 { font-size: clamp(2rem, 4.1vw, 3.65rem); line-height: 1.06; }
h3 { font-size: 1.06rem; }
.hero-description { margin-top: 21px; max-width: 45ch; color: var(--muted); font-size: clamp(.98rem, 1.5vw, 1.15rem); line-height: 1.62; }
.hero-terms { display: grid; gap: 3px; margin-top: 23px; padding-left: 13px; border-left: 2px solid #9db8c4; font-size: .91rem; }
.hero-terms span { color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 21px; margin-top: 25px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 8px; padding: 12px 16px; min-height: 44px; font-size: .88rem; font-weight: 700; }
.primary { color: #fff; background: var(--blue); }
.primary:hover { background: var(--blue-dark); }
.button:disabled { cursor: wait; opacity: .68; }
.text-link { color: var(--blue-dark); font-size: .89rem; font-weight: 650; }
.text-link span { margin-left: 3px; }
.hero-image {
  height: clamp(345px, 40vw, 495px); position: relative; min-width: 0; overflow: hidden;
  border: 1px solid #b9cbd4; border-radius: 17px; background: #b5c9d3;
}
.hero-image img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 51%; }
.calculator {
  position: absolute; bottom: 6%; right: 6%; width: clamp(139px, 17vw, 200px);
  padding: 10px 10px 9px; border: 1px solid #506b78; border-radius: 12px; color: #f2f6f7;
  background: linear-gradient(145deg, #577584, #334e5c);
  box-shadow: inset 0 1px 1px #c3d7de5e, 0 3px 0 #2c414c, 5px 10px 20px #263f505c;
  transform: rotate(-4deg);
}
.calculator::before {
  content: ""; display: block; margin: 1px 2px 7px auto; width: 38px; height: 8px; border: 1px solid #384a53;
  border-radius: 2px; background: repeating-linear-gradient(90deg, #263c49 0 6px, #405864 6px 7px);
}
.calculator-screen {
  display: flex; align-items: center; justify-content: space-between; gap: 5px;
  padding: 7px 8px; border-radius: 5px; border: 1px solid #3a535d;
  color: #243f45; background: #dae5e3; box-shadow: inset 0 1px 4px #294b5345;
}
.calculator-screen strong { font: 650 clamp(1.75rem, 3vw, 2.65rem)/1 Consolas, monospace; letter-spacing: -.08em; }
.calculator-screen span { font-size: .68rem; font-weight: 650; text-align: right; }
.calculator > p { font-size: .68rem; margin: 6px 2px 0; letter-spacing: .02em; }

.section, .about { margin-bottom: 25px; padding: clamp(23px, 4.5vw, 52px); border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.section-heading { margin-bottom: 24px; }
.section-heading > p:last-child, .about p:not(.kicker) { color: var(--muted); line-height: 1.6; margin-top: 11px; max-width: 56ch; }
.example { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(20px, 5vw, 68px); align-items: start; background: #e8eff2; }
.example .section-heading { margin: 0; }
.notebook {
  padding: clamp(16px, 3.3vw, 33px); border: 1px solid #cbd9de; border-radius: 10px;
  background-color: #fdfdfb;
  background-image: linear-gradient(#d9e5eb70 1px, transparent 1px), linear-gradient(90deg, #d9e5eb70 1px, transparent 1px);
  background-size: 17px 17px;
  box-shadow: 2px 3px 0 #cfdee4;
}
.equation { margin: 9px 0 19px; font: 500 clamp(1.5rem, 3.2vw, 2.6rem)/1.15 var(--serif); color: var(--blue-dark); }
details { border-top: 1px solid var(--line); background: #ffffffbf; }
summary { padding: 10px 6px; color: var(--blue-dark); font-size: .91rem; font-weight: 650; }
details p { padding: 0 6px 12px; color: var(--muted); line-height: 1.55; }
.lesson-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.lesson-grid article { padding: clamp(15px, 2.2vw, 25px); background: #f6f9fa; border: 1px solid var(--line); border-radius: 10px; }
.symbol { display: grid; place-items: center; width: 39px; height: 39px; margin-bottom: 13px; border-radius: 7px; background: #e5eef1; color: var(--blue); font: 1.35rem var(--serif); }
.lesson-grid p, .review-form > p { margin-top: 8px; color: var(--muted); line-height: 1.55; }
.about h2 { max-width: 22ch; }
.trial { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: start; gap: clamp(20px, 5vw, 52px); background: #e8eff2; }
.trial-intro, .trial-steps p { color: var(--muted); line-height: 1.6; }
.trial-intro { margin-top: 13px; }
.trial-steps { display: grid; gap: 14px; margin: 18px 0 0; padding-left: 1.5rem; }
.trial-steps li { padding-left: 5px; }
.trial-steps li::marker { color: var(--blue); font-weight: 700; }
.trial-steps p { margin-top: 4px; }
.trial-booking { display: grid; gap: 16px; padding: clamp(16px, 2.5vw, 26px); border: 1px solid var(--line); border-radius: 10px; background: var(--white); }
.trial-terms { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.trial-terms div { padding-left: 11px; border-left: 1px solid #afc5cf; }
.trial-terms dt { color: var(--muted); font-size: .8rem; }
.trial-terms dd { font-weight: 700; margin-top: 4px; }
.trial-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 14px; font-style: normal; }
.trial-contact .text-link { display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; }

.reviews-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(15px, 3vw, 34px); align-items: start; }
.review-state, .review, .review-form { border: 1px solid var(--line); border-radius: 10px; padding: clamp(16px, 2.5vw, 26px); background: #f8fafb; }
.review-state { color: var(--muted); }
.review-list { display: grid; gap: 10px; }
.review-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.review-heading strong, .review-message { overflow-wrap: anywhere; }
.review-stars { color: #70592d; letter-spacing: .07em; }
.review-date { display: block; font-size: .78rem; color: var(--muted); margin: 4px 0 11px; }
.review-message { white-space: pre-wrap; line-height: 1.55; }
.more { margin-top: 12px; background: #e6eef2; color: var(--blue-dark); }
.review-form { display: grid; gap: 8px; min-width: 0; }
.review-form > p { margin-top: 0; font-size: .9rem; }
.review-form label, .review-form legend { font-size: .87rem; font-weight: 700; }
.review-form > label, .review-form fieldset { margin-top: 8px; }
.review-form input:not([type="radio"]), .review-form textarea { width: 100%; border: 1px solid #a9bcc6; padding: 10px 12px; border-radius: 6px; color: var(--ink); background: #fff; }
.review-form textarea { resize: vertical; }
.review-form fieldset { padding: 0; margin-inline: 0; border: 0; min-width: 0; }
.rating { display: flex; flex-wrap: wrap; gap: 3px; }
.rating label { position: relative; display: grid; place-items: center; min-width: 40px; min-height: 40px; border-radius: 6px; color: #5f747e; cursor: pointer; font-size: 1.42rem; }
.rating input, .sr { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.rating label:has(input:focus-visible) { outline: 2px solid var(--blue); }
.rating label:has(input:checked), .rating label:has(~ label input:checked), .rating label:hover, .rating label:has(~ label:hover) { color: #70592d; background: #f2ecdf; }
.review-form .hint { font-size: .78rem; }
.review-form .button { justify-self: start; margin-top: 5px; }
.review-form .form-status[data-error] { color: #9c2b1d; }
.footer { padding: 12px 0 28px; color: var(--muted); font-size: .87rem; }

@media (max-width: 880px) {
  .wrap { width: calc(100% - 42px); }
  .hero { gap: 27px; }
}
@media (max-width: 820px) {
  .header-inner { min-height: 0; padding: 12px 0 10px; flex-wrap: wrap; gap: 11px 6px; }
  .header-link { font-size: .75rem; padding: 8px; }
  .header-link span { margin: 0; }
  nav { order: 3; width: 100%; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line); font-size: .81rem; }
}
@media (max-width: 680px) {
  .wrap { width: calc(100% - 34px); }
  .hero { grid-template-columns: 1fr; gap: 23px; padding: 32px 0; }
  .hero-image { height: clamp(240px, 67vw, 410px); border-radius: 12px; }
  .hero-description { margin-top: 15px; }
  .hero-terms { margin-top: 17px; }
  .hero-actions { margin-top: 19px; }
  .example, .lesson-grid, .trial, .reviews-grid { grid-template-columns: 1fr; }
  .section, .about { padding: 20px 15px; margin-bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before { animation: none; }
}
