/* ------------------------------------------------------------
   Goriška Brda Directory
   Type pair: serif display (Iowan Old Style / Palatino stack)
   for headings, humanist sans (Seravek / Gill Sans / Trebuchet)
   for body copy. Accent: burnt-ochre, evoking the Brda hillsides.
   ------------------------------------------------------------ */

:root {
  --bg: #faf5ec;
  --bg-raised: #ffffff;
  --ink: #2a2420;
  --ink-soft: #5c5247;
  --line: #e4d9c6;
  --accent: #b5602c;
  --accent-ink: #ffffff;
  --accent-soft: #f1ddc9;

  --font-display: "Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, Palatino, "Book Antiqua", serif;
  --font-body: "Seravek", "Gill Sans Nova", "Gill Sans MT", Corbel, "Trebuchet MS", sans-serif;

  --radius: 14px;
  --maxw: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}

a { color: inherit; }

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

/* ---------- Header ---------- */

.site-header {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-mark { flex-shrink: 0; }

.logo-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  line-height: 1.15;
  display: flex;
  flex-direction: column;
}

.logo-sub {
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.header-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- Intro ---------- */

.intro {
  padding: 56px 24px 32px;
  max-width: 760px;
}

.intro h1 {
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.intro-lede {
  margin: 20px 0 0;
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 620px;
}

/* ---------- Filters ---------- */

.filters {
  padding: 8px 24px 28px;
}

.filter-tiles {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}

.tile {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  min-height: 92px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--tile-img);
  background-size: cover;
  background-position: center;
  opacity: 0.4;
  z-index: -2;
  transition: opacity 0.2s ease;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(42,36,32,0) 20%, rgba(42,36,32,0.72) 100%);
  z-index: -1;
}

.tile-all::before,
.tile-all::after { display: none; }

.tile-all {
  background: var(--accent-soft);
}

.tile-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

.tile::before, .tile::after { }

.tile:not(.tile-all) .tile-label { color: #fff; }
.tile:not(.tile-all) .tile-count { color: #fff; opacity: 0.85; }

.tile-count {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 2px;
}

.tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(42,36,32,0.4); }
.tile:hover::before { opacity: 0.55; }

.tile.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft) inset;
}

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 10px 16px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip:hover { border-color: var(--accent); color: var(--ink); }

.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.country-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.country-select select {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--ink);
}

.result-count {
  margin: 18px 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* ---------- Grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 8px 24px 64px;
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.35s ease, opacity 0.35s ease, box-shadow 0.25s ease;
}

.card.is-hidden {
  display: none;
}

.card.is-entering {
  animation: cardIn 0.4s ease both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -20px rgba(42,36,32,0.35);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-tag {
  color: var(--accent);
  font-weight: 700;
}

.card-country {
  color: var(--ink-soft);
  font-weight: 500;
}

.card-country::before {
  content: "·";
  margin-right: 10px;
  color: var(--line);
}

.card-brand {
  font-size: 1.3rem;
  line-height: 1.25;
}

.card-desc {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  flex-grow: 1;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.card-link {
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  position: relative;
}

.card-link::after {
  content: "→";
  margin-left: 6px;
  transition: transform 0.15s ease;
}

.card-link:hover::after { transform: translateX(3px); }

.card-link-secondary {
  color: var(--ink-soft);
  font-weight: 500;
}

.card-link-secondary::after { content: ""; }

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 48px 24px 72px;
  font-size: 1rem;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 24px;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* ---------- Scroll reveal ---------- */

.card {
  opacity: 0;
  transform: translateY(14px);
}

.card.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.25s ease;
}

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
  .filter-tiles { grid-template-columns: repeat(3, 1fr); }
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
  .filters { padding: 8px 18px 24px; }
  .grid { grid-template-columns: 1fr; padding: 8px 18px 56px; }
  .filter-tiles { grid-template-columns: repeat(2, 1fr); }
  .intro { padding: 40px 18px 24px; }
  .header-note { display: none; }
  .filter-bar { flex-direction: column; align-items: flex-start; }
  .country-select { width: 100%; justify-content: space-between; }
  .country-select select { flex: 1; }
}

@media (max-width: 420px) {
  .filter-tiles { grid-template-columns: repeat(2, 1fr); }
  .tile { min-height: 80px; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card,
  .tile,
  .chip,
  .card-link::after {
    transition: none !important;
    animation: none !important;
  }
  .card { opacity: 1; transform: none; }
}
