/* atelierforma.cz – shared stylesheet.
   Mobile-first, but every value reproduces the original per-page design (spec FR-38).
   Breakpoints as before: homepage switches at 769 px, all other pages at 901 px;
   the menu icon is used below 768 px (FR-31). */

@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/assets/fonts/montserrat-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Montserrat'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/assets/fonts/montserrat-cs-wght.woff2') format('woff2');
  unicode-range: U+010C-010F, U+011A-011B, U+0139-013A, U+013D-013E, U+0147-0148, U+0154-0155, U+0158-0159, U+0160-0161, U+0164-0165, U+016E-016F, U+017D-017E;
}

:root { --bg: #000; --fg: #fff; --accent: #888; }
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  --h-height: 75px;
  font-family: 'Montserrat', sans-serif; background: var(--bg); color: var(--fg);
  overflow-x: hidden; font-weight: 300; -webkit-font-smoothing: antialiased;
}
.page-projekty, .page-spoluprace, .page-kontakt { font-weight: 400; }
.page-kontakt { overflow-y: scroll; }
body.nav-open { overflow: hidden; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
picture { display: block; }

/* ---------- Header and navigation ---------- */
.site-header {
  position: fixed; top: 0; left: 0; width: 100%; height: var(--h-height); padding: 0 5%;
  display: flex; justify-content: space-between; align-items: center; z-index: 2000;
  background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.page-home .site-header { background: rgba(0, 0, 0, 0.4); border-bottom-color: rgba(255, 255, 255, 0.05); }
.site-header.is-transparent {
  background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none;
  border-bottom: 1px solid transparent; transition: 0.4s ease;
}
.site-header.is-transparent.scrolled {
  background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.header-logo img { height: 20px; width: auto; display: block; }
.page-home .header-logo img { height: 16px; }
.page-projekty .header-logo img, .page-spoluprace .header-logo img, .page-kontakt .header-logo img { height: 18px; }

.site-nav ul { display: flex; flex-wrap: wrap; justify-content: flex-end; list-style: none; gap: 0.3rem 1.2rem; align-items: center; }
.site-nav a {
  color: var(--fg); text-decoration: none; font-size: 0.65rem; text-transform: uppercase;
  letter-spacing: 1.5px; font-weight: 300; transition: 0.3s;
}
.site-nav a:hover, .site-nav a.active { color: var(--accent); }

.nav-toggle { display: none; }
.js .nav-toggle {
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -12px;
  background: none; border: 0; color: var(--fg); cursor: pointer; position: relative; z-index: 2;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 22px; height: 1px; background: currentColor; transition: transform 0.3s, background 0.3s;
}
.nav-toggle span { position: relative; }
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -7px; }
.nav-toggle span::after { top: 7px; }
.nav-open .nav-toggle span { background: transparent; }
.nav-open .nav-toggle span::before { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span::after { transform: translateY(-7px) rotate(-45deg); }

.js .site-nav {
  display: none; position: absolute; top: var(--h-height); left: 0; right: 0;
  height: calc(100vh - var(--h-height)); height: calc(100svh - var(--h-height));
  background: #000; align-items: center; justify-content: center;
}
.js .site-nav.is-open { display: flex; }
.js .site-nav ul { flex-direction: column; gap: 0.5rem; }
.js .site-nav a { display: block; padding: 1rem 2rem; font-size: 0.75rem; letter-spacing: 3px; }

@media (min-width: 768px) {
  .js .nav-toggle { display: none; }
  .js .site-nav { display: block; position: static; height: auto; background: none; }
  .js .site-nav ul { flex-direction: row; }
  .site-nav ul, .js .site-nav ul { flex-wrap: nowrap; gap: 1.5rem; }
  .site-nav a, .js .site-nav a { display: inline; padding: 0; font-size: 0.65rem; letter-spacing: 2px; }
  .page-projekt .site-nav a, .page-legal .site-nav a { letter-spacing: 3px; }
  .page-home .site-nav ul { gap: 1.2rem; }
  .page-home .site-nav a { letter-spacing: 1.5px; }
}

/* ---------- Footer (identical on every page) ---------- */
.site-footer {
  padding: 5rem 10%; text-align: center; color: #333; font-size: 0.7rem; letter-spacing: 2px;
  text-transform: uppercase; border-top: 1px solid #111; font-weight: 300;
}
.site-footer p + p { margin-top: 1rem; }
.site-footer a { color: inherit; text-decoration: none; transition: 0.3s; }
.site-footer a:hover { color: var(--accent); }

/* ---------- Reveal animations (hidden only when JS runs, FR-36) ---------- */
.js .card { opacity: 0; transform: translateY(40px); }
.js .item { opacity: 0; transform: translateY(30px); }
.js .anim-up { opacity: 0; transform: translateY(40px); }
.anim-up { transition: 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.anim-up.visible { opacity: 1; transform: translateY(0); }

/* ---------- Homepage ---------- */
.hero-section {
  position: relative; height: 100vh; height: 100svh; width: 100%; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding-top: var(--h-height); background-color: #000;
}
.hero-bg {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1;
  transform: scale(1.1); transition: transform 0.1s linear; will-change: transform, filter, opacity;
}
.hero-bg picture, .hero-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.hero-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.55)); }
.hero-content {
  position: relative; width: 100%; padding: 0 5%; z-index: 10;
  display: flex; flex-direction: column; justify-content: center; height: 100%;
}
.hero-logo {
  position: absolute; top: 65%; left: 50%; transform: translate(-50%, -50%) scale(0.7);
  height: 25px; width: auto; opacity: 1; will-change: opacity, transform;
}
.hero-slogan { position: relative; max-width: 450px; text-align: left; opacity: 1; will-change: opacity, transform; margin-top: -15vh; }
.hero-slogan h1 { font-size: 2.8rem; font-weight: 100; letter-spacing: -2px; line-height: 1; margin-bottom: 1.5rem; }
.hero-slogan p { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 3px; color: #ccc; font-weight: 300; line-height: 1.5; max-width: 90%; }

.services {
  padding: 6rem 5%; background: #000; position: relative; z-index: 105;
  min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
}
.page-home .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.card {
  background: #050505; padding: 3rem 1.5rem; border: 1px solid #111;
  transition: 0.8s cubic-bezier(0.16, 1, 0.3, 1); position: relative; overflow: hidden;
}
.card.visible { opacity: 1; transform: translateY(0); }
.card:hover { border-color: #333; transform: translateY(-10px); background: #0a0a0a; }
.card-img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; transform: translateY(30px);
  transition: 0.6s cubic-bezier(0.16, 1, 0.3, 1); z-index: 1; pointer-events: none;
}
.card-img picture, .card-img img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.card:hover .card-img { opacity: 0.3; transform: translateY(0); }
.card h3, .card p { position: relative; z-index: 2; transition: 0.4s ease; }
.card:hover p { color: #ddd; }
.card h3 { text-transform: uppercase; letter-spacing: 2px; font-weight: 400; margin-bottom: 1.2rem; font-size: 1rem; }
.card p { color: var(--accent); font-size: 0.9rem; line-height: 1.6; }

@media (min-width: 769px) {
  .page-home { --h-height: 90px; }
  .page-home .header-logo img { height: 20px; }
  .page-home .site-nav ul { gap: 3rem; }
  .page-home .site-nav a { font-size: 0.75rem; letter-spacing: 3px; }
  .hero-content { padding: 0 10%; display: block; height: auto; }
  .hero-logo { top: 50%; transform: translate(-50%, -50%) scale(1.8); }
  .hero-slogan { margin-top: 0; }
  .hero-slogan h1 { font-size: clamp(2.5rem, 6vw, 4rem); margin-bottom: 2rem; }
  .hero-slogan p { font-size: 0.9rem; letter-spacing: 5px; max-width: none; }
  .services { padding: 0 10%; }
  .page-home .grid { gap: 3rem; }
  .card { padding: 4.5rem 2.5rem; }
}

/* ---------- Portfolio and Spolupráce ---------- */
.portfolio-top { padding: 8rem 5% 3rem; text-align: center; }
.portfolio-top h1 { font-size: 2rem; font-weight: 100; text-transform: uppercase; letter-spacing: 10px; color: #fff; }
/* "SPOLUPRÁCE" is one letter longer than "PORTFOLIO" and would overflow below 375 px. */
@media (max-width: 374px) { .page-spoluprace .portfolio-top h1 { letter-spacing: 6px; } }
.collab-note { margin-top: 1.5rem; color: var(--accent); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 3px; font-weight: 300; line-height: 1.8; }
.section-top { padding: 6rem 5% 3rem; text-align: center; }
.section-top h2 { font-size: 2rem; font-weight: 100; text-transform: uppercase; letter-spacing: 10px; color: #fff; }
.page-projekty .grid, .page-spoluprace .grid {
  display: grid; grid-template-columns: 1fr; grid-auto-rows: 350px; gap: 10px; padding: 10px; grid-auto-flow: dense;
}
.item {
  display: block; position: relative; overflow: hidden; transition: 1s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer; text-decoration: none; color: inherit;
}
.item picture { width: 100%; height: 100%; }
.item img { display: block; width: 100%; height: 100%; object-fit: cover; transition: 1.5s cubic-bezier(0.16, 1, 0.3, 1); }
.item:hover img { transform: scale(1.04); }
.item.visible { opacity: 1; transform: translateY(0); }
.overlay {
  position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.85), transparent 70%);
  display: flex; align-items: flex-end; padding: 2.5rem; opacity: 0; transition: 0.4s;
}
.item:hover .overlay, .item:focus-visible .overlay { opacity: 1; }
.overlay h3 { font-weight: 300; text-transform: uppercase; letter-spacing: 3px; font-size: 1.1rem; color: #fff; line-height: 1.4; }
.overlay h3 span { display: block; font-size: 0.6rem; color: #aaa; letter-spacing: 2px; margin-top: 8px; font-weight: 300; }
@media (hover: none) { .item .overlay { opacity: 1; } }

/* ---------- Project detail ---------- */
.hero-wrap { position: relative; height: 85vh; height: 85svh; width: 100%; overflow: hidden; }
.hero-img { position: absolute; top: 0; left: 0; width: 100%; height: 120%; z-index: 1; will-change: transform; }
.hero-img picture, .hero-img img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, #000 0%, transparent 60%); z-index: 2; }
.content { position: relative; z-index: 10; max-width: 1200px; margin: -100px auto 100px; padding: 0 5%; }
.title-sec h1 { font-size: 2rem; font-weight: 200; text-transform: uppercase; letter-spacing: 5px; margin-bottom: 0.5rem; }
.title-sec p { color: var(--accent); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 3px; margin-bottom: 4rem; }
.info-grid { display: grid; grid-template-columns: 1fr; gap: 2rem; padding-bottom: 4rem; border-bottom: 1px solid #111; }
.meta-item { margin-bottom: 2rem; }
.meta-label { font-size: 0.65rem; color: #555; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 0.5rem; display: block; }
.meta-value { font-size: 1rem; color: #eee; }
.desc p { margin-bottom: 1.5rem; line-height: 1.8; color: #ccc; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 20px; margin-top: 4rem; }
.gal-item { display: block; overflow: hidden; position: relative; aspect-ratio: 4 / 3; }
.gal-item picture { width: 100%; height: 100%; }
.gal-item img { display: block; width: 100%; height: 100%; object-fit: cover; transition: 1.5s cubic-bezier(0.16, 1, 0.3, 1); cursor: zoom-in; }
.gal-item:hover img { transform: scale(1.05); }
.back-link {
  display: inline-block; margin-top: 3rem; color: #fff; text-decoration: none; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 2px; border-bottom: 1px solid #fff; padding-bottom: 5px; transition: 0.3s;
}
.back-link:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Lightbox (built by lightbox.js) ---------- */
.lightbox {
  display: none; position: fixed; z-index: 3000; left: 0; top: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.6); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
  align-items: center; justify-content: center; opacity: 0; transition: opacity 0.4s ease;
}
.lightbox.show { display: flex; opacity: 1; }
.lightbox-img-wrap { position: relative; width: 85%; height: 85vh; display: flex; align-items: center; justify-content: center; perspective: 1000px; }
.lightbox-img-wrap picture { display: contents; }
.lightbox img {
  max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s ease;
}
.lightbox button { background: none; border: 0; font-family: inherit; color: #fff; cursor: pointer; line-height: 1; }
.close-btn {
  position: absolute; top: 20px; right: 20px; font-size: 40px; font-weight: 100; transition: 0.3s; z-index: 3005;
  min-width: 44px; min-height: 44px;
}
.close-btn:hover, .nav-btn:hover { color: var(--accent); }
.nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%); font-size: 30px; font-weight: 100;
  padding: 10px; transition: 0.3s; z-index: 3005; user-select: none; min-width: 44px; min-height: 44px;
}
.nav-btn[hidden] { display: none; }
.prev-btn { left: 2%; }
.next-btn { right: 2%; }

/* ---------- Contact ---------- */
.contact-wrap { display: grid; grid-template-columns: 1fr; min-height: 100vh; padding-top: var(--h-height); }
.c-info { padding: 8rem 5% 5rem; display: flex; flex-direction: column; justify-content: center; }
.c-info h1 { font-size: 2.5rem; font-weight: 100; margin-bottom: 2rem; text-transform: uppercase; letter-spacing: 5px; color: #fff; }
.c-img { display: none; position: relative; }
.c-img picture, .c-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.c-img::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.1); }
.contact-form { display: flex; flex-direction: column; gap: 1.8rem; max-width: 480px; position: relative; }
.contact-form input, .contact-form textarea {
  background: transparent; border: none; border-bottom: 1px solid #222; padding: 1.2rem 0; color: #fff;
  font-family: inherit; outline: none; font-size: 0.95rem; transition: 0.4s; font-weight: 300; border-radius: 0;
}
.contact-form input:focus, .contact-form textarea:focus { border-bottom-color: #555; }
.contact-form [aria-invalid="true"] { border-bottom-color: #a55; }
.send {
  background: #fff; color: #000; border: none; padding: 1.3rem; text-transform: uppercase; letter-spacing: 3px;
  font-weight: 500; cursor: pointer; transition: 0.4s; margin-top: 1.5rem; font-size: 0.8rem;
}
.send:hover { background: #bbb; }
.send:disabled { opacity: 0.6; cursor: wait; }
.field-error { margin-top: -1rem; color: #c77; font-size: 0.75rem; letter-spacing: 1px; line-height: 1.5; }
/* Out of flow, in the column's bottom padding: the centred form stays exactly where it is today. */
.form-note { position: absolute; top: 100%; left: 0; right: 0; margin-top: 1rem; color: #666; font-size: 0.7rem; letter-spacing: 1px; line-height: 1.6; font-weight: 300; }
.form-note a { color: var(--accent); }
.form-status, .form-sent { color: #ccc; font-size: 0.9rem; line-height: 1.7; font-weight: 300; border-left: 1px solid #333; padding-left: 1rem; }
/* No-JS success (FR-15): the confirmation replaces the form via :target, same look as the JS state. */
.form-sent { display: none; max-width: 480px; }
.form-sent:target { display: block; }
.form-sent:target + .contact-form { display: none; }
.form-status.is-error { border-left-color: #a55; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
[hidden] { display: none !important; }

/* ---------- Text pages (privacy, děkujeme, 404) ---------- */
.legal-page { max-width: 800px; margin: 0 auto; padding: 8rem 5% 5rem; }
.legal-page h1 { font-size: 2rem; font-weight: 100; text-transform: uppercase; letter-spacing: 10px; text-align: center; margin-bottom: 4rem; }
.legal-page h2 { font-size: 0.8rem; font-weight: 400; text-transform: uppercase; letter-spacing: 3px; margin: 3rem 0 1rem; }
.legal-page p, .legal-page li { color: #ccc; line-height: 1.8; margin-bottom: 1rem; font-size: 0.95rem; }
.legal-page ul { padding-left: 1.2rem; }
.legal-page a { color: #fff; }
.legal-page .lead { text-align: center; }
.legal-page .back-link { margin-top: 2rem; }
.legal-page .center { text-align: center; }

/* ---------- Other pages, desktop (today's 900 px switch) ---------- */
@media (min-width: 901px) {
  body { --h-height: 90px; }
  .header-logo img,
  .page-projekty .header-logo img, .page-spoluprace .header-logo img, .page-kontakt .header-logo img { height: 20px; }
  .site-nav ul, .js .site-nav ul { gap: 3rem; }
  .site-nav a, .js .site-nav a,
  .page-projekt .site-nav a, .page-legal .site-nav a { font-size: 0.75rem; letter-spacing: 3px; }
  .portfolio-top { padding: 12rem 5% 4rem; }
  .portfolio-top h1 { font-size: 3rem; letter-spacing: 15px; }
  .section-top { padding: 8rem 5% 3rem; }
  /* Explicit column counts at today's auto-fill(420px) thresholds, capped so the tiles leave no empty cells:
     portfolio 2/3/4, Spolupráce 2/3, Studie 2/4 (spec BR-19). */
  .page-projekty .grid, .page-spoluprace .grid {
    grid-template-columns: repeat(2, 1fr); grid-auto-rows: 320px; gap: 15px; padding: 15px;
  }
  .item.large { grid-row: span 2; }
  .item.wide { grid-column: span 2; }
  .title-sec h1 { font-size: 3rem; }
  .info-grid { grid-template-columns: 1fr 2fr; gap: 4rem; }
  .close-btn { top: 30px; right: 40px; font-size: 50px; }
  .nav-btn { font-size: 40px; padding: 20px; }
  .contact-wrap { grid-template-columns: 1fr 1fr; }
  .c-info { padding: 8% 12%; }
  .c-info h1 { font-size: 3.5rem; margin-bottom: 3rem; letter-spacing: 8px; }
  .c-img { display: block; }
  .contact-form { gap: 2.5rem; }
  .legal-page { padding: 12rem 5% 5rem; }
  .legal-page h1 { font-size: 3rem; letter-spacing: 15px; }
}
@media (min-width: 1335px) {
  .page-projekty .portfolio-grid, .page-spoluprace .portfolio-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1770px) {
  .page-projekty .portfolio-grid, .page-projekty .studie .grid { grid-template-columns: repeat(4, 1fr); }
}
/* A tall (large, not wide) portfolio tile fills the grid only in the 3-column layout. */
@media (min-width: 901px) and (max-width: 1334px), (min-width: 1770px) {
  .page-projekty .portfolio-grid .item.large:not(.wide) { grid-row: span 1; }
}

@media (prefers-reduced-motion: reduce) {
  .js .card, .js .item, .js .anim-up { opacity: 1; transform: none; }
  .card, .item, .anim-up, .hero-bg { transition: none; }
}
