/*
 * Hietalan tila 1544 — design system.
 *
 * Hand-written rather than generated: production is a shared Apache box with no
 * Node toolchain, and a deploy here is a file copy. A build step would buy
 * nothing this does not already do.
 *
 * Everything scales with clamp() against the viewport, so there is one layout
 * that works from 320px to ultrawide instead of a set of breakpoint jumps.
 */

:root {
  /* Warm, earthy palette — a farm, not a tech product. */
  --bone:        #f7f4ee;
  --bone-deep:   #efe9df;
  --ink:         #23201c;
  --ink-soft:    #5b544b;
  --ink-faint:   #8a8177;
  --line:        #ddd5c8;
  --brand:       #6b3f2a;   /* dark leather brown */
  --brand-warm:  #8c5a3c;
  --accent:      #7d8b5a;   /* pasture green */
  --white:       #fff;

  --ok-bg:       #e8f0dd;  --ok-ink:   #3f5225;
  --warn-bg:     #fdf3d4;  --warn-ink: #6b5310;
  --gone-bg:     #f8e0dd;  --gone-ink: #7d2f22;

  --shadow-sm: 0 1px 2px rgb(35 32 28 / 6%), 0 2px 8px rgb(35 32 28 / 5%);
  --shadow-md: 0 2px 6px rgb(35 32 28 / 8%), 0 12px 32px rgb(35 32 28 / 8%);

  --radius:    14px;
  --radius-sm: 9px;

  /* One rhythm for the whole page. */
  --gutter:  clamp(1rem, 4vw, 2.5rem);
  --measure: 72ch;
  --shell:   1180px;

  --font: "Maven Pro", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bone);
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(1rem, .96rem + .2vw, 1.075rem);
  line-height: 1.65;
  /* Nothing may ever cause a sideways scroll. The old site did, on every page. */
  overflow-x: hidden;
}

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

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-warm); }

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }
h3 { font-size: clamp(1.15rem, 1.05rem + .5vw, 1.4rem); }
p  { margin: 0 0 1.1em; }

.shell {
  width: min(100% - (var(--gutter) * 2), var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: absolute; left: -9999px;
  background: var(--ink); color: var(--white);
  padding: .7rem 1.1rem; border-radius: 0 0 var(--radius-sm) 0; z-index: 100;
}
.skip-link:focus { left: 0; top: 0; }

/* --- header + navigation ------------------------------------------------ */

.masthead {
  position: sticky; top: 0; z-index: 50;
  background: rgb(247 244 238 / 92%);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.masthead__bar {
  display: flex; align-items: center; gap: 1rem;
  min-height: 68px;
}

.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); }
.brand img { width: 46px; height: 46px; object-fit: contain; }
.brand__name { font-weight: 700; font-size: 1.02rem; line-height: 1.15; }
.brand__tag  { display: block; font-weight: 400; font-size: .78rem; color: var(--ink-faint); }

.nav-toggle {
  margin-left: auto; display: inline-flex; align-items: center; gap: .5rem;
  background: none; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .55rem .8rem; font: inherit; font-size: .9rem; color: var(--ink); cursor: pointer;
}
.nav-toggle:hover { background: var(--bone-deep); }

.nav { margin-left: auto; }
.nav ul { display: flex; flex-wrap: wrap; gap: .15rem; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: block; padding: .55rem .8rem; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink-soft); font-size: .95rem; font-weight: 500;
}
.nav a:hover { background: var(--bone-deep); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand); color: var(--white); }

/* Below 860px the list collapses behind the toggle. No JS needed to lay it out;
   JS only flips aria-expanded, so it degrades to an always-open menu. */
@media (max-width: 860px) {
  .nav {
    position: absolute; inset: 68px 0 auto; margin: 0;
    background: var(--bone); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    display: none; padding: .5rem var(--gutter) 1rem;
  }
  .nav[data-open="true"] { display: block; }
  .nav ul { flex-direction: column; gap: .1rem; }
  .nav a { padding: .8rem .9rem; font-size: 1.05rem; }
}
@media (min-width: 861px) { .nav-toggle { display: none; } }

/* --- hero --------------------------------------------------------------- */

.hero {
  position: relative;
  display: grid; place-items: center;
  text-align: center;
  min-height: clamp(260px, 42vh, 460px);
  padding: clamp(2.5rem, 6vw, 5rem) 0;
  color: var(--white);
  background: var(--brand);
  overflow: hidden;
}
.hero__media {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transform: scale(1.02);
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgb(35 32 28 / 30%), rgb(35 32 28 / 62%));
}
.hero > .shell { position: relative; z-index: 1; }
.hero h1 { color: var(--white); text-shadow: 0 2px 18px rgb(0 0 0 / 35%); margin-bottom: .3em; }
.hero__tagline { font-size: clamp(1rem, .95rem + .5vw, 1.35rem); opacity: .95; margin-bottom: 1.6em; }

.button {
  display: inline-block; padding: .85rem 1.7rem;
  background: var(--white); color: var(--brand);
  border: 0; border-radius: 999px;
  font: inherit; font-weight: 700; text-decoration: none;
  box-shadow: var(--shadow-md); cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.button:hover { transform: translateY(-2px); color: var(--brand-warm); }
.button--solid { background: var(--brand); color: var(--white); }
.button--solid:hover { background: var(--brand-warm); color: var(--white); }
.button--ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); box-shadow: none; }

/* --- content ------------------------------------------------------------ */

main { display: block; padding-block: clamp(2rem, 5vw, 4rem); }

.block { margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.block > :where(p, ul, ol, h3, blockquote) { max-width: var(--measure); }
.block img { border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.block iframe { max-width: 100%; border-radius: var(--radius); }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow-sm);
}

/* --- price list --------------------------------------------------------- */

.hinnasto__meta {
  display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; align-items: baseline;
  margin-bottom: 1.5rem; color: var(--ink-soft); font-size: .95rem;
}
.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--bone-deep); border-radius: 999px;
  padding: .3rem .8rem; font-size: .85rem; font-weight: 600; color: var(--ink-soft);
}

.category { margin-bottom: 2.2rem; }
.category__name {
  font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: .5rem; margin-bottom: .25rem;
  border-bottom: 2px solid var(--line);
}

.product {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: .2rem 1rem;
  padding: .95rem .25rem;
  border-bottom: 1px solid var(--line);
}
.product:last-child { border-bottom: 0; }
.product__name  { font-weight: 600; }
.product__price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.product__status { grid-column: 1 / -1; font-size: .82rem; }

.tag {
  display: inline-block; padding: .18rem .55rem; border-radius: 999px; font-weight: 600;
}
.tag--ask  { background: var(--bone-deep); color: var(--ink-soft); }
.tag--over { background: var(--ok-bg);   color: var(--ok-ink); }
.tag--low  { background: var(--warn-bg); color: var(--warn-ink); }
.tag--gone { background: var(--gone-bg); color: var(--gone-ink); }

.notice {
  border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.5rem;
  border: 1px solid var(--line); background: var(--white);
}
.notice--warn  { background: var(--warn-bg); border-color: #e6cf7a; color: var(--warn-ink); }
.notice--error { background: var(--gone-bg); border-color: #e8b3aa; color: var(--gone-ink); }

/* --- forms -------------------------------------------------------------- */

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .95rem; }
.input, .textarea, .select {
  width: 100%; padding: .7rem .85rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--white); color: var(--ink); font: inherit;
}
.input:focus, .textarea:focus { border-color: var(--accent); }
.textarea { min-height: 150px; resize: vertical; }
.hint { color: var(--ink-faint); font-size: .85rem; }

/* --- footer ------------------------------------------------------------- */

.footer {
  margin-top: clamp(3rem, 8vw, 6rem);
  background: var(--ink); color: #cfc7bb;
  padding-block: clamp(2rem, 5vw, 3.5rem);
}
.footer a { color: #fff; text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer__grid {
  display: grid; gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}
.footer h3 { color: var(--white); font-size: 1rem; letter-spacing: .04em; text-transform: uppercase; }
.social { display: flex; gap: .5rem; flex-wrap: wrap; }
.social a {
  display: inline-grid; place-items: center; width: 42px; height: 42px;
  border: 1px solid #4a443c; border-radius: 50%;
}
.social a:hover { background: #4a443c; }
.footer__legal {
  margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid #3a352f;
  font-size: .85rem; color: #9c948a;
  display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --- classes carried over from the legacy content ------------------------
   Block bodies were authored against the old stylesheet and still use these
   class names. Rather than rewrite every page's HTML, they are mapped onto the
   new design system here. */

.call-to-action {
  display: inline-block; margin-top: .5rem; padding: .85rem 1.7rem;
  background: var(--white); color: var(--brand);
  border-radius: 999px; font-weight: 700; text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: transform .15s ease;
}
.call-to-action:hover { transform: translateY(-2px); color: var(--brand-warm); }

.hero .subtitle {
  font-size: clamp(1rem, .95rem + .5vw, 1.35rem);
  opacity: .95; margin-bottom: 1.2em;
}

/* Anchors used as scroll targets sat flush under the sticky header. */
.anchor { display: block; position: relative; top: -80px; visibility: hidden; }
:target { scroll-margin-top: 88px; }

.block small { color: var(--ink-faint); }

/* --- icons -------------------------------------------------------------- */

.icon { display: inline-block; vertical-align: -.18em; flex: none; }

.footer__contact { display: grid; gap: .5rem; margin: 0; }
.footer__contact a { display: inline-flex; align-items: center; gap: .55rem; }

.social a { color: #fff; }
.social a:hover { background: var(--brand-warm); border-color: var(--brand-warm); }

/* --- embeds ------------------------------------------------------------- */

/* Facebook's page plugin renders at a fixed pixel width. Without a wrapper it
   overflowed narrow screens, which is one of the ways the old page scrolled
   sideways. */
.fb-embed {
  max-width: 500px;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--white);
}
.fb-embed iframe { display: block; width: 100%; border: 0; }

.oiva-badge {
  display: inline-block; margin-top: .3rem;
  background: var(--bone-deep); border: 1px solid var(--line); border-radius: 999px;
  padding: .35rem .9rem; font-size: .88rem; font-weight: 600; color: var(--ink-soft);
}
a:hover .oiva-badge { background: var(--brand); color: var(--white); border-color: var(--brand); }

/* --- readable line length ------------------------------------------------
   This was previously scoped to `.block > p`, i.e. DIRECT children only. Almost
   all the legacy content is nested inside divs, so nothing matched and body copy
   ran the full width of the page — badly aligned and hard to read. It now
   applies at any depth, and opts out inside the card grids where the container
   already sets the width. */

.block :where(p, ul, ol, blockquote, h3) { max-width: var(--measure); }

/* Layout containers are not body copy: the measure must not clamp a card grid.
   .animal-grid and .events are <ul>s, so they matched the rule above and the
   gallery collapsed to three narrow columns. */
.block :where(.animal-grid, .events, .presentation-category-elements) { max-width: none; }
.block :where(.animal-card, .event, .presentation-element, .card) :where(p, ul, ol, h3, h4) { max-width: none; }

/* Legacy content wraps plain text lines in Bootstrap rows. Bootstrap is gone,
   so they are just divs; this keeps them on a readable measure too. */
.block :where(.row, [class^="col-"], [class*=" col-"]) { max-width: var(--measure); }

/* --- animal profiles -----------------------------------------------------
   Fifteen animals, each a full-width photo stacked in one column: the page ran
   to 18 000 px. The legacy class names are kept and laid out as a card grid. */

.presentation-category { margin-bottom: 2.5rem; }

.presentation-category-title {
  font-size: 1.05rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: .5rem; margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--line);
}

.presentation-category-elements {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
}

.presentation-element {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.presentation-element:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.presentation-element-title {
  order: 2;
  font-weight: 700; font-size: 1.05rem;
  padding: .85rem 1rem .2rem;
}

.presentation-element-image { order: 1; }
.presentation-element-image img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 0; box-shadow: none; display: block;
}

.presentation-element-info {
  order: 3;
  padding: 0 1rem 1rem; font-size: .88rem; color: var(--ink-soft);
}

/* Font Awesome is gone; the star it drew is drawn here instead. */
.legacy-icon { display: inline-block; margin-right: .35rem; }
.legacy-icon--star::before { content: "★"; color: var(--accent); }

/* --- map ---------------------------------------------------------------- */

.map-embed {
  margin: 1.5rem 0; border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); background: var(--bone-deep);
  max-width: 100%;
}
.map-embed iframe { display: block; width: 100%; height: clamp(280px, 45vw, 420px); border: 0; }

/* --- odds and ends from the legacy stylesheet --------------------------- */

.block .subtitle { font-size: 1.1rem; color: var(--ink-soft); margin-bottom: 1rem; }
.block .obs { background: var(--warn-bg); border-radius: var(--radius-sm); padding: .8rem 1rem; }
.block .inventory-price { font-weight: 700; }

/* The "no photo yet" placeholder is white line-art on a transparent ground, so
   on a white card it showed as nothing at all and the card looked broken. Given
   a dark ground it reads as a deliberate placeholder. */
.presentation-element-image img[src$="template.png"] {
  object-fit: contain;
  background: var(--brand);
  padding: 14%;
}

/* --- events ------------------------------------------------------------- */

.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }

.event {
  display: grid; grid-template-columns: auto 1fr; gap: 1.1rem; align-items: start;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow-sm);
}

.event__date {
  display: grid; place-items: center; align-content: center;
  min-width: 62px; padding: .5rem .6rem;
  background: var(--brand); color: var(--white); border-radius: var(--radius-sm);
}
.event__day   { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.event__month { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }

.event__title { margin: 0 0 .2rem; font-size: 1.15rem; }
.event__meta  { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.event__desc  { margin: .5rem 0 0; color: var(--ink-soft); font-size: .93rem; }

/* --- animal gallery ----------------------------------------------------- */

.animal-group { margin-bottom: 2.75rem; }
.animal-group__title {
  font-size: 1.05rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: .5rem; margin-bottom: 1.25rem; border-bottom: 2px solid var(--line);
}

.animal-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1.1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 215px), 1fr));
}

.animal-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.animal-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.animal-card__media {
  display: block; width: 100%; padding: 0; border: 0; background: none;
  cursor: zoom-in; position: relative; overflow: hidden;
}
.animal-card__media img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  border-radius: 0; box-shadow: none;
  transition: transform .35s ease;
}
.animal-card__media:hover img { transform: scale(1.05); }

/* "No photo yet" is the farm's own logo — white line art, invisible on white,
   so it gets the brand ground and reads as deliberate rather than broken. */
.animal-card__media--empty { cursor: default; background: var(--brand); }
.animal-card__media--empty img { object-fit: contain; padding: 16%; aspect-ratio: 4 / 3; }

.animal-card__body { padding: .9rem 1rem 1.1rem; }
.animal-card__name  { margin: 0 0 .15rem; font-size: 1.08rem; }
.animal-card__breed { margin: 0 0 .3rem; color: var(--ink-soft); font-size: .9rem; }
.animal-card__born  { margin: 0; color: var(--ink-faint); font-size: .84rem; }
.animal-card__notes { margin: .5rem 0 0; font-size: .88rem; color: var(--ink-soft); }

/* --- lightbox ----------------------------------------------------------- */

.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .5rem;
  padding: clamp(.5rem, 3vw, 2rem);
  background: rgb(20 18 16 / 92%);
  backdrop-filter: blur(4px);
}
.lightbox[hidden] { display: none; }

.lightbox__figure { margin: 0; display: grid; justify-items: center; gap: .9rem; min-width: 0; }
.lightbox__img {
  max-width: 100%; max-height: 78vh; width: auto; height: auto;
  border-radius: var(--radius); box-shadow: 0 20px 60px rgb(0 0 0 / 45%);
}
.lightbox__caption { color: #f2ede5; font-size: .95rem; text-align: center; }

.lightbox__nav, .lightbox__close {
  background: rgb(255 255 255 / 12%); color: #fff;
  border: 0; border-radius: 50%; cursor: pointer;
  width: 48px; height: 48px; font-size: 1.8rem; line-height: 1;
  display: grid; place-items: center;
}
.lightbox__nav:hover, .lightbox__close:hover { background: rgb(255 255 255 / 25%); }
.lightbox__close { position: absolute; top: 1rem; right: 1rem; font-size: 1.6rem; }

@media (max-width: 640px) {
  .lightbox { grid-template-columns: 1fr; }
  .lightbox__nav { position: absolute; bottom: 1.25rem; }
  .lightbox__nav--prev { left: 25%; }
  .lightbox__nav--next { right: 25%; }
}
