/* Портфоліо Олександра. Спершу телефон, далі — ширші екрани. */
:root {
  --paper: #f3f0e8;
  --paper-2: #ebe6da;
  --ink: #16171b;
  --muted: #5d5c57;
  --line: #d8d2c4;
  --green: #2e7d5b;
  --green-ink: #1f5c42;
  --frame: #16171b;      /* рамка телефона */
  --band: #16171b;       /* темна смуга «Напишіть мені» */
  --band-fg: #f3f0e8;
  --band-muted: #b9b5aa;
  --band-line: #3a3b40;
  --on-ink: #f3f0e8;     /* текст на темній кнопці */
  /* Колір сторінки не залежить від теми телефона: браузер не «перефарбовує» сайт сам */
  color-scheme: only light;
  --head: "Unbounded", "Arial Black", system-ui, sans-serif;
  --body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gut: 16px;
  --max: 1180px;
}

/* Темний варіант дизайну — вмикається лише адресою ?tema=tmava (js/theme.js), а не темою телефона */
:root.tmava {
  --paper: #121316;
  --paper-2: #1c1d22;
  --ink: #f1eee6;
  --muted: #a8a49b;
  --line: #2d2e34;
  --green: #3f9e72;
  --green-ink: #57b98a;
  --frame: #2b2c32;
  --band: #0a0b0d;
  --band-fg: #f1eee6;
  --band-muted: #a8a49b;
  --band-line: #26272c;
  --on-ink: #121316;
  color-scheme: only dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--body);
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2 { font-family: var(--head); font-weight: 700; letter-spacing: -0.02em; margin: 0; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 50;
  background: var(--ink); color: var(--on-ink); padding: 8px 12px; border-radius: 6px;
}
.skip:focus { left: 8px; }

/* ---------- Верхня смужка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px var(--gut);
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color .25s;
}
.top.scrolled { border-bottom-color: var(--line); }
.brand {
  font-family: var(--head); font-weight: 700; font-size: 15px; text-decoration: none;
  display: flex; flex-direction: column; line-height: 1.05; margin-right: auto;
}
.brand span { font-family: var(--body); font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: .01em; }
.menu { display: none; }
.langs { display: flex; gap: 2px; }
.langs button {
  border: 0; background: none; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 8px 6px; min-width: 32px; border-radius: 6px;
}
.langs button[aria-pressed="true"] { color: var(--ink); text-decoration: underline 2px var(--green); text-underline-offset: 5px; }
.top-wa {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--ink); color: var(--on-ink); text-decoration: none;
  font-size: 14px; font-weight: 600; padding: 9px 12px; border-radius: 8px;
}
.top-wa svg { width: 17px; height: 17px; }

/* ---------- Перший екран ---------- */
.hero {
  padding: 18px var(--gut) 40px;
  max-width: var(--max); margin: 0 auto;
}
.me { margin: 0 0 22px; display: flex; align-items: center; gap: 14px; }
.me img {
  width: 76px; height: 76px; object-fit: cover; object-position: 50% 22%;
  border-radius: 18px;
}
.me figcaption { display: flex; flex-direction: column; font-size: 14px; color: var(--muted); line-height: 1.35; }
.me strong { color: var(--ink); font-size: 16px; }
.hero h1 { font-size: clamp(30px, 8.6vw, 64px); line-height: 1.04; }
.lead { font-size: 18px; color: var(--muted); margin: 18px 0 26px; max-width: 34em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  text-decoration: none; font-weight: 600; font-size: 16px;
  padding: 14px 18px; border-radius: 10px;
  transition: transform .15s, background-color .2s;
}
.btn svg { width: 20px; height: 20px; }
.btn-wa { background: var(--green); color: #fff; flex: 1 1 auto; justify-content: center; }
.btn-wa:hover { background: var(--green-ink); }
.btn-tg { border: 1.5px solid var(--ink); flex: 1 1 auto; justify-content: center; }
.btn-tg:hover { background: var(--paper-2); }
.btn:active { transform: scale(.98); }
.see { display: inline-block; margin-top: 26px; font-weight: 600; text-decoration: none; border-bottom: 1.5px solid var(--line); }
.see:hover { border-bottom-color: var(--ink); }

/* ---------- Каталог ---------- */
.works { max-width: var(--max); margin: 0 auto; padding: 36px var(--gut) 56px; scroll-margin-top: 60px; }
.works-head h2 { font-size: clamp(26px, 6.5vw, 44px); }
.works-head p { color: var(--muted); margin: 8px 0 18px; }

.filters {
  display: flex; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(var(--gut) * -1) 22px; padding: 0 var(--gut);
  border-bottom: 1px solid var(--line);
}
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: none; border: 0; background: none; cursor: pointer;
  font-family: var(--head); font-weight: 500; font-size: 15px; color: var(--muted);
  padding: 12px 10px 13px; position: relative; white-space: nowrap;
}
.filters button sup { font-family: var(--body); font-size: 11px; font-weight: 600; margin-left: 3px; }
.filters button::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px;
  background: var(--green); transform: scaleX(0); transition: transform .25s;
}
.filters button[aria-pressed="true"] { color: var(--ink); }
.filters button[aria-pressed="true"]::after { transform: scaleX(1); }
.filters button:hover { color: var(--ink); }

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 26px; }
.work {
  display: grid; grid-template-columns: 124px 1fr; gap: 18px; align-items: start;
  transition: opacity .22s, transform .22s;
}
.work.out { opacity: 0; transform: scale(.96); }
.work[hidden] { display: none; }

.phone {
  position: relative; display: block;
  aspect-ratio: 9 / 18.5;
  border: 6px solid var(--frame); border-radius: 22px;
  background: var(--frame); overflow: hidden;
  text-decoration: none;
  box-shadow: 0 10px 24px -14px rgba(22, 23, 27, .55);
  transition: transform .25s;
}
.phone::before { /* «острівець» камери */
  content: ""; position: absolute; top: 6px; left: 50%; z-index: 2;
  width: 30%; height: 9px; margin-left: -15%;
  background: var(--frame); border-radius: 9px;
}
.screen {
  position: absolute; inset: 0; border-radius: 16px; overflow: hidden;
  background: var(--c, #555); color: #fff;
  display: flex; align-items: flex-end; padding: 12px;
}
.screen-name { font-family: var(--head); font-weight: 600; font-size: 12px; line-height: 1.2; opacity: .92; }

/* знімок сайту всередині телефона */
.shot {
  position: absolute; top: 0; left: 0; width: 100%; height: auto; max-width: none;
  transform: translateY(0);
}
.screen.live .shot {
  will-change: transform;
  animation: scrollshot var(--dur, 60s) cubic-bezier(.45, .05, .55, .95) infinite;
  animation-play-state: paused;
}
.screen.live.run .shot { animation-play-state: running; }
a.phone:hover .screen.live .shot,
.tab-hidden .screen.live .shot { animation-play-state: paused; }
@keyframes scrollshot {
  0%, 6% { transform: translateY(0); }
  90%, 95% { transform: translateY(calc(var(--dist, 0px) * -1)); }
  100% { transform: translateY(0); }
}
a.phone:hover { transform: translateY(-3px); }

.work-body h3 { font-family: var(--head); font-weight: 600; font-size: 17px; line-height: 1.25; margin: 4px 0 6px; }
.work-body p { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
.kind { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.kind::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.kind.real::before { background: var(--green); }
.kind.demo::before { background: #c9a227; }
.open { font-weight: 600; font-size: 15px; text-decoration: none; border-bottom: 1.5px solid var(--ink); }
.open:hover { color: var(--green-ink); border-bottom-color: var(--green); }
.soon-note { font-size: 14px; color: var(--muted); font-style: italic; }

/* Вітрина ефектів */
.effects {
  margin-top: 40px; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: center;
  padding: 18px; border: 1.5px solid var(--ink); border-radius: 14px; text-decoration: none;
  transition: background-color .2s;
}
.effects:hover { background: var(--paper-2); }
.effects-dots { display: flex; gap: 5px; }
.effects-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--green); animation: hop 1.6s ease-in-out infinite; }
.effects-dots i:nth-child(2) { background: #c9a227; animation-delay: .18s; }
.effects-dots i:nth-child(3) { background: #b0566e; animation-delay: .36s; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-7px); } }
.effects-body { display: flex; flex-direction: column; }
.effects-body strong { font-family: var(--head); font-weight: 600; font-size: 17px; }
.effects-body span { color: var(--muted); font-size: 15px; }
.effects-go { grid-column: 1 / -1; font-weight: 600; }

/* ---------- Про мене ---------- */
.about { max-width: var(--max); margin: 0 auto; padding: 48px var(--gut); border-top: 1px solid var(--line); scroll-margin-top: 60px; }
.about h2 { font-size: clamp(26px, 6.5vw, 44px); margin-bottom: 14px; }
.about-text p { margin: 0 0 12px; max-width: 36em; }
.facts { margin: 26px 0 0; display: grid; gap: 18px; }
.facts div { border-left: 3px solid var(--green); padding-left: 14px; }
.facts dt { font-weight: 700; font-size: 17px; }
.facts dd { margin: 3px 0 0; color: var(--muted); font-size: 15px; }

/* ---------- Контакт ---------- */
.contact {
  background: var(--band); color: var(--band-fg);
  padding: 52px var(--gut) 56px; scroll-margin-top: 60px;
}
.contact > * { max-width: calc(var(--max) - 2 * var(--gut)); margin-left: auto; margin-right: auto; }
.contact h2 { font-size: clamp(30px, 9vw, 64px); }
.contact > p { color: var(--band-muted); margin-top: 12px; margin-bottom: 26px; }
.contact-links { list-style: none; padding: 0; }
.contact-links a {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
  padding: 18px 0; border-top: 1px solid var(--band-line); text-decoration: none;
}
.contact-links li:last-child a { border-bottom: 1px solid var(--band-line); }
.cl-name { font-size: 14px; color: var(--band-muted); grid-column: 1; }
.cl-val { font-family: var(--head); font-weight: 600; font-size: clamp(19px, 5.4vw, 34px); grid-column: 1; }
.cl-arrow { grid-column: 2; grid-row: 1 / 3; font-size: 26px; transition: transform .2s; }
.contact-links a:hover .cl-val { color: #8fd4b2; }
.contact-links a:hover .cl-arrow { transform: translateX(5px); }

.foot {
  background: var(--band); color: var(--band-muted); font-size: 13px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px;
  padding: 18px var(--gut) 26px; border-top: 1px solid var(--band-line);
}

/* ---------- Ширші екрани ---------- */
@media (min-width: 640px) {
  :root { --gut: 28px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 36px 28px; }
  .btn-wa, .btn-tg { flex: none; }
  .facts { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 900px) {
  .menu { display: flex; gap: 22px; margin-right: 18px; }
  .menu a { text-decoration: none; font-weight: 500; font-size: 15px; }
  .menu a:hover { text-decoration: underline 1.5px; text-underline-offset: 5px; }
  .hero {
    display: grid; grid-template-columns: 1fr 340px; gap: 56px; align-items: center;
    padding-top: 48px; padding-bottom: 72px;
  }
  .me { order: 2; flex-direction: column; align-items: stretch; gap: 12px; margin: 0; }
  .me img { width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: 22px; }
  .me figcaption { padding: 0 4px; }
  .lead { font-size: 20px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 48px 36px; }
  .work { grid-template-columns: 1fr; gap: 18px; }
  .phone { width: 64%; max-width: 205px; }
  .filters { margin-left: 0; margin-right: 0; padding: 0; }
  .effects { grid-template-columns: auto 1fr auto; padding: 22px 26px; }
  .effects-go { grid-column: auto; }
  .about { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; padding-top: 72px; padding-bottom: 72px; }
  .facts { grid-template-columns: 1fr; margin: 0; }
  .contact { padding-top: 80px; padding-bottom: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
