/* Defo-Tech Portfolio — Etheric Precision
   Light, airy, minimal. Apple / Linear feel. */

:root {
  --bg: #fbfbfb;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --grey: #86868b;
  --grey-soft: #a6a6ab;
  --accent: #007aff;
  --hairline: #e5e5e5;
  --hairline-soft: #efefef;
  --chip: #f2f2f7;
  --radius-sm: 8px;
  --radius: 16px;
  --radius-pill: 999px;
  --max: 1120px;
  --shadow-lift: 0 12px 28px rgba(0, 0, 0, 0.05);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.03);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 251, 251, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 60px;
}
.brand {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.nav-links { display: flex; gap: 34px; }
.nav-links a {
  color: var(--grey);
  font-size: 15px;
  font-weight: 500;
  transition: color 0.2s var(--ease);
  position: relative;
  padding: 4px 0;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 28px;
  padding: 5px 12px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: border-color 0.15s var(--ease);
}
.lang-toggle:hover { border-color: var(--ink); }
.lang-toggle span { color: var(--grey-soft); transition: color 0.15s var(--ease); }
.lang-toggle span.active { color: var(--ink); }
.lang-toggle .sep { color: var(--hairline); font-weight: 400; }

/* ---------- View transitions ---------- */
.view { animation: fade 0.4s var(--ease); }
@keyframes fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Catalog hero ---------- */
.hero {
  text-align: center;
  padding: 96px 0 56px;
}
.hero h1 {
  font-size: 64px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 18px;
}
.hero p {
  font-size: 20px;
  color: var(--grey);
  margin: 0;
  font-weight: 400;
}
.hero-sub {
  max-width: 940px;
  margin: 0 auto !important;
  line-height: 1.55;
}

/* ---------- Catalog grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-bottom: 120px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 16px 22px;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: #d8d8da;
}
.card-thumb {
  border-radius: 10px;
  overflow: hidden;
  background: var(--chip);
  aspect-ratio: 16 / 10;
  margin-bottom: 18px;
  border: 1px solid var(--hairline-soft);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey-soft);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #f5f5f7, #ececef);
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 0 2px; }
.tag {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--grey);
  background: var(--chip);
  padding: 4px 9px;
  border-radius: var(--radius-pill);
}
.card h3 { font-size: 19px; font-weight: 600; margin: 0 0 6px; padding: 0 2px; letter-spacing: -0.02em; }
.card .card-sub { color: var(--grey); font-size: 14.5px; margin: 0 0 16px; padding: 0 2px; }
.card .more { color: var(--accent); font-size: 14px; font-weight: 500; padding: 0 2px; margin-top: auto; }
.card .more::after { content: " \2192"; }

/* ---------- Project detail ---------- */
.detail { padding: 56px 0 120px; }
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--grey);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 40px;
  transition: color 0.2s var(--ease);
}
.back:hover { color: var(--ink); }
.back::before { content: "\2190"; }

.detail-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 44px;
  overflow: hidden;
}
.detail-metrics .metric {
  flex: 1 1 0;
  min-width: 120px;
  padding: 22px 24px;
  border-right: 1px solid var(--hairline);
  text-align: center;
}
.detail-metrics .metric:last-child { border-right: none; }
.detail-metrics .metric .v { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.detail-metrics .metric .l { font-size: 12px; color: var(--grey); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 4px; }

.detail-head { margin-bottom: 44px; }
.detail-head h1 { font-size: 52px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.06; margin: 0 0 14px; }
.detail-head p { font-size: 21px; color: var(--grey); margin: 0; max-width: 720px; }

/* two columns: media left, info right */
.detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}
.media-col { display: flex; flex-direction: column; gap: 16px; }
.media-item {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--surface);
}
.media-item img { width: 100%; height: auto; cursor: zoom-in; }
.media-item video { width: 100%; height: auto; display: block; background: #000; }
.media-item.mux { aspect-ratio: 16 / 9; border: none; }
.media-item.mux iframe { width: 100%; height: 100%; border: 0; display: block; border-radius: var(--radius); }
.media-grid-vert {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.media-grid-vert .media-item video,
.media-grid-vert .media-item img { aspect-ratio: 9 / 16; object-fit: cover; }
.media-note {
  border: 1px dashed var(--hairline);
  border-radius: var(--radius);
  padding: 40px 28px;
  color: var(--grey);
  font-size: 15px;
  text-align: center;
  background: var(--surface);
}

.info-col { position: sticky; top: 88px; }
.info-col .label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--grey-soft);
  margin: 0 0 12px;
}
.info-col .overview { font-size: 17px; line-height: 1.65; margin: 0 0 36px; }
.features { list-style: none; padding: 0; margin: 0 0 36px; }
.features li { padding: 18px 0; border-top: 1px solid var(--hairline); }
.features li:last-child { border-bottom: 1px solid var(--hairline); }
.features .f-title { font-weight: 600; font-size: 15.5px; margin: 0 0 3px; }
.features .f-desc { color: var(--grey); font-size: 14.5px; margin: 0; line-height: 1.55; }
.stack { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.stack .pill {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--chip);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
}
.links { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.btn-link:hover { border-color: var(--ink); }
.btn-link::after { content: "\2197"; color: var(--grey); }

/* full-width detailed description */
.detail-long {
  margin-top: 88px;
  padding-top: 56px;
  border-top: 1px solid var(--hairline);
}
.detail-long > .label { margin-bottom: 8px; }
.detail-long h2 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.reading { max-width: none; }
.reading section {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 56px;
  padding: 36px 0;
  border-top: 1px solid var(--hairline);
}
.reading section:last-child { border-bottom: 1px solid var(--hairline); }
.reading h3 { font-size: 21px; font-weight: 600; letter-spacing: -0.015em; margin: 0; align-self: start; }
.reading .body { max-width: 760px; }
.reading .body p { font-size: 17px; line-height: 1.7; color: #38383c; margin: 0 0 16px; }
.reading .body p:last-child { margin-bottom: 0; }
.detail-footer {
  display: flex;
  justify-content: center;
  margin-top: 48px;
}
.bottom-back {
  margin-bottom: 0;
  padding: 12px 18px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.bottom-back:hover { border-color: var(--ink); }

/* ---------- About ---------- */
.about { padding: 80px 0 120px; }
.about-photo { float: right; width: 270px; margin: 6px 0 24px 48px; }
.about-photo img { width: 100%; height: auto; display: block; border-radius: var(--radius); border: 1px solid var(--hairline); }
.about h1 { font-size: 52px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; margin: 0 0 24px; }
.about > p { font-size: 17px; color: #3d3d42; margin: 0 0 16px; line-height: 1.65; }
.about > p:last-of-type { margin-bottom: 0; }
.about-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  clear: both;
  margin: 48px 0 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}
.about-stats .stat { flex: 1 1 0; min-width: 140px; padding: 28px 8px; }
.about-stats .stat .v { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.about-stats .stat .l { color: var(--grey); font-size: 14px; margin-top: 4px; }
.about h2.section-title { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 56px 0 28px; clear: both; }
.about-bio p { font-size: 17px; color: #3d3d42; line-height: 1.65; margin: 0 0 16px; }
.about-bio p:last-child { margin-bottom: 0; }
.about-timeline {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--hairline);
}
.tl-item {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 52px;
  padding: 34px 0;
  border-bottom: 1px solid var(--hairline);
}
.tl-meta { align-self: start; }
.tl-period {
  color: var(--grey-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.tl-item h3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0;
}
.tl-body { max-width: 790px; }
.tl-body p {
  font-size: 16.5px;
  color: #3d3d42;
  line-height: 1.68;
  margin: 0 0 13px;
}
.tl-body p:last-child { margin-bottom: 0; }
.tl-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 0;
}
.tl-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--chip);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.tl-result {
  margin-top: 18px !important;
  padding: 16px 0 0;
  border-top: 1px solid var(--hairline-soft);
  color: var(--ink) !important;
  font-size: 15px !important;
}
.tl-result span {
  display: block;
  color: var(--grey-soft);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.approach {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.approach .item {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px;
}
.approach .item h3 { font-size: 18px; font-weight: 600; margin: 0 0 8px; letter-spacing: -0.015em; }
.approach .item p { color: #3d3d42; font-size: 15px; margin: 0; line-height: 1.6; }

/* ---------- Contacts ---------- */
.contacts { padding: 80px 0 120px; }
.contacts-hero { max-width: 760px; }
.contacts-hero h1 { font-size: 56px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; margin: 0 0 24px; }
.contacts-hero p { font-size: 21px; color: var(--grey); margin: 0; line-height: 1.55; }
.contact-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 56px;
}
.contact-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 32px 28px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
.contact-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.contact-card .c-label { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--grey); }
.contact-card .c-value { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; color: var(--ink); overflow-wrap: anywhere; }
.contact-card .c-value--long { font-size: 16px; }

/* ---------- Contact form ---------- */
.contact-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 44px;
  align-items: start;
  margin-top: 28px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 34px;
  box-shadow: var(--shadow-soft);
}
.contact-form .form-kicker {
  color: var(--grey-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.contact-form .form-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0 0 12px;
}
.contact-form .form-sub {
  color: var(--grey);
  font-size: 16px;
  margin: 0;
  line-height: 1.6;
}
.form-fields {
  display: grid;
  gap: 16px;
}
.contact-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--grey-soft);
  margin-bottom: 8px;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fbfbfd;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 14px 15px;
  outline: none;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.contact-form input:focus,
.contact-form textarea:focus {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.08);
}
.contact-form input::placeholder,
.contact-form textarea::placeholder { color: var(--grey-soft); }
.contact-form textarea {
  resize: vertical;
  min-height: 138px;
  line-height: 1.55;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-top: 2px;
}
.form-submit {
  appearance: none;
  border: none;
  cursor: pointer;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  min-height: 46px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}
.form-submit:hover { opacity: 0.9; transform: translateY(-1px); }
.form-note {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--grey);
}
.form-note.ok { color: #1d7a34; }
.form-note.error { color: #c0392b; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 22, 0.86);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 40px;
  cursor: zoom-out;
}
.lightbox.open { display: flex; animation: fade 0.25s var(--ease); }
.lightbox img { max-width: 92vw; max-height: 90vh; width: auto; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .detail-body { grid-template-columns: 1fr; gap: 40px; }
  .info-col { position: static; }
  .hero h1 { font-size: 48px; }
  .detail-head h1 { font-size: 40px; }
  .approach { grid-template-columns: 1fr; }
  .about-photo { float: none; width: 220px; margin: 0 0 24px; }
  .tl-item { grid-template-columns: 1fr; gap: 14px; }
  .contact-cards { grid-template-columns: 1fr; }
  .contact-form { grid-template-columns: 1fr; gap: 26px; }
  .contacts-hero h1 { font-size: 44px; }
  .reading section { grid-template-columns: 1fr; gap: 16px; }
  .reading h3 { position: static; }
}
@media (max-width: 600px) {
  .container { padding: 0 18px; }
  .grid { grid-template-columns: 1fr; }
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 14px; }
  .lang-toggle { margin-left: 14px; }
  .hero { padding: 64px 0 40px; }
  .hero h1 { font-size: 38px; }
  .hero p { font-size: 17px; }
  .detail-head h1 { font-size: 32px; }
  .detail-head p { font-size: 18px; }
  .detail-metrics .metric { flex-basis: 50%; border-bottom: 1px solid var(--hairline); }
  .detail-metrics .metric:nth-child(2n) { border-right: none; }
  .media-grid-vert { grid-template-columns: repeat(2, 1fr); }
  .about h1 { font-size: 38px; }
  .tl-item { padding: 28px 0; }
  .tl-body p { font-size: 16px; }
  .tl-stats { margin-top: 18px; }
  .contact-form { padding: 24px 20px; }
  .contact-form .form-title { font-size: 24px; }
  .form-submit { width: 100%; }
  .form-note { width: 100%; }
  .reading .body p, .info-col .overview { font-size: 16px; }
}

/* ---------- Типографіка: вдови, сироти, рівні рядки ---------- */
/* Заголовки і короткі центровані блоки балансуємо по рядках. */
.hero h1,
.hero-sub,
.detail-head h1,
.detail-head p,
.about h1,
.contacts-hero h1,
.contacts-hero p,
.card h3,
.reading h3,
.features .f-title {
  text-wrap: balance;
}

/* Основний текст: прибираємо одиночне слово на останньому рядку. */
.info-col .overview,
.features .f-desc,
.card .card-sub,
.reading .body p,
.approach .item p,
.about > p,
.about-bio p,
.tl-item p {
  text-wrap: pretty;
}

/* Не розриваємо слова переносом по складах і не лишаємо прийменники
   в кінці рядка там, де це найпомітніше. */
body {
  hyphens: none;
}
