/* =========================================================
   Ribarnica Savinja — Postcard & stamp art direction
   Forest green / bone / brass. Hand-crafted, not templated.
   ========================================================= */

:root {
  --forest: #1f4d3b;
  --forest-dark: #112e22;
  --forest-light: #356c53;
  --bone: #f3ecd8;
  --paper: #faf6ea;
  --brass: #b8872e;
  --brass-dark: #8a641e;
  --ink: #20281f;
  --line: rgba(32, 40, 31, 0.18);
  --shadow: rgba(17, 46, 34, 0.22);
  --radius: 2px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Courier New", Courier, monospace;
  --maxw: 1200px;
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--forest-dark);
  line-height: 1.12;
  margin: 0 0 0.5em;
  font-weight: 600;
}
p { margin: 0 0 1em; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
section { position: relative; }
.section-pad { padding: 72px 0; }
.visually-hidden {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px; overflow: hidden;
}

/* ---------- grain overlay ---------- */
.grain-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9000;
  opacity: 0.05;
  mix-blend-mode: multiply;
}

/* ---------- icon sprite ---------- */
.icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---------- perforated / stamp edges ---------- */
.stamp-edge { position: relative; }
.stamp-edge--top::before,
.stamp-edge--bottom::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 16px;
  background-image: radial-gradient(circle at 8px 8px, var(--paper) 6px, transparent 6.5px);
  background-size: 16px 16px;
  background-repeat: repeat-x;
  z-index: 2;
}
.stamp-edge--top::before { top: -8px; }
.stamp-edge--bottom::after { bottom: -8px; }

/* ---------- airmail stripe ---------- */
.airmail {
  height: 10px;
  background: repeating-linear-gradient(
    -45deg,
    var(--forest) 0 14px,
    var(--bone) 14px 20px,
    var(--brass) 20px 34px,
    var(--bone) 34px 40px
  );
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 500;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark { width: 46px; height: 46px; flex-shrink: 0; }
.brand-word {
  width: 173px;
  height: 28px;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.main-nav a {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--forest-dark);
  position: relative;
  padding: 4px 0;
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.main-nav a:hover::after,
.main-nav a:focus-visible::after,
.main-nav a[aria-current="page"]::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 14px; }
.cart-link {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--serif);
  color: var(--forest-dark);
}
.cart-count {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 22px; height: 22px;
  background: var(--brass);
  color: var(--paper);
  border-radius: 50%;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0 4px;
  transition: transform 0.25s ease;
}
.cart-count.bump { transform: scale(1.35); }

.menu-toggle {
  display: none;
  background: none; border: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  color: var(--forest-dark);
  cursor: pointer;
}

@media (max-width: 860px) {
  .main-nav {
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    width: min(320px, 82vw);
    background: var(--forest-dark);
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 22px;
    padding: 32px;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.35s ease, visibility 0.35s ease;
    z-index: 600;
  }
  .main-nav.open { transform: translateX(0); visibility: visible; }
  .main-nav a { color: var(--bone); font-size: 1.15rem; }
  .menu-toggle { display: flex; }
  .nav-backdrop {
    position: fixed; inset: 0;
    background: rgba(17, 46, 34, 0.5);
    z-index: 590;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
  }
  .nav-backdrop.open { opacity: 1; pointer-events: auto; }
}

/* ---------- buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: 1rem;
  padding: 13px 28px;
  border: 1.5px solid var(--forest);
  background: transparent;
  color: var(--forest-dark);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  min-height: 44px;
  transition: color 0.35s ease;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  left: -100%;
  width: 100%;
  background: var(--forest);
  z-index: -1;
  transition: left 0.35s ease;
}
.btn:hover::before, .btn:focus-visible::before { left: 0; }
.btn:hover, .btn:focus-visible { color: var(--bone); }
.btn-primary { background: var(--forest); color: var(--bone); }
.btn-primary::before { background: var(--brass-dark); }
.btn-primary:hover, .btn-primary:focus-visible { color: var(--bone); }
.btn-ghost { border-color: var(--bone); color: var(--bone); }
.btn-ghost::before { background: var(--bone); }
.btn-ghost:hover, .btn-ghost:focus-visible { color: var(--forest-dark); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-small { padding: 8px 16px; font-size: 0.9rem; min-height: 36px; }

a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brass-dark);
  outline-offset: 2px;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: 64px 0 56px;
  overflow: hidden;
  background: var(--forest-dark);
  color: var(--bone);
}
.hero .container {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}
.hero-eyebrow {
  font-family: var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hero h1 {
  color: var(--paper);
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  margin: 0.3em 0 0.5em;
}
.hero p.lede { color: var(--bone); max-width: 32em; font-size: 1.1rem; opacity: 0.92; }
.underline-draw { position: relative; white-space: nowrap; }
.underline-draw svg {
  position: absolute;
  left: 0; bottom: -0.1em;
  width: 100%; height: 0.4em;
  overflow: visible;
}
.underline-draw path {
  stroke: var(--brass);
  stroke-width: 5;
  fill: none;
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: draw-underline 1.1s 0.5s ease forwards;
}
@keyframes draw-underline { to { stroke-dashoffset: 0; } }
.hero-actions { display: flex; gap: 16px; margin-top: 28px; flex-wrap: wrap; }

.hero-art { position: relative; aspect-ratio: 1/1; }
.hero-art svg { width: 100%; height: 100%; }
.hero-stamp {
  position: absolute;
  top: -10px; right: -10px;
  width: 92px; height: 92px;
  animation: stamp-pulse 6s ease-in-out infinite;
}
@keyframes stamp-pulse { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(2deg); } }

/* continuous subtle element: drifting airmail line */
.drift-line {
  position: absolute;
  bottom: 18px; left: 0;
  width: 160%;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--brass) 0 10px, transparent 10px 20px);
  opacity: 0.35;
  animation: drift 14s linear infinite;
}
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-30%); } }

/* ---------- reveal ---------- */
.reveal {
  opacity: 1;
  transform: none;
}
.reveal.js-hidden {
  opacity: 0;
  transform: translateY(26px);
  clip-path: inset(0 0 12% 0);
  transition: opacity 0.7s ease, transform 0.7s ease, clip-path 0.7s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: none;
  clip-path: inset(0 0 0 0);
}

/* ---------- section headings ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin: 0; }
.section-tag {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.78rem;
  color: var(--brass-dark);
}

/* ---------- masonry gallery (home composition) ---------- */
.masonry {
  columns: 3 260px;
  column-gap: 20px;
}
.masonry-item {
  position: relative;
  margin: 0 0 20px;
  break-inside: avoid;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 24px -14px var(--shadow);
  cursor: default;
}
.masonry-item img {
  width: 100%;
  display: block;
  transition: transform 0.6s ease, filter 0.6s ease;
  filter: sepia(0.12) saturate(1.05);
}
.masonry-item:hover img { transform: scale(1.08); }
.masonry-cap {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px 16px 14px;
  background: linear-gradient(to top, rgba(17,46,34,0.92), transparent);
  color: var(--bone);
  transform: translateY(100%);
  transition: transform 0.4s ease;
  font-family: var(--serif);
  font-size: 0.95rem;
}
.masonry-item:hover .masonry-cap,
.masonry-item:focus-within .masonry-cap { transform: translateY(0); }
@media (max-width: 720px) { .masonry { columns: 2 180px; } }
@media (max-width: 480px) { .masonry { columns: 1 100%; } }

/* ---------- product grid / strip ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 26px;
}
.product-card {
  position: relative;
  background: var(--bone);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.product-card:hover { transform: translateY(-6px); box-shadow: 0 18px 30px -16px var(--shadow); }
.product-card .thumb { aspect-ratio: 4/3; overflow: hidden; position: relative; }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.product-card:hover .thumb img { transform: scale(1.1); }
.product-tag {
  position: absolute; top: 10px; left: 10px;
  background: var(--forest-dark);
  color: var(--bone);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--radius);
}
.product-body { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-body h3 { font-size: 1.15rem; margin: 0; }
.product-body .desc { font-size: 0.9rem; opacity: 0.85; margin: 0; }
.product-price { font-family: var(--mono); color: var(--brass-dark); font-weight: 700; font-size: 1.05rem; }
.product-body .btn { margin-top: auto; }

@media (max-width: 640px) {
  .product-scroll {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 16px;
    padding-bottom: 8px;
    margin: 0 -24px;
    padding-left: 24px;
    padding-right: 24px;
  }
  .product-scroll .product-card { min-width: 76vw; scroll-snap-align: start; }
}

/* ---------- postmark badge ---------- */
.postmark { width: 100%; height: 100%; }
.postmark text { font-family: var(--mono); }

/* ---------- handwritten note ---------- */
.note-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--serif);
  font-style: italic;
  background: var(--paper);
  border: 1px dashed var(--brass-dark);
  color: var(--forest-dark);
  padding: 6px 12px;
  transform: rotate(-2deg);
  font-size: 0.9rem;
}

/* ---------- calculator (signature feature) ---------- */
.calculator {
  background: var(--forest);
  color: var(--bone);
  border-radius: var(--radius);
  padding: 44px;
  position: relative;
  overflow: hidden;
}
.calculator .deco-stamp { position: absolute; top: 18px; right: 18px; width: 70px; height: 70px; opacity: 0.9; }
.calculator h2, .calculator h3 { color: var(--paper); }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.calc-field { margin-bottom: 18px; }
.calc-field label { display: block; margin-bottom: 6px; font-family: var(--serif); }
.calc-field input, .calc-field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(243,236,216,0.5);
  background: rgba(250,246,234,0.08);
  color: var(--paper);
  border-radius: var(--radius);
  font-size: 1rem;
  accent-color: var(--brass);
}
.calc-field input::placeholder { color: rgba(243,236,216,0.55); }
.calc-result {
  background: rgba(250,246,234,0.1);
  border: 1px solid rgba(243,236,216,0.3);
  border-radius: var(--radius);
  padding: 20px 22px;
  min-height: 160px;
}
.calc-result ul { margin: 10px 0 0; padding-left: 20px; }
.calc-result .total { font-family: var(--mono); color: var(--brass); font-size: 1.3rem; font-weight: 700; }
@media (max-width: 760px) { .calc-grid { grid-template-columns: 1fr; } .calculator { padding: 28px; } }

/* ---------- cards generic (about/values) ---------- */
.value-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
}
.value-card {
  padding: 26px;
  background: var(--bone);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.value-card .icon { color: var(--brass-dark); margin-bottom: 10px; width: 30px; height: 30px; }
@media (max-width: 760px) { .value-row { grid-template-columns: 1fr; } }

/* ---------- text/photo split ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
.split-media { position: relative; }
.split-media img { border-radius: var(--radius); width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.split-media .frame-deco {
  position: absolute;
  inset: -14px;
  z-index: -1;
  width: calc(100% + 28px);
  height: calc(100% + 28px);
}
@media (max-width: 820px) { .split { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- divider ---------- */
.divider { width: 100%; height: 36px; display: block; color: var(--brass-dark); }

/* ---------- footer ---------- */
.site-footer {
  background: var(--forest-dark);
  color: var(--bone);
  padding: 56px 0 28px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 36px;
}
.footer-grid h4 { color: var(--paper); font-size: 1rem; margin-bottom: 14px; }
.site-footer a { color: var(--bone); opacity: 0.85; }
.site-footer a:hover { opacity: 1; text-decoration: underline; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 0.92rem; }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer-brand .brand-mark { width: 38px; height: 38px; }
.footer-brand .brand-word { width: 136px; height: 22px; }
.newsletter-form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.newsletter-form input[type="email"] {
  flex: 1;
  min-width: 160px;
  padding: 10px 12px;
  border: 1px solid rgba(243,236,216,0.4);
  background: rgba(250,246,234,0.06);
  color: var(--paper);
  border-radius: var(--radius);
}
.footer-bottom {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(243,236,216,0.2);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  opacity: 0.8;
}
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- forms ---------- */
.form-card {
  background: var(--bone);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
}
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; font-family: var(--serif); }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: var(--sans);
  accent-color: var(--forest);
}
.field textarea { min-height: 120px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.form-msg { margin-top: 14px; font-size: 0.92rem; }
.form-msg.ok { color: var(--forest); }
.form-msg.err { color: #9a3b2a; }
.required-note { font-size: 0.82rem; opacity: 0.7; margin-bottom: 18px; }

/* ---------- cookie banner ---------- */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--forest-dark);
  color: var(--bone);
  padding: 18px 24px;
  z-index: 8000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  border-top: 2px solid var(--brass);
  transform: translateY(100%);
  transition: transform 0.4s ease;
}
.cookie-banner.show { transform: translateY(0); }
.cookie-banner p { margin: 0; max-width: 56ch; font-size: 0.92rem; }
.cookie-banner a { text-decoration: underline; color: var(--brass); }
.cookie-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- cart / checkout page ---------- */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td { text-align: left; padding: 14px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cart-row-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius); }
.qty-control { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); }
.qty-control button { width: 34px; height: 34px; border: none; background: none; cursor: pointer; font-size: 1.1rem; color: var(--forest-dark); }
.qty-control input { width: 40px; text-align: center; border: none; background: none; font-size: 1rem; padding: 0; }
.cart-remove { color: #9a3b2a; background: none; border: none; cursor: pointer; font-size: 0.85rem; text-decoration: underline; padding: 8px; }
.cart-empty { padding: 60px 0; text-align: center; }
.cart-summary { background: var(--bone); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.cart-summary .total-line { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 1.2rem; font-weight: 700; margin: 14px 0; }
.checkout-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 36px; align-items: start; }
@media (max-width: 860px) { .checkout-layout { grid-template-columns: 1fr; } .cart-table { font-size: 0.9rem; } }

.payment-note {
  background: var(--paper);
  border: 1px dashed var(--brass-dark);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.9rem;
  margin-top: 16px;
}

/* ---------- FAQ accordion ---------- */
.faq-item {
  border-bottom: 1px solid var(--line);
}
.faq-item summary {
  cursor: pointer;
  padding: 18px 0;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--forest-dark);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .icon { transition: transform 0.3s ease; flex-shrink: 0; }
.faq-item[open] summary .icon { transform: rotate(180deg); }
.faq-item p { padding-bottom: 18px; opacity: 0.88; }

/* ---------- legal pages ---------- */
.legal-content h2 { margin-top: 1.6em; font-size: 1.4rem; }
.legal-content { max-width: 74ch; }
.legal-content ul { padding-left: 22px; }
.updated-note { font-family: var(--mono); font-size: 0.82rem; color: var(--brass-dark); }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 100px 0; }
.notfound .postmark { width: 160px; height: 160px; margin: 0 auto 24px; }

/* ---------- breadcrumb / page intro ---------- */
.page-intro {
  padding: 48px 0 8px;
  background: var(--bone);
}
.page-intro h1 { font-size: clamp(2rem, 5vw, 3rem); }

/* ---------- misc ---------- */
.tiny { font-size: 0.82rem; opacity: 0.75; }
.center { text-align: center; }
.mt-lg { margin-top: 48px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .underline-draw path { stroke-dashoffset: 0; }
}
