/* Design tokens shared by every site in sites/ (see README). Each build puts this in front of its own style.css. */
:root {
  --sign-blue: #1E4B8F; --ink: #16202B; --ink-2: #4A5763; --ink-3: #5E6B76;
  --page: #F5F5F2; --card: #FFFFFF; --line: #DDE0DB; --divider: #E6E8E3; --pill-border: #C9CEC8;
  --sky: #D6E2E2; --sky-top: #C7D7DA; --ridge-far: #2E6E73; --ridge-near: #1C4A50;
}
/* Ruteåkle: shared styles. The bygstad.com look (Barlow, the tokens, the small BYGSTAD sign, the footer),
   with the cloth's own colours for everything that is woven. Each game adds its own <id>.css. */
:root {
  --linen: #EFE8D8; --linen-2: #E4DAC3; --warp: #CFC2A2;
  --w-kvit: #E9DFC8; --w-gul: #D0A239; --w-raud: #A8362B; --w-blaa: #2D4A7D; --w-svart: #2A231F; --w-fiolett: #7A3F5E;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(22, 32, 43, .06), 0 6px 18px rgba(22, 32, 43, .06);
}
* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.5 Barlow, system-ui, sans-serif }
a { color: inherit }
img, canvas { display: block; max-width: 100% }
:is(a, button, input, select, [tabindex]):focus-visible { outline: 3px solid var(--sign-blue); outline-offset: 2px }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }

/* The BYGSTAD sign (links home to bygstad.com) */
.sign { display: inline-block; background: var(--sign-blue); border-radius: 6px; padding: 3px; box-shadow: 0 3px 8px rgba(18, 52, 59, .25); text-decoration: none; flex: none }
.sign-inner { display: block; border: 2px solid #fff; border-radius: 4px; padding: 4px 12px 3px }
.sign-text { display: block; font: 700 22px/.95 'Barlow Condensed', sans-serif; letter-spacing: .02em; color: #fff; text-transform: uppercase }
.sign--small { padding: 2px; border-radius: 5px }
.sign--small .sign-inner { padding: 3px 8px 2px; border-width: 1.5px; border-radius: 3px }
.sign--small .sign-text { font-size: 15px }

/* The kjerringtann band under the header */
.teeth { height: 18px; background: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2012%209%22%20width%3D%2212%22%20height%3D%229%22%20shape-rendering%3D%22crispEdges%22%3E%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%2212%22%20height%3D%221%22%20fill%3D%22%232a231f%22%2F%3E%3Crect%20x%3D%220%22%20y%3D%221%22%20width%3D%2212%22%20height%3D%221%22%20fill%3D%22%23e9dfc8%22%2F%3E%3Crect%20x%3D%220%22%20y%3D%222%22%20width%3D%225%22%20height%3D%221%22%20fill%3D%22%23e9dfc8%22%2F%3E%3Crect%20x%3D%225%22%20y%3D%222%22%20width%3D%221%22%20height%3D%221%22%20fill%3D%22%23a8362b%22%2F%3E%3Crect%20x%3D%226%22%20y%3D%222%22%20width%3D%226%22%20height%3D%221%22%20fill%3D%22%23e9dfc8%22%2F%3E%3Crect%20x%3D%220%22%20y%3D%223%22%20width%3D%224%22%20height%3D%221%22%20fill%3D%22%23e9dfc8%22%2F%3E%3Crect%20x%3D%224%22%20y%3D%223%22%20width%3D%223%22%20height%3D%221%22%20fill%3D%22%23a8362b%22%2F%3E%3Crect%20x%3D%227%22%20y%3D%223%22%20width%3D%225%22%20height%3D%221%22%20fill%3D%22%23e9dfc8%22%2F%3E%3Crect%20x%3D%220%22%20y%3D%224%22%20width%3D%223%22%20height%3D%221%22%20fill%3D%22%23e9dfc8%22%2F%3E%3Crect%20x%3D%223%22%20y%3D%224%22%20width%3D%225%22%20height%3D%221%22%20fill%3D%22%23a8362b%22%2F%3E%3Crect%20x%3D%228%22%20y%3D%224%22%20width%3D%224%22%20height%3D%221%22%20fill%3D%22%23e9dfc8%22%2F%3E%3Crect%20x%3D%220%22%20y%3D%225%22%20width%3D%222%22%20height%3D%221%22%20fill%3D%22%23e9dfc8%22%2F%3E%3Crect%20x%3D%222%22%20y%3D%225%22%20width%3D%227%22%20height%3D%221%22%20fill%3D%22%23a8362b%22%2F%3E%3Crect%20x%3D%229%22%20y%3D%225%22%20width%3D%223%22%20height%3D%221%22%20fill%3D%22%23e9dfc8%22%2F%3E%3Crect%20x%3D%220%22%20y%3D%226%22%20width%3D%2212%22%20height%3D%221%22%20fill%3D%22%23a8362b%22%2F%3E%3Crect%20x%3D%220%22%20y%3D%227%22%20width%3D%2212%22%20height%3D%221%22%20fill%3D%22%23e9dfc8%22%2F%3E%3Crect%20x%3D%220%22%20y%3D%228%22%20width%3D%2212%22%20height%3D%221%22%20fill%3D%22%232a231f%22%2F%3E%3C%2Fsvg%3E") repeat-x left center / auto 18px; image-rendering: pixelated; opacity: .95 }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--pill-border); background: var(--card); color: var(--ink); font: 600 16px Barlow, sans-serif; cursor: pointer; text-decoration: none; touch-action: manipulation; user-select: none; -webkit-user-select: none }
.btn:hover { border-color: var(--ink-3) }
.btn.primary { background: var(--sign-blue); border-color: var(--sign-blue); color: #fff }
.btn.primary:hover { background: #173d76 }
.btn.red { background: var(--w-raud); border-color: var(--w-raud); color: #fff }
.btn:disabled { opacity: .45; cursor: default }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center }

/* Game pages: a compact bar instead of the big header */
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--page) }
.crumbs { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex: 1; font-size: 15px; color: var(--ink-2) }
.crumbs a { text-decoration: none; white-space: nowrap }
.crumbs a:hover { color: var(--sign-blue); text-decoration: underline }
.crumbs h1 { margin: 0; font: 600 20px/1.1 Barlow, sans-serif; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.bar-tools { display: flex; gap: 6px; flex: none }
.tool { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--pill-border); background: var(--card); font: 600 14px Barlow, sans-serif; color: var(--ink-2); cursor: pointer }
.tool:hover { color: var(--ink); border-color: var(--ink-3) }
.tool--sound[aria-pressed="true"] { color: var(--ink-3); text-decoration: line-through }
@media (max-width: 520px) { .crumbs > a, .crumbs > span { display: none } .tool { padding: 0 10px } }

/* The game area: the cloth's backing */
.is-game { background: var(--linen) }
.is-game .bar { background: var(--page) }
.stage { max-width: 1100px; margin: 0 auto; padding: 16px 12px 8px }

/* Panels beside the board */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px }
.panel h2, .label { margin: 0 0 8px; font: 700 13px/1.2 'Barlow Condensed', sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3) }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 8px; margin: 0 }
.stats div { display: flex; flex-direction: column-reverse }
.stats dt { font: 700 12px 'Barlow Condensed', sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3) }
.stats dd { margin: 0; font: 700 24px/1.1 Barlow, sans-serif; font-variant-numeric: tabular-nums; color: var(--ink) }

/* "Visste du?": a fact, with the motif it is about */
.fact { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start }
.fact canvas { width: 56px; height: 56px; image-rendering: pixelated; border-radius: 4px }
.fact p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--ink) }
.fact strong { display: block; font-size: 16px }
.fact .src { display: block; margin-top: 4px; font-size: 12px; color: var(--ink-3) }

/* Dialogs: help, level done, game over */
dialog.sheet { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(22, 32, 43, .35); overflow: auto }
dialog.sheet::backdrop { background: rgba(42, 35, 31, .55); backdrop-filter: blur(2px) }
.sheet-body { padding: 22px 22px 20px }
.sheet h2 { margin: 0 0 6px; font: 700 26px/1.15 Barlow, sans-serif }
.sheet h3 { margin: 18px 0 6px; font: 700 13px 'Barlow Condensed', sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3) }
.sheet p, .sheet li { font-size: 16px; line-height: 1.5 }
.sheet ul { padding-left: 20px; margin: 6px 0 }
.sheet .btn-row { margin-top: 18px }
.sheet .close { float: right; margin: -6px -6px 0 8px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; font-size: 26px; line-height: 1; color: var(--ink-3); cursor: pointer }
.sheet .close:hover { background: var(--page); color: var(--ink) }
.kbd { display: inline-block; min-width: 1.6em; padding: 0 5px; border: 1px solid var(--pill-border); border-bottom-width: 2px; border-radius: 5px; font: 600 13px/1.5 Barlow, sans-serif; text-align: center; background: var(--page) }
.sheet .big-score, .big-score { font: 700 44px/1 Barlow, sans-serif; font-variant-numeric: tabular-nums; margin: 8px 0 2px }
.muted { color: var(--ink-3) }

/* A toast that floats over the board for a moment (bonus, level) */
.toast { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); padding: 8px 16px; border-radius: 999px; background: var(--w-svart); color: #fff; font: 700 18px Barlow, sans-serif; white-space: nowrap; pointer-events: none; animation: toast 1.4s ease-out forwards; z-index: 5 }
.toast.gul { background: var(--w-gul); color: var(--w-svart) }
.toast.raud { background: var(--w-raud) }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.9) } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1) } 75% { opacity: 1 } 100% { opacity: 0; transform: translate(-50%, -90%) } }
@media (prefers-reduced-motion: reduce) { .toast { animation-duration: 2s; animation-name: toast-still } @keyframes toast-still { 0%, 80% { opacity: 1 } 100% { opacity: 0 } } }

/* Footer */
.foot { padding: 32px 16px calc(28px + env(safe-area-inset-bottom)); text-align: center; font-size: 14px; line-height: 1.5; color: #2C3A44 }
.foot a { text-decoration: underline; text-decoration-color: var(--pill-border); text-underline-offset: 3px }
.foot a:hover { color: var(--sign-blue); text-decoration-color: currentColor }
.notfound { padding: 80px 16px; text-align: center }

/* ── The landing page ─────────────────────────────────────────────────────────────────────────── */
.hero { position: relative; padding: 28px 16px 0; text-align: center }
.hero h1 { margin: 14px 0 0; font: 600 40px/1.05 Barlow, sans-serif; letter-spacing: -.01em }
.hero .tagline { margin: 6px auto 0; max-width: 560px; font-size: 19px; color: #2C3A44 }
.cloth-wrap { position: relative; margin: 26px auto 0; max-width: 760px }
.cloth { display: block; margin: 0 auto; max-width: 100%; height: auto; image-rendering: pixelated; border-radius: 3px; box-shadow: 0 2px 3px rgba(42, 35, 31, .18), 0 18px 40px rgba(42, 35, 31, .18); cursor: crosshair; touch-action: manipulation }
.cloth-note { min-height: 3em; margin: 10px auto 0; max-width: 560px; font-size: 15px; color: var(--ink-2) }
.cloth-note b { color: var(--ink) }
.cloth-pick { display: flex; justify-content: center; gap: 6px; margin-top: 12px; flex-wrap: wrap }
.cloth-pick button { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--pill-border); background: var(--card); font: 600 14px Barlow, sans-serif; cursor: pointer }
.cloth-pick button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink) }

.games { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px }
.game-card a { display: grid; grid-template-columns: 96px 1fr; grid-template-rows: auto 1fr; gap: 2px 14px; height: 100%; padding: 12px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); text-decoration: none; transition: transform .15s, box-shadow .15s }
.game-card a:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(22, 32, 43, .08), 0 12px 28px rgba(22, 32, 43, .12) }
.game-thumb { grid-row: span 2; width: 96px; height: 96px; border-radius: 8px; background: var(--linen); image-rendering: pixelated }
.game-name { align-self: end; font: 700 19px/1.2 Barlow, sans-serif }
.game-line { font-size: 15px; line-height: 1.4; color: var(--ink-2) }

.section { padding: 48px 0 0 }
.section > h2 { margin: 0 0 6px; font: 700 28px/1.15 Barlow, sans-serif }
.section > .lead { margin: 0 0 18px; max-width: 680px; font-size: 18px; color: #2C3A44 }
.prose { max-width: 680px }
.prose p { margin: 0 0 14px; font-size: 17px; line-height: 1.6 }
.prose a, .credits a, .sources a { text-decoration: underline; text-decoration-color: var(--pill-border); text-underline-offset: 3px }
.prose a:hover, .credits a:hover, .sources a:hover { color: var(--sign-blue); text-decoration-color: currentColor }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start }
@media (max-width: 760px) { .two { grid-template-columns: 1fr } .hero h1 { font-size: 34px } }

.motifs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px }
.motif { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 12px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow) }
.motif canvas { width: 72px; height: 72px; image-rendering: pixelated; border-radius: 4px }
.motif h3 { margin: 0; font: 700 17px/1.2 Barlow, sans-serif }
.motif p { margin: 2px 0 0; font-size: 14px; line-height: 1.4; color: var(--ink-2) }

.swatches { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px }
.swatch { overflow: hidden; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow) }
.swatch canvas { width: 100%; height: 56px; image-rendering: pixelated }
.swatch div { padding: 8px 12px 10px }
.swatch b { display: block; font-size: 16px }
.swatch span { font-size: 14px; line-height: 1.35; color: var(--ink-2) }

.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0 }
.photos figure { margin: 0 }
.photos img { width: 100%; height: auto; border-radius: 6px; box-shadow: var(--shadow); background: var(--linen-2) }
.photos figcaption { margin-top: 6px; font-size: 14px; line-height: 1.4; color: var(--ink-2) }
@media (max-width: 560px) { .photos { grid-template-columns: 1fr } }

.loom { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 6px 0 0; padding: 0; list-style: none; counter-reset: step }
.loom li { padding: 14px 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); counter-increment: step; font-size: 15px; line-height: 1.45 }
.loom li::before { content: counter(step); display: inline-grid; place-items: center; width: 26px; height: 26px; margin-bottom: 6px; border-radius: 50%; background: var(--w-raud); color: #fff; font: 700 14px Barlow, sans-serif }
.loom b { display: block; font-size: 16px }

.callout { padding: 18px 20px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); border-left: 5px solid var(--w-raud) }
.callout p { margin: 0 0 8px; font-size: 16px }
.callout p:last-child { margin: 0 }

.sources { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.5; color: var(--ink-2) }
.sources li { margin: 0 0 6px }
.credits { font-size: 13px; color: var(--ink-3) }
