/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
  --bg: #ffffff;
  --ink: #0b0b0c;
  --text: #6e6e73;
  --faint: #a1a1a6;
  --line: #ececee;
  --chip: #f4f4f5;
  --tile: #0b0b0c;
  --accent: #3d5afe;
  --scrollbar: #d4d4d8;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: 24px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0d;
    --ink: #f5f5f7;
    --text: #8e8e93;
    --faint: #5c5c61;
    --line: #1f1f22;
    --chip: #1a1a1c;
    --tile: #2e2e33;
    --accent: #8c9eff;
    --scrollbar: #3a3a40;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c0c0d;
  --ink: #f5f5f7;
  --text: #8e8e93;
  --faint: #5c5c61;
  --line: #1f1f22;
  --chip: #1a1a1c;
  --tile: #2e2e33;
  --accent: #8c9eff;
  --scrollbar: #3a3a40;
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border: 2px solid var(--bg);
  border-radius: 8px;
}

::selection {
  background: var(--accent);
  color: #fff;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font: 500 18px/30px var(--font);
  letter-spacing: -0.017em;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
}

a,
button {
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}

.sprite {
  position: absolute;
  overflow: hidden;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(24px, 6vh, 72px) var(--gutter) clamp(16px, 3vh, 32px);
}

/* Optical centre: free space is split 1:2, so the block sits slightly above the middle. */
.page::before { content: ""; flex: 1 1 0; }
.page::after { content: ""; flex: 2 1 0; }

/* While the requisites are open the top offset is frozen: the block only grows downward. */
.page.is-anchored::before { flex: 0 0 var(--anchor, 0px); }

/* ==========================================================================
   Intro
   ========================================================================== */

.js .reveal {
  opacity: 0;
  filter: blur(8px);
  transform: translate3d(0, 6px, 0);
}

.js.is-ready .reveal {
  animation: reveal 1.2s var(--ease-out) both;
  animation-delay: calc(var(--order, 0) * 100ms + 200ms);
  will-change: opacity, filter, transform;
  backface-visibility: hidden;
}

/* The footer sits at the bottom edge: any vertical offset would extend the page. */
.js .reveal--fade { transform: none; }
.js.is-ready .reveal--fade { animation-name: reveal-fade; }

/* The photo is revealed by the particle effect; until then it is hidden. */
.js .photo.is-pending { opacity: 0; }

@keyframes reveal {
  0% { opacity: 0; filter: blur(8px); transform: translate3d(0, 6px, 0); }
  60% { opacity: 1; }
  100% { opacity: 1; filter: blur(0); transform: translate3d(0, 0, 0); }
}

@keyframes reveal-fade {
  0% { opacity: 0; filter: blur(8px); }
  60% { opacity: 1; }
  100% { opacity: 1; filter: blur(0); }
}

/* ==========================================================================
   Profile
   ========================================================================== */

.profile {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.avatar {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--chip);
  box-shadow: 0 0 0 1px var(--line);
}

/* Rounded itself so the particle snapshot already has the frame's corners. */
.photo {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.profile-name {
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  line-height: 34px;
  letter-spacing: -0.03em;
}

.profile-role {
  margin-top: 4px;
  font-size: 18px;
  line-height: 26px;
}

.about p + p { margin-top: 16px; }

.about b {
  color: var(--ink);
  font-weight: inherit;
}

.text-link {
  color: var(--ink);
  text-decoration: underline 1px var(--faint);
  text-underline-offset: 4px;
  transition: text-decoration-color 0.2s;
}

/* ==========================================================================
   Contacts
   ========================================================================== */

.contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 32px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px 0 10px;
  border-radius: 12px;
  background: var(--chip);
  color: var(--ink);
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s, transform 0.2s;
}

.chip:active { transform: scale(0.98); }

.chip-icon {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--tile);
  color: #fff;
}

.chip-icon svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Glint that sweeps across the icon on hover. */
.chip-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgb(255 255 255 / 0.55) 50%, transparent 70%);
  transform: translateX(-120%);
}

/* ==========================================================================
   Requisites
   ========================================================================== */

.requisites {
  margin-top: 28px;
  color: var(--faint);
  font-size: 15px;
  line-height: 24px;
}

.requisites summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  transition: color 0.2s;
}

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

.requisites summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.25s;
}

.requisites[open] summary::after { transform: rotate(-135deg) translateY(-1px); }

.requisites dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--chip);
  animation: requisites-in 0.28s var(--ease-out);
}

.requisites dd {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

html[lang="ru"] .en-only { display: none; }

@keyframes requisites-in {
  from { opacity: 0; transform: translateY(-4px); }
}

.copy-btn {
  position: relative;
  margin: -2px 0 -2px -10px;
  padding: 2px 34px 2px 10px;
  border-radius: 8px;
  transition: background-color 0.2s, box-shadow 0.2s;
}

.copy-btn:active { background: var(--bg); }

.copy-btn svg {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 15px;
  height: 15px;
  margin-top: -7.5px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.2s;
}

.copy-btn .icon-copy { color: var(--faint); }
.copy-btn .icon-check { color: var(--ink); stroke-width: 2.4; }
.copy-btn.is-copied .icon-check { opacity: 1; }

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 12px var(--gutter) 20px;
  color: var(--faint);
  font-size: 14px;
  line-height: 20px;
}

.theme-switch {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--chip);
  box-shadow: inset 0 0 0 1px var(--line);
}

.theme-switch button {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 34px;
  border-radius: 9px;
  color: var(--faint);
  transition: color 0.2s;
}

.theme-switch button[aria-checked="true"] { color: var(--ink); }

.theme-switch svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 40px;
  height: 34px;
  border-radius: 9px;
  background: var(--bg);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 0 0 1px var(--line);
  transform: translateX(calc(var(--thumb, 1) * 40px));
  transition: transform 0.35s cubic-bezier(0.3, 1.3, 0.5, 1);
}

.lang-switch {
  display: flex;
  gap: 2px;
}

.lang-switch button {
  padding: 3px 7px;
  border-radius: 6px;
  color: var(--faint);
  transition: color 0.2s, background-color 0.2s;
}

.lang-switch button[aria-pressed="true"] { color: var(--ink); }

/* ==========================================================================
   Hover — only for devices with a real pointer, so nothing sticks on touch
   ========================================================================== */

@media (hover: hover) and (pointer: fine) {
  .text-link:hover { text-decoration-color: currentColor; }
  .chip:hover { background: var(--line); }
  .chip:hover .chip-icon::after { transform: translateX(120%); transition: transform 0.6s ease; }
  .requisites summary:hover { color: var(--ink); }
  .copy-btn:hover { background: var(--bg); box-shadow: 0 0 0 1px var(--line); }
  .copy-btn:hover:not(.is-copied) .icon-copy { opacity: 1; }
  .theme-switch button:hover { color: var(--ink); }
  .lang-switch button:hover { color: var(--ink); background: var(--chip); }
}

/* ==========================================================================
   Small screens
   ========================================================================== */

@media (max-width: 520px) {
  :root { --gutter: 16px; }

  body { font-size: 16px; line-height: 26px; }
  .page { padding-top: 24px; padding-bottom: 16px; }
  .footer { padding-top: 8px; padding-bottom: 16px; }

  .profile { gap: 16px; margin-bottom: 20px; }
  .avatar { width: 60px; height: 60px; border-radius: 15px; }
  .profile-name { font-size: 24px; line-height: 30px; }
  .profile-role { font-size: 16px; }
  .about p + p { margin-top: 12px; }

  .contacts { gap: 8px; margin-top: 24px; }
  .chip { height: 40px; padding: 0 14px 0 8px; font-size: 15px; }

  .requisites { margin-top: 20px; }
  .requisites dl { grid-template-columns: 1fr; gap: 0; }
  .requisites dd { margin-bottom: 8px; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .js .reveal,
  .js.is-ready .reveal {
    animation: none;
    opacity: 1;
    filter: none;
    transform: none;
  }

  .js .photo.is-pending { opacity: 1; }
  .requisites dl { animation: none; }
  .theme-thumb { transition: none; }
}
