/* Verstaskartta: one stylesheet for phone, tablet (700px+) and desktop (1100px+). */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque.woff') format('woff');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F6F3FB;
  --card: #FFFFFF;
  --ink: #2A2438;
  --muted: #4E4560;
  --muted-2: #5E5670;
  --line: #EEE9F5;
  --accent: #C2412D;
  --link: #B23A27;
  --link-hover: #8C2C1D;
  --focus: #2B4F96;
  --map: #DCEAF7;
  --map-dot: #B9D2EC;
  --map-ink: #2D4A6A;
  --mint: #D2EFDD;
  --mint-ink: #23603D;
  --lavender: #E4DAF8;
  --lavender-ink: #523A86;
  --pink: #F8D6DE;
  --gutter: 16px;
  --radius-xl: 24px;
  --radius-l: 22px;
  --radius-m: 16px;
  --font: 'Bricolage Grotesque', 'Segoe UI', Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.015em; line-height: 1.1; }
p { margin: 0; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; z-index: 1000; }
.skip-link:focus { top: 8px; color: #fff; }

.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
main { flex: 1 0 auto; }

/* Header */
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.logo { display: flex; align-items: center; min-height: 44px; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: -0.01em; }
.logo:hover { color: var(--ink); }
.logo-tag { display: inline-flex; align-items: center; width: 28px; height: 22px; padding-left: 5px; border-radius: 4px 11px 11px 4px; background: var(--accent); }
.logo-tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--bg); }
.site-nav { display: flex; align-items: center; gap: 20px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; font-size: 15px; text-decoration: none; }
.site-nav .nav-plain { color: var(--ink); display: none; }
.site-nav .nav-plain:hover { color: var(--link); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; border-radius: var(--radius-m);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: transform .12s ease, background-color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #A93623; color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #3B3350; color: #fff; }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-outline:hover { background: var(--bg); color: var(--ink); }
.btn-block { display: flex; width: 100%; }
.text-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none; padding: 8px 0; }
.back-link { font-size: 15px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; padding-right: 8px; }

/* Blocks */
.block { border-radius: var(--radius-xl); padding: 24px 20px; }
.block-white { background: var(--card); }
.section { margin-top: 28px; }
.section-title { font-size: 22px; margin: 0 4px 12px; }
.lead { font-size: 17px; color: var(--muted); }

/* Hero (front page) */
.hero { margin-top: 4px; display: flex; flex-direction: column; gap: 14px; }
.hero h1 { font-size: 40px; line-height: 1.02; letter-spacing: -0.02em; }
.hero-icons { display: flex; gap: 8px; }
.icon-dot { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; }
.icon-dot svg { width: 22px; height: 22px; }
.search { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; width: 100%; max-width: 720px; }
.search label { font-weight: 700; font-size: 15px; }
.search-row { display: flex; gap: 8px; }
.search input {
  flex: 1 1 auto; min-width: 0; height: 52px; padding: 0 16px;
  border: 2px solid var(--ink); border-radius: var(--radius-m);
  font: inherit; background: #fff; color: var(--ink);
}
.search .btn { min-height: 52px; }
.search-message { font-size: 15px; color: var(--muted); min-height: 0; }
.locate-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0;
  background: none; border: 0; font: inherit; font-weight: 700; color: var(--link);
  cursor: pointer; align-self: flex-start;
}
.locate-btn:hover { color: var(--link-hover); }
.search-message a { font-weight: 700; }
.search-message:empty { display: none; }

/* Craft tiles */
.craft-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.craft-tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  min-height: 92px; padding: 14px 16px; border-radius: 18px;
  font-weight: 800; font-size: 19px; text-decoration: none;
}
.craft-tile svg { width: 24px; height: 24px; opacity: .85; }
.craft-tile small { display: block; font-weight: 600; font-size: 13px; opacity: .85; }

/* Cities + owner box */
.duo { display: grid; gap: 16px; }
.city-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 60px; padding: 12px 18px; border-radius: 18px;
  background: var(--bg); color: var(--ink); text-decoration: none;
}
.city-row:hover { color: var(--ink); }
.city-row + .city-row { margin-top: 8px; }
.city-row strong { font-size: 19px; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.pill-mint { background: var(--mint); color: var(--mint-ink); }
.pill-lavender { background: var(--lavender); color: var(--lavender-ink); font-weight: 600; }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.owner-box { background: var(--pink); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.owner-box p { color: var(--muted); }

/* Page header blocks (city, craft, space) */
.page-head { margin-top: 4px; display: flex; flex-direction: column; gap: 4px; }
.page-head h1 { font-size: 40px; line-height: 1.05; letter-spacing: -0.02em; }
.page-head p { font-size: 17px; }

/* Filter chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 2px solid var(--ink); background: #fff; color: var(--ink);
  font-weight: 700; font-size: 15px; text-decoration: none; transition: transform .12s ease;
}
.chip:hover { color: var(--ink); background: var(--bg); }
.chip:active { transform: scale(.97); }
.chip[aria-current='page'] { background: var(--ink); color: #fff; }

/* City layout: list + map */
.city-layout { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.sort-note { font-size: 14px; color: var(--muted-2); margin: 0 4px 10px; }
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

/* Map */
.map-box { border-radius: 20px; overflow: hidden; background-color: var(--map); background-image: radial-gradient(var(--map-dot) 1.6px, transparent 1.6px); background-size: 14px 14px; position: relative; }
.map { height: 220px; width: 100%; }
.map-note { font-size: 13px; color: var(--map-ink); padding: 8px 14px; background: rgba(255,255,255,.75); }
.leaflet-container { font-family: var(--font); background: var(--map); }
.vk-pin { display: block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(42,36,56,.35); }
.leaflet-popup-content { font-size: 15px; margin: 12px 16px; }
.leaflet-popup-content a { font-weight: 700; }

/* Space card */
.card {
  display: flex; flex-direction: column; gap: 12px; padding: 18px;
  border-radius: var(--radius-l); color: var(--ink); text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease;
  animation: vk-rise .4s ease-out backwards;
}
.card:hover { color: var(--ink); transform: translateY(-2px); box-shadow: 0 8px 18px rgba(42,36,56,.08); }
.card:active { transform: scale(.98); }
.card-title { font-size: 20px; line-height: 1.2; }
.card-place { display: flex; align-items: center; gap: 4px; font-size: 15px; color: var(--muted); margin-top: -4px; }
.card-place svg { flex: 0 0 auto; }
.card-gear { font-size: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.access-tag {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 13px 5px 9px;
  border-radius: 4px 14px 14px 4px; color: #fff; font-size: 14px; font-weight: 700;
  transform-origin: 7px 50%;
}
.access-tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #fff; flex: 0 0 auto; }
.card:hover .access-tag { animation: vk-swing .8s ease-in-out; }
.craft-pill { padding: 4px 12px; border-radius: 999px; background: #fff; font-size: 14px; font-weight: 700; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.6); margin-top: auto; }
.facts span { display: flex; flex-direction: column; }
.facts small { font-size: 13px; color: var(--muted-2); }
.facts b { font-size: 15px; font-variant-numeric: tabular-nums; }
.facts b.unknown { font-weight: 500; color: var(--muted); }
.featured-mark { font-size: 13px; font-weight: 700; color: var(--muted); }

.empty { padding: 20px; border-radius: var(--radius-l); background: #fff; display: flex; flex-direction: column; gap: 8px; }
.empty strong { font-size: 18px; }
.empty span { color: var(--muted-2); }

/* Access legend */
.legend { margin-top: 16px; padding: 4px 18px; border-radius: var(--radius-l); background: #fff; }
.legend summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
.legend dl { margin: 0 0 12px; display: grid; gap: 10px; }
.legend dl > div { display: flex; flex-direction: column; gap: 4px; }
.legend dd { margin: 0; font-size: 15px; color: var(--muted); }
.prose .legend { padding: 4px 0; }
.prose .legend summary { display: none; }

/* Craft page groups */
.city-group + .city-group { margin-top: 28px; }
.city-group h2 { font-size: 24px; margin: 0 4px 12px; }
.city-group h2 a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; }
.city-group h2 a:hover { color: var(--link); }

/* Space page */
.space-layout { display: flex; flex-direction: column; gap: 16px; margin-top: 4px; }
.space-col { display: contents; }
.space-hero { order: 1; border-radius: var(--radius-xl); overflow: hidden; }
.space-actions { order: 2; display: flex; flex-direction: column; gap: 10px; }
.space-details { order: 3; }
.space-map { order: 4; }
.space-meta { order: 5; }
.space-hero-top { padding: 14px 18px 0; }
.photo-tile {
  height: 160px; margin: 8px 18px 0; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background-image: radial-gradient(rgba(255,255,255,.55) 1.6px, transparent 1.6px); background-size: 14px 14px;
  font-size: 14px; font-weight: 700;
}
.photo-tile svg { width: 56px; height: 56px; animation: vk-spin 1.1s cubic-bezier(.2,.8,.3,1) backwards; }
.photo-empty { display: none; }
.space-photo { margin: 8px 18px 0; border-radius: 18px; overflow: hidden; }
.space-photo img { width: 100%; height: 220px; object-fit: cover; }
.space-photo figcaption { font-size: 12px; padding: 6px 2px 0; opacity: .8; }
.space-hero-body { padding: 14px 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.space-hero h1 { font-size: 34px; line-height: 1.05; letter-spacing: -0.02em; }
.space-hero .operator { font-size: 15px; opacity: .85; }
.space-hero .access-tag { font-size: 15px; padding: 6px 15px 6px 10px; animation: vk-swing .9s ease-in-out .35s backwards; }
.actions-box { display: flex; flex-direction: column; gap: 10px; }
.actions-box h2 { display: none; }
.details { margin: 0; padding: 6px 18px; border-radius: var(--radius-l); background: #fff; }
.details > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.details > div:last-child { border-bottom: 0; }
.details dt { color: var(--muted-2); font-size: 15px; }
.details dd { margin: 0; font-size: 15px; }
.details ul { margin: 0; padding-left: 18px; }
.details dd .line { display: block; }
.details dd strong + .line { margin-top: 2px; }
.meta-box { padding: 18px 20px; border-radius: var(--radius-l); background: var(--lavender); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.meta-box ul { margin: 0; padding-left: 18px; word-break: break-word; }
.meta-box a { color: var(--link-hover); }

/* Prose pages */
.prose { max-width: 720px; display: flex; flex-direction: column; gap: 14px; }
.prose h1 { font-size: 36px; }
.prose h2 { font-size: 22px; margin-top: 10px; }
.prose ul { margin: 0; padding-left: 20px; }
.prose li + li { margin-top: 4px; }

/* Footer */
.site-footer { margin-top: 40px; }
.site-footer .wrap { padding-top: 20px; padding-bottom: 28px; color: var(--muted-2); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }

/* Footer links */
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; color: var(--ink); text-decoration: none; }
.footer-links a:hover { color: var(--link); text-decoration: underline; }

/* Motion */
@keyframes vk-pop { from { opacity: 0; transform: translateY(6px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes vk-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes vk-swing { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-5deg); } 65% { transform: rotate(3deg); } }
@keyframes vk-spin { from { transform: rotate(-120deg); } to { transform: rotate(0); } }
.hero-icons > span { animation: vk-pop .5s cubic-bezier(.2,.8,.3,1.25) backwards; }
.hero-icons > span:nth-child(2) { animation-delay: .08s; }
.hero-icons > span:nth-child(3) { animation-delay: .16s; }
.hero-icons > span:nth-child(4) { animation-delay: .24s; }
.lift { transition: transform .18s ease, box-shadow .18s ease; }
.lift:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(42,36,56,.08); }
.lift:active { transform: scale(.97); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card:hover, .lift:hover, .btn:active, .chip:active, .card:active, .lift:active { transform: none; }
}

/* Tablet */
@media (min-width: 700px) {
  :root { --gutter: 32px; }
  body { font-size: 17px; }
  .site-header .wrap { padding-top: 18px; padding-bottom: 18px; }
  .logo { font-size: 22px; }
  .site-nav .nav-plain { display: inline-flex; }
  .block { padding: 32px; border-radius: 28px; }
  .hero { padding: 40px; }
  .hero h1 { font-size: 56px; line-height: 1; }
  .icon-dot { width: 52px; height: 52px; }
  .icon-dot svg { width: 26px; height: 26px; }
  .craft-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .craft-tile { min-height: 110px; font-size: 20px; border-radius: 20px; }
  .section-title { font-size: 26px; }
  .duo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head h1 { font-size: 56px; line-height: 1; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .card { padding: 20px; border-radius: var(--radius-xl); }
  .map { height: 280px; }
  .space-hero-body h1 { font-size: 48px; }
  .space-hero { display: grid; grid-template-columns: minmax(0, 1fr) 200px; grid-template-areas: 'top top' 'body photo'; align-items: center; }
  .space-hero-top { grid-area: top; padding: 22px 32px 0; }
  .space-hero-body { grid-area: body; padding: 8px 32px 30px; }
  .photo-tile, .space-photo { grid-area: photo; margin: 0 32px 24px 0; height: 180px; }
  .photo-empty { display: flex; }
  .space-photo img { height: 180px; }
  .space-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .space-actions .btn-primary { grid-column: 1 / -1; }
  .actions-box { display: contents; }
  .details { padding: 8px 28px; }
  .details > div { grid-template-columns: 140px minmax(0, 1fr); gap: 16px; padding: 15px 0; }
  .details dt, .details dd { font-size: 17px; }
  .site-footer .wrap { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; font-size: 15px; }
}

/* Desktop */
@media (min-width: 1100px) {
  :root { --gutter: 40px; }
  .site-header .wrap { padding-top: 22px; padding-bottom: 22px; }
  .logo { font-size: 24px; }
  .site-nav { gap: 28px; }
  .site-nav a { font-size: 17px; }
  .hero { padding: 64px 48px 52px; align-items: center; text-align: center; border-radius: 32px; }
  .hero h1 { font-size: 72px; line-height: .98; letter-spacing: -0.03em; max-width: 900px; }
  .hero .lead { font-size: 20px; max-width: 620px; }
  .hero .search { text-align: left; }
  .hero-icons { justify-content: center; }
  .icon-dot { width: 56px; height: 56px; }
  .craft-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
  .craft-tile { min-height: 130px; font-size: 22px; border-radius: 24px; padding: 18px 20px; }
  .duo { grid-template-columns: 2fr 1fr; gap: 24px; }
  .page-head { flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 32px 40px; border-radius: 32px; }
  .page-head h1 { font-size: 72px; line-height: .98; letter-spacing: -0.03em; }
  .page-head .chips { margin: 0; }
  .city-layout.has-map { flex-direction: row; align-items: flex-start; gap: 24px; }
  .city-layout.has-map .city-list { flex: 1 1 auto; min-width: 0; }
  .city-layout.has-map .map-box { order: 2; flex: 0 0 400px; position: sticky; top: 24px; }
  .city-layout.has-map .map { height: 640px; }
  .city-layout:not(.has-map) .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .space-layout { flex-direction: row; align-items: flex-start; gap: 24px; }
  .space-col { display: flex; flex-direction: column; gap: 24px; }
  .space-col-main { flex: 1 1 auto; min-width: 0; }
  .space-col-side { flex: 0 0 400px; position: sticky; top: 24px; }
  .space-hero { border-radius: 32px; grid-template-columns: minmax(0, 1fr) 220px; }
  .space-hero-top { padding: 28px 40px 0; }
  .space-hero-body { padding: 8px 40px 36px; }
  .space-hero-body h1 { font-size: 64px; line-height: .98; letter-spacing: -0.03em; }
  .photo-tile, .space-photo { margin: 0 40px 32px 0; height: 220px; }
  .space-photo img { height: 220px; }
  .space-actions { display: flex; padding: 28px; border-radius: 28px; background: #fff; }
  .actions-box { display: flex; }
  .actions-box h2 { display: block; font-size: 22px; }
  .details { padding: 12px 36px; border-radius: 28px; }
  .details > div { grid-template-columns: 160px minmax(0, 1fr); gap: 20px; padding: 18px 0; }
  .space-map .map { height: 280px; }
}
