@font-face { font-family: 'Bowlby One SC'; src: url('assets/fonts/BowlbyOneSC-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Permanent Marker'; src: url('assets/fonts/PermanentMarker-Regular.ttf') format('truetype'); font-display: swap; }

:root {
  --paper: #f3ede1;
  --paper-2: #ebe2d0;
  --ink: #1f2421;
  --muted: #5d5a50;
  --line: #d6cbb5;
  --red: #9b2f26;       /* punamulta */
  --red-ink: #7e241d;
  --moss: #3d5a3e;
  --shirt: #2b2c2e;
  --head: 'Bowlby One SC', Impact, sans-serif;
  --hand: 'Permanent Marker', 'Comic Sans MS', cursive;
  --body: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --pad: clamp(18px, 4vw, 56px);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 18px/1.55 var(--body); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, .village-name, .card-name { font-family: var(--head); font-weight: 400; letter-spacing: .01em; line-height: .95; margin: 0; }
h3 { margin: 0 0 6px; font-size: 18px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 10px 14px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.fine { font-size: 14px; color: var(--muted); }
.hand { font-family: var(--hand); color: var(--red); font-size: 22px; margin: 0 0 6px; transform: rotate(-2deg); display: inline-block; }

.preview-bar { background: var(--ink); color: #f3ede1; font-size: 14px; text-align: center; padding: 7px 12px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px var(--pad); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(243,237,225,.96); z-index: 20; }
.wordmark { font-family: var(--head); font-size: 26px; text-decoration: none; letter-spacing: .01em; }
.wordmark span { color: var(--red); }
nav { display: flex; align-items: center; gap: 22px; }
nav a { text-decoration: none; font-weight: 600; }
nav a:hover { color: var(--red); }
.cart-button { font: 600 16px var(--body); background: var(--ink); color: #fff; border: 0; padding: 11px 16px; min-height: 44px; cursor: pointer; display: inline-flex; gap: 10px; align-items: center; }
.cart-button:hover { background: var(--red); }
.count { background: var(--paper); color: var(--ink); min-width: 24px; padding: 0 6px; text-align: center; font-size: 14px; }

.primary, .ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 24px; font: 700 17px var(--body); text-decoration: none; cursor: pointer; border: 2px solid var(--ink); }
.primary { background: var(--red); border-color: var(--red); color: #fff; }
.primary:hover { background: var(--red-ink); border-color: var(--red-ink); }
.primary:disabled { background: #b9ae9a; border-color: #b9ae9a; cursor: not-allowed; }
.ghost { background: transparent; color: var(--ink); }
.ghost:hover { background: var(--ink); color: #fff; }

/* HERO: copy left, big back photo, smaller front photo overlapping */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr) minmax(0, .62fr); gap: clamp(14px, 2vw, 28px); align-items: end; padding: clamp(28px, 5vw, 64px) var(--pad) clamp(40px, 6vw, 80px); }
.hero-copy { align-self: center; }
.hero h1 { font-size: clamp(54px, 7.4vw, 118px); margin: 4px 0 22px; }
.lead { font-size: clamp(19px, 1.5vw, 22px); max-width: 30ch; margin: 0 0 26px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.hero figure { margin: 0; position: relative; }
.hero figure img { width: 100%; object-fit: cover; }
.hero-main img { aspect-ratio: 1005 / 1100; }
.hero-side { margin-bottom: 9%; }
.hero-side img { aspect-ratio: 1005 / 1100; }
figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }

.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px 40px; margin-bottom: 26px; }
.section-head h2 { font-size: clamp(38px, 4.6vw, 68px); }
.section-head p { max-width: 46ch; margin: 0; color: var(--muted); }

/* VILLAGES */
.villages { padding: clamp(40px, 6vw, 80px) var(--pad); background: var(--paper-2); border-block: 1px solid var(--line); }
.village-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 2vw, 26px); }
.village-card { all: unset; box-sizing: border-box; cursor: pointer; display: grid; background: var(--paper); border: 2px solid transparent; transition: border-color .15s, transform .15s; }
.village-card:hover { transform: translateY(-3px); border-color: var(--ink); }
.village-card[aria-pressed="true"] { border-color: var(--red); }
.village-card:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.village-card { position: relative; }
.village-card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 30%; }
.card-stamp { position: absolute; top: 10px; left: 10px; font-family: var(--hand); background: var(--paper); color: var(--ink); padding: 2px 8px; font-size: 14px; transform: rotate(-3deg); }
.card-body { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 16px 18px 18px; }
.card-name { font-size: clamp(26px, 2.4vw, 36px); }
.card-muni { grid-column: 1; color: var(--muted); font-size: 15px; }
.card-body .chip { grid-column: 2; grid-row: 1 / span 2; }

.chip { display: inline-block; font-size: 13px; font-weight: 700; padding: 5px 10px; border: 1.5px solid currentColor; margin: 0; letter-spacing: .02em; }
.chip.ok { color: var(--moss); }
.chip.draft { color: var(--red); background: rgba(155,47,38,.06); }

/* PRODUCT */
.product { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: clamp(24px, 4vw, 64px); padding: clamp(40px, 6vw, 80px) var(--pad); align-items: start; }
.stage { position: relative; background: var(--shirt); }
.stage img { width: 100%; aspect-ratio: 1005 / 1100; object-fit: cover; }
.stamp { position: absolute; top: 14px; left: 14px; font-family: var(--hand); background: var(--paper); color: var(--ink); padding: 4px 10px; font-size: 16px; transform: rotate(-3deg); }
.views { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 10px 0 8px; }
.views button { all: unset; box-sizing: border-box; cursor: pointer; border: 2px solid transparent; background: var(--paper-2); }
.views button img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 30%; }
.views button span { display: block; font-size: 13px; font-weight: 600; padding: 5px 6px 6px; text-align: center; }
.views button[aria-pressed="true"] { border-color: var(--red); }
.views button:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.buy { position: sticky; top: 92px; }
.village-name { font-size: clamp(48px, 5.4vw, 84px); margin: 14px 0 4px; }
.municipality { margin: 0 0 6px; color: var(--muted); font-size: 18px; }
.price { font-weight: 700; font-size: 20px; margin: 0 0 18px; }
.print-spec { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 0 22px; border-block: 1px solid var(--line); }
.print-spec div { padding: 12px 0; }
.print-spec div + div { border-left: 1px solid var(--line); padding-left: 16px; }
.print-spec dt { font-size: 13px; color: var(--muted); }
.print-spec dd { margin: 2px 0 0; font-weight: 700; }
#spec-back { font-family: var(--head); font-weight: 400; font-size: 20px; }
#spec-front { font-family: var(--hand); font-weight: 400; font-size: 18px; }

form label, legend { display: block; font-weight: 700; font-size: 15px; margin: 14px 0 6px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { margin-top: 0; }
select, input[type="number"] { width: 100%; font: 17px var(--body); min-height: 48px; padding: 0 12px; border: 1.5px solid var(--ink); background: #fffdf8; color: var(--ink); border-radius: 0; }
.row-label { display: flex; justify-content: space-between; align-items: baseline; }
.row-label a { font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-option { margin: 0; font-weight: 400; }
.chip-option input { position: absolute; opacity: 0; pointer-events: none; }
.chip-option span { display: inline-flex; align-items: center; min-height: 46px; padding: 0 16px; border: 1.5px solid var(--ink); font-family: var(--hand); font-size: 18px; cursor: pointer; background: #fffdf8; }
.chip-option input:checked + span { background: var(--ink); color: #fff; }
.chip-option input:focus-visible + span { outline: 3px solid var(--red); outline-offset: 2px; }
.add-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: end; margin-top: 4px; }
.add-row .primary { min-height: 50px; }
.status { color: var(--moss); font-weight: 600; min-height: 1.4em; margin: 10px 0 0; }
.error { color: var(--red); font-weight: 600; min-height: 1.4em; margin: 6px 0 0; }
.story { margin-top: 24px; padding: 18px 20px; background: var(--paper-2); border-top: 3px solid var(--ink); }
.story p { margin: 0 0 8px; }
.story a { font-size: 14px; }
.base-shirt { margin-top: 16px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.base-shirt summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }

/* SAME CUT */
.same-cut { padding: clamp(40px, 6vw, 80px) var(--pad); background: var(--ink); color: var(--paper); }
.same-cut .section-head p { color: #cfc6b4; }
.cut-pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 2vw, 26px); max-width: 1100px; }
.cut-pair figure { margin: 0; }
.cut-pair img { width: 100%; aspect-ratio: 1005 / 1100; object-fit: cover; }
.cut-pair figcaption { color: #cfc6b4; font-family: var(--hand); font-size: 18px; }

/* SIZES */
.sizes { padding: clamp(40px, 6vw, 80px) var(--pad); }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); max-width: 760px; background: #fffdf8; }
table { border-collapse: collapse; width: 100%; min-width: 420px; }
caption { text-align: left; padding: 12px 14px; font-weight: 700; }
th, td { padding: 9px 14px; text-align: left; border-top: 1px solid var(--line); }
thead th { font-size: 14px; color: var(--muted); }

.pending { margin: 0 var(--pad) clamp(40px, 6vw, 80px); padding: 26px 28px; border: 2px dashed var(--red); }
.pending h2 { font-size: clamp(30px, 3vw, 44px); margin-bottom: 12px; }
.pending ul { margin: 0; padding-left: 20px; }

.site-footer { padding: 34px var(--pad) 46px; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.site-footer p { margin: 0; }
.site-footer .fine { max-width: 80ch; }

/* CART */
dialog { width: min(520px, 100vw); max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0 0 0 auto; border: 0; padding: 22px 24px 30px; background: var(--paper); color: var(--ink); overflow-y: auto; }
dialog::backdrop { background: rgba(20,22,20,.55); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h2 { font-size: 34px; }
.dialog-head button { font: 600 16px var(--body); background: none; border: 1.5px solid var(--ink); min-height: 44px; padding: 0 14px; cursor: pointer; }
.cart-line { display: grid; grid-template-columns: 72px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-line img { width: 72px; height: 79px; object-fit: cover; object-position: 50% 30%; }
.cart-line h3 { font-family: var(--head); font-weight: 400; font-size: 22px; }
.cart-line p { margin: 0; }
.line-controls { display: flex; align-items: end; gap: 12px; margin-top: 8px; }
.line-controls label { font-size: 14px; font-weight: 600; }
.line-controls input { width: 90px; min-height: 44px; }
.remove { font: 600 15px var(--body); background: none; border: 0; color: var(--red); text-decoration: underline; min-height: 44px; cursor: pointer; }
.cart-total { display: flex; justify-content: space-between; font-size: 18px; margin: 18px 0 4px; }
#review { width: 100%; margin-top: 12px; }
#checkout { margin-top: 24px; padding-top: 18px; border-top: 2px solid var(--ink); }
#checkout h3 { font-family: var(--head); font-weight: 400; font-size: 26px; }
#checkout dl div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 8px 0; }
#checkout dt, #checkout dd { margin: 0; }
#pay { width: 100%; min-height: 48px; font: 700 16px var(--body); background: #cfc5b2; border: 0; color: #4b473f; }
.empty { color: var(--muted); }
.noscript { padding: 12px var(--pad); background: #fff3cd; }

@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr 1fr; }
  .hero-copy { grid-column: 1 / -1; }
  .product { grid-template-columns: 1fr; }
  .buy { position: static; }
}
@media (max-width: 720px) {
  body { font-size: 17px; }
  nav a { display: none; }
  .hero { grid-template-columns: 1.4fr 1fr; }
  .village-grid { grid-template-columns: 1fr; }
  .village-card { grid-template-columns: 130px 1fr; }
  .village-card img { height: 100%; aspect-ratio: auto; }
  .views { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
  .views button span { font-size: 11px; padding: 4px 2px; }
  .cut-pair { grid-template-columns: 1fr 1fr; }
  .print-spec { grid-template-columns: 1fr; }
  .print-spec div + div { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); }
}
.views button[data-view="painatus"] img { object-fit: contain; background: var(--shirt); }
.stage img.is-print { object-fit: contain; }
.village-card, .card-body { min-width: 0; }
@media (max-width: 720px) {
  .card-body { grid-template-columns: minmax(0, 1fr); align-content: center; gap: 4px; padding: 12px 14px; }
  .card-body .chip { grid-column: 1; grid-row: auto; justify-self: start; }
  .card-name { font-size: 26px; overflow-wrap: anywhere; }
}
@media (max-width: 380px) {
  .site-header { padding-inline: 14px; gap: 8px; }
  .wordmark { font-size: 20px; }
  .cart-button { padding: 10px 10px; font-size: 15px; gap: 6px; }
}
/* chip always under the name: avoids overflow with long names (HALMENIEMI) at tablet widths */
.card-body { grid-template-columns: minmax(0, 1fr); gap: 4px; }
.card-body .chip { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 6px; }
.card-name { overflow-wrap: anywhere; }
