:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #111111;
  --muted: #6b6b6b;
  --line: #e8e8e8;
  --line-hover: #cfcfcf;
  --badge-bg: #f3f3f1;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --radius: clamp(10px, 2vw, 12px);
  --radius-sm: clamp(6px, 1.5vw, 8px);
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.06);
  --ease: 0.18s ease;
  --focus: 0 0 0 3px rgba(17, 17, 17, 0.12);
  --btn-bg: #404040;
  --btn-fg: #ececea;
  --btn-border: #404040;

  /* fluid layout */
  --gutter: clamp(16px, 4.5vw, 40px);
  --content-max: 720px;
  --space-2xs: clamp(6px, 1.2vw, 8px);
  --space-xs: clamp(8px, 1.8vw, 12px);
  --space-sm: clamp(12px, 2.5vw, 16px);
  --space-md: clamp(16px, 3.5vw, 24px);
  --space-lg: clamp(24px, 5vw, 36px);
  --space-xl: clamp(28px, 6vw, 48px);
  --header-pad-y: clamp(10px, 2.5vw, 14px);
  --photo: clamp(84px, 24vw, 112px);
  --touch: 44px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0c0c;
  --card: #161616;
  --text: #f4f4f4;
  --muted: #9a9a9a;
  --line: #2e2e2e;
  --line-hover: #454545;
  --badge-bg: #1f1f1f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.45);
  --focus: 0 0 0 3px rgba(244, 244, 244, 0.12);
  --btn-bg: #2e2e2e;
  --btn-fg: #c4c4c4;
  --btn-border: #3a3a3a;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  hanging-punctuation: first last;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 clamp(15px, 2.8vw, 16px) / 1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

body.modal-open { overflow: hidden; }

a { color: var(--text); }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.wrap {
  width: min(var(--content-max), calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
}

/* header */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  padding-block: var(--header-pad-y);
  padding-top: calc(var(--header-pad-y) + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: var(--touch);
}

.header-link {
  font-size: clamp(13px, 3.2vw, 14px);
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
  transition: color var(--ease);
}

@media (hover: hover) {
  .header-link:hover {
    color: var(--text);
  }
}

.theme {
  display: grid;
  place-items: center;
  width: var(--touch);
  height: var(--touch);
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 0;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--ease), background-color var(--ease);
}

.theme:hover { border-color: var(--line-hover); }

html[data-theme="light"] .theme-moon,
html[data-theme="dark"] .theme-sun { display: none; }

.theme-sun,
.theme-moon {
  display: grid;
  place-items: center;
}

/* intro */
.intro {
  display: flex;
  gap: clamp(16px, 4vw, 24px);
  align-items: flex-start;
  padding-block: var(--space-lg) var(--space-md);
}

.photo {
  width: var(--photo);
  height: var(--photo);
  object-fit: cover;
  flex-shrink: 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
}

.intro h1 {
  margin: 0;
  font-size: clamp(20px, 5.5vw, 26px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.role {
  margin: var(--space-2xs) 0 0;
  font-size: clamp(14px, 3.5vw, 15px);
  font-weight: 500;
  color: var(--muted);
}

/* blocks */
.block {
  padding-block: var(--space-lg);
  border-bottom: 1px solid var(--line);
}

.block:last-of-type {
  border-bottom: 0;
}

.block h2 {
  margin: 0 0 var(--space-sm);
  font-size: clamp(11px, 2.8vw, 12px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.facts {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: clamp(10px, 2.5vw, 12px);
}

.facts li {
  padding: clamp(10px, 2.5vw, 12px) clamp(12px, 3vw, 14px);
  font-size: clamp(14px, 3.6vw, 15px);
  line-height: 1.5;
  text-wrap: pretty;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
}

/* service cards */
.cards {
  display: grid;
  gap: clamp(12px, 3vw, 18px);
  grid-template-columns: 1fr;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(12px, 3vw, 16px);
  min-width: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: clamp(16px, 4vw, 20px);
  box-shadow: var(--shadow);
  transition: border-color var(--ease), background-color var(--ease), box-shadow var(--ease);
}

@media (hover: hover) {
  .card:hover {
    border-color: var(--line-hover);
    box-shadow: var(--shadow-hover);
  }
}

.card h3 {
  margin: 0;
  font-size: clamp(16px, 4vw, 17px);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card-text {
  margin: var(--space-2xs) 0 0;
  font-size: clamp(13px, 3.2vw, 14px);
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

.card-btn {
  width: 100%;
  margin-top: auto;
  min-height: var(--touch);
  padding: clamp(10px, 2.5vw, 12px) var(--space-md);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-sm);
  font-size: clamp(14px, 3.5vw, 15px);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), transform 0.12s ease;
}

.card-btn-primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
}

@media (hover: hover) {
  .card-btn-primary:hover {
    background: color-mix(in srgb, var(--btn-bg) 88%, var(--text));
    border-color: color-mix(in srgb, var(--btn-border) 88%, var(--text));
  }
}

.card-btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line-hover);
}

@media (hover: hover) {
  .card-btn-secondary:hover {
    background: var(--badge-bg);
    border-color: var(--text);
  }
}

.card-btn:active {
  transform: scale(0.99);
}

/* footer */
.footer {
  padding-block: var(--space-lg) var(--space-xl);
  padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  margin-top: var(--space-sm);
}

.footer-heading {
  margin: 0 0 var(--space-md);
  font-size: clamp(11px, 2.8vw, 12px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.contacts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(8px, 2vw, 10px);
}

.contact-link {
  display: flex;
  align-items: center;
  gap: clamp(12px, 3vw, 14px);
  min-height: var(--touch);
  height: 100%;
  padding: clamp(12px, 3vw, 14px) clamp(14px, 3.5vw, 16px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--ease), background-color var(--ease), box-shadow var(--ease);
}

@media (hover: hover) {
  a.contact-link:hover {
    border-color: var(--line-hover);
    box-shadow: var(--shadow);
  }
}

.contact-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--badge-bg);
  color: var(--text);
}

.contact-icon svg {
  width: 22px;
  height: 22px;
}

.contact-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.contact-label {
  font-size: clamp(11px, 2.8vw, 12px);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-value {
  font-size: clamp(14px, 3.5vw, 15px);
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
}

a.contact-link .contact-value {
  border-bottom: 1px solid transparent;
  width: fit-content;
  transition: color var(--ease), border-color var(--ease);
}

@media (hover: hover) {
  a.contact-link:hover .contact-value {
    color: var(--muted);
    border-bottom-color: var(--line-hover);
  }
}

.contact-hint {
  font-size: clamp(12px, 3vw, 13px);
  color: var(--muted);
  line-height: 1.35;
}

.footer-copy {
  margin: var(--space-md) 0 0;
  font-size: clamp(12px, 3vw, 13px);
  color: var(--muted);
}

@media (min-width: 720px) {
  .contacts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
  }

  .contacts li {
    border-bottom: 1px solid var(--line);
  }

  .contacts li:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .contacts li:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .contact-link {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    min-height: 72px;
  }

  @media (hover: hover) {
    a.contact-link:hover {
      background: var(--badge-bg);
      box-shadow: none;
    }
  }
}

/* modal */
.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-box {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  max-height: min(90dvh, 720px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: clamp(16px, 4vw, 22px);
  padding-bottom: calc(clamp(16px, 4vw, 22px) + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-hover);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.modal-head h2 {
  margin: 0;
  font-size: clamp(17px, 4.2vw, 18px);
  font-weight: 600;
  letter-spacing: -0.02em;
  padding-right: var(--space-xs);
  text-wrap: balance;
}

.close {
  display: grid;
  place-items: center;
  width: var(--touch);
  height: var(--touch);
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 22px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  transition: border-color var(--ease), color var(--ease);
}

.close:hover {
  border-color: var(--line-hover);
  color: var(--text);
}

.form {
  display: grid;
  gap: clamp(12px, 3vw, 16px);
}

.form label {
  display: grid;
  gap: var(--space-2xs);
  font-size: clamp(12px, 3vw, 13px);
  font-weight: 500;
  color: var(--muted);
}

.form input,
.form select,
.form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: clamp(10px, 2.5vw, 12px);
  font-size: 16px;
  border-radius: var(--radius-sm);
  transition: border-color var(--ease), box-shadow var(--ease);
}

.form input:focus,
.form select:focus,
.form textarea:focus {
  border-color: var(--text);
  box-shadow: var(--focus);
}

.check {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: var(--space-xs);
  color: var(--text);
  font-size: clamp(13px, 3.2vw, 14px);
  font-weight: 400;
}

.check input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--text);
}

.submit {
  width: 100%;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: clamp(12px, 3vw, 14px);
  font-size: clamp(14px, 3.5vw, 15px);
  font-weight: 500;
  cursor: pointer;
  margin-top: var(--space-2xs);
  min-height: var(--touch);
  border-radius: var(--radius-sm);
  transition: background-color var(--ease), border-color var(--ease), transform 0.12s ease;
}

.submit:hover {
  background: color-mix(in srgb, var(--btn-bg) 88%, var(--text));
  border-color: color-mix(in srgb, var(--btn-border) 88%, var(--text));
}
.submit:active { transform: scale(0.99); }
.submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.err {
  margin: 0;
  font-size: 14px;
  color: #b42318;
}

html[data-theme="dark"] .err { color: #ff8d85; }

.hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
}

/* narrow phones */
@media (max-width: 360px) {
  .intro {
    flex-direction: column;
    align-items: stretch;
  }

  .photo {
    align-self: flex-start;
  }
}

/* two columns when each card has enough width */
@media (min-width: 560px) {
  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
}

@media (min-width: 720px) {
  :root {
    --photo: clamp(112px, 12vw, 140px);
  }

  .intro h1 {
    font-size: clamp(22px, 4.5vw, 30px);
  }

  .cards {
    gap: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow);
  }

  .card {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .card:first-child {
    border-right: 1px solid var(--line);
  }

  @media (hover: hover) {
    .card:hover {
      background: var(--badge-bg);
      box-shadow: none;
    }
  }
}

@media (min-width: 640px) {
  :root {
    --content-max: 760px;
  }

  .modal {
    align-items: center;
    padding: var(--gutter);
  }

  .modal-box {
    border-radius: var(--radius);
  }
}

@media (min-width: 960px) {
  :root {
    --content-max: 800px;
    --gutter: clamp(24px, 5vw, 48px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
  }
}
