/* 3DBoden.no — "Boden"
   Lys, kjølig base. Bod-rød fra den tradisjonelle norske boden, fjord-blå til tekniske detaljer.
   Display: Big Shoulders Display (skilt-bokstaver). Brødtekst: Atkinson Hyperlegible Next.
   Ett dristig element: ordmerket i toppen, fylt med printlag. Resten er rolig og flatt. */

@font-face {
    font-family: 'Big Shoulders Display';
    src: url('fonts/big-shoulders-display-latin.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}
@font-face {
    font-family: 'Atkinson Hyperlegible Next';
    src: url('fonts/atkinson-hyperlegible-next-latin.woff2') format('woff2');
    font-weight: 200 800;
    font-display: swap;
}

:root {
    --snow: #F6F7F5;
    --concrete: #E3E6E2;
    --rule: #C9CEC8;
    --ink: #1B1F23;
    --ink-soft: #4A5158;
    --bod-red: #9E2B21;
    --bod-red-dark: #7E2019;
    --fjord: #2B5C78;
    --white: #FFFFFF;

    --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
    --body: 'Atkinson Hyperlegible Next', system-ui, sans-serif;

    --wrap: 1200px;
    --gutter: clamp(16px, 4vw, 40px);
    --radius: 4px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
    margin: 0;
    background: var(--snow);
    color: var(--ink);
    font-family: var(--body);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
    font-family: var(--display);
    font-weight: 800;
    line-height: 1;
    margin: 0;
    text-wrap: balance;
}
h2 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
h3 { font-size: 1.5rem; font-weight: 700; }
p { margin: 0 0 1em; }

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

:focus-visible {
    outline: 3px solid var(--fjord);
    outline-offset: 3px;
}

.wrap {
    max-width: calc(var(--wrap) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 16px; top: -100px;
    z-index: 3000;
    background: var(--ink);
    color: var(--snow);
    padding: 10px 16px;
}
.skip-link:focus { top: 16px; }

/* ---------- Knapper ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 22px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-family: var(--body);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--bod-red); color: var(--snow); }
.btn-primary:hover { background: var(--bod-red-dark); }
.btn-ghost { border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--snow); }
.btn-light { background: var(--snow); color: var(--bod-red); }
.btn-light:hover { background: var(--white); color: var(--bod-red-dark); }
.btn-small { min-height: 40px; padding: 8px 16px; font-size: .9375rem; }
.btn:hover { text-decoration: none; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Topp ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(246, 247, 245, .94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--rule);
}
.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 68px;
}
.brand img {
    height: 24px;
    width: auto;
}
.site-nav ul {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-nav a:not(.btn) {
    display: block;
    padding: 10px 14px;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}
.site-nav a:not(.btn):hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.site-nav li:last-child { margin-left: 10px; }

.menu-toggle {
    position: absolute;
    opacity: 0;
    width: 1px; height: 1px;
}
.menu-button {
    display: none;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 14px;
    border: 2px solid var(--ink);
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
}
.menu-toggle:focus-visible + .menu-button { outline: 3px solid var(--fjord); outline-offset: 3px; }
.menu-icon,
.menu-icon::before,
.menu-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--ink);
    position: relative;
}
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(32px, 5vw, 64px); padding-bottom: clamp(40px, 6vw, 72px); }

.hero-row {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(24px, 5vw, 64px);
    align-items: end;
}
.lead {
    font-family: var(--display);
    font-weight: 800;
    font-size: clamp(2.25rem, 4.6vw, 4rem);
    line-height: 1;
    max-width: 16ch;
    margin: 0 0 28px;
}
.hero-photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.hero-photos a { display: block; color: var(--ink-soft); text-decoration: none; font-size: .875rem; }
.hero-photos img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    background: var(--concrete);
    border-radius: var(--radius);
}
.hero-photos span { display: block; margin-top: 6px; }
.hero-photos a:hover span { color: var(--ink); text-decoration: underline; }

/* ---------- Kategorier ---------- */
.category-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.category-strip a {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 12px 12px 14px;
    background: var(--concrete);
    border-radius: var(--radius);
    color: var(--ink);
    text-decoration: none;
}
.category-strip img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 2px;
    margin-bottom: 12px;
}
.category-name {
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.75rem;
    line-height: 1;
}
.category-count { color: var(--ink-soft); font-size: .9375rem; margin-top: 4px; }
.category-strip a:hover { background: var(--rule); }
.category-strip a:hover .category-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

.category { padding-top: clamp(56px, 8vw, 96px); }
.section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px 40px;
    align-items: end;
    border-top: 3px solid var(--ink);
    padding-top: 18px;
    margin-bottom: 32px;
}
.section-head p { margin: 0; color: var(--ink-soft); max-width: 52ch; }

/* ---------- Produktfliser ---------- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 36px 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    color: var(--ink);
    text-decoration: none;
}
.tile-media {
    display: block;
    aspect-ratio: 1;
    margin-bottom: 10px;
    background: var(--concrete);
    border-radius: var(--radius);
    overflow: hidden;
}
.tile-media img { width: 100%; height: 100%; object-fit: cover; }
.tile-name { font-weight: 600; font-size: 1.0625rem; line-height: 1.3; }
.tile-price {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.1;
    color: var(--bod-red);
    font-variant-numeric: tabular-nums;
}
.tile-price-ask { color: var(--ink-soft); font-size: 1.25rem; }
.tile-text {
    color: var(--ink-soft);
    font-size: .9375rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tile:hover .tile-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }

/* ---------- Spesiallaget ---------- */
.custom {
    margin-top: clamp(72px, 10vw, 128px);
    background: var(--bod-red);
    color: var(--snow);
    padding-block: clamp(56px, 8vw, 96px);
}
.custom-inner {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(32px, 6vw, 80px);
}
.custom h2 { margin-bottom: 20px; }
.custom-intro p { font-size: 1.125rem; max-width: 40ch; margin-bottom: 28px; }
.steps {
    counter-reset: step;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 40px;
}
.steps li {
    counter-increment: step;
    border-top: 2px solid rgba(246, 247, 245, .5);
    padding-top: 14px;
}
.steps li::before {
    content: counter(step);
    display: block;
    font-family: var(--display);
    font-weight: 800;
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 8px;
}
.steps h3 { margin-bottom: 8px; }
.steps p { margin: 0; opacity: .92; }

/* ---------- Om boden ---------- */
.workshop {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(32px, 6vw, 80px);
    padding-top: clamp(72px, 10vw, 128px);
}
.workshop h2 { margin-bottom: 24px; }
.workshop-text p { max-width: 62ch; }
.materials {
    align-self: start;
    background: var(--concrete);
    border-radius: var(--radius);
    padding: 24px;
}
.materials h3 { margin-bottom: 16px; }
.materials ul { list-style: none; margin: 0; padding: 0; }
.materials li {
    display: grid;
    grid-template-columns: 36px 1fr;
    column-gap: 14px;
    padding: 12px 0;
    border-top: 1px solid var(--rule);
}
.materials li:first-child { border-top: 0; padding-top: 0; }
.materials strong { grid-column: 2; }
.materials li span:last-child { grid-column: 2; color: var(--ink-soft); font-size: .9375rem; }
/* Filamentspole sett ovenfra */
.swatch {
    grid-row: 1 / span 2;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--concrete) 0 7px, var(--spool) 7.5px);
    box-shadow: inset 0 0 0 1px rgba(27, 31, 35, .15);
}
.swatch-pla { --spool: #FFFFFF; }
.swatch-petg { --spool: #3E8E7E; }
.swatch-asa { --spool: #1B1F23; }
.swatch-tpu { --spool: #D9A21B; }

/* ---------- Kontakt ---------- */
.contact { padding-block: clamp(72px, 10vw, 128px); }
.contact h2 { margin-bottom: 16px; }
.contact-email {
    display: inline-block;
    margin: 8px 0 20px;
    font-family: var(--display);
    font-weight: 800;
    font-size: clamp(2.25rem, 7vw, 5rem);
    line-height: 1;
    color: var(--bod-red);
    text-decoration: none;
    overflow-wrap: anywhere;
}
.contact-email:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }

/* ---------- Bunn ---------- */
.site-footer {
    background: var(--concrete);
    padding-top: 48px;
    font-size: .9375rem;
}
.footer-inner {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 32px;
}
.footer-name { font-family: var(--display); font-weight: 800; font-size: 1.75rem; line-height: 1; margin-bottom: 8px; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 6px; }
.footer-links a { color: var(--ink); }
.footer-legal { color: var(--ink-soft); padding-block: 24px; margin: 40px 0 0; border-top: 1px solid var(--rule); }

/* ---------- Produktside ---------- */
.product-page { padding-top: 24px; }
.crumbs { font-size: .9375rem; color: var(--ink-soft); margin-bottom: 24px; }
.crumbs a { color: var(--ink-soft); }
.crumbs a:hover { color: var(--ink); }

.product {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(32px, 5vw, 64px);
    align-items: start;
}
.gallery-main {
    display: block;
    background: var(--concrete);
    border-radius: var(--radius);
    cursor: zoom-in;
}
.gallery-main img {
    width: 100%;
    max-height: 640px;
    object-fit: contain;
    border-radius: var(--radius);
}
.thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 12px;
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}
.thumbs a { display: block; cursor: zoom-in; color: var(--fjord); text-decoration: none; font-size: .875rem; font-weight: 600; }
.thumbs img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--concrete);
    border-radius: var(--radius);
}
.thumbs a:hover img { outline: 2px solid var(--ink); outline-offset: 2px; }
.thumb-dimension img { object-fit: contain; background: var(--white); box-shadow: inset 0 0 0 2px var(--fjord); outline: 2px solid var(--fjord); outline-offset: -2px; }
.thumbs span { display: block; margin-top: 4px; }

.product-info { position: sticky; top: 92px; }
.product-info h1 { font-size: clamp(2.5rem, 5vw, 3.75rem); margin-bottom: 12px; }
.product-price {
    font-family: var(--display);
    font-weight: 700;
    font-size: 2rem;
    line-height: 1.1;
    color: var(--bod-red);
    font-variant-numeric: tabular-nums;
    margin-bottom: 20px;
}
.prose { max-width: 62ch; }
.prose h3 { margin: 28px 0 10px; }
.prose ul, .prose ol { padding-left: 1.25em; margin: 0 0 1em; }
.prose li { margin-bottom: 4px; }
.prose ul.feature-list { list-style: none; padding: 0; }

.price-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 8px 0 24px !important;
    border-top: 2px solid var(--ink);
}
.price-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 12px 0;
    margin: 0;
    border-bottom: 1px solid var(--rule);
}
.price-list small { display: block; color: var(--ink-soft); font-size: .875rem; }
.price-list-amount {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--bod-red);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.order { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--rule); }
.order p { margin: 12px 0 0; color: var(--ink-soft); font-size: .9375rem; }

.related { padding-top: clamp(56px, 8vw, 96px); padding-bottom: 24px; }
.related h2 { border-top: 3px solid var(--ink); padding-top: 18px; margin-bottom: 32px; font-size: clamp(2rem, 4vw, 2.75rem); }

/* ---------- Lysboks (kun CSS, via :target) ---------- */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 56px 16px 16px;
}
.lightbox:target { display: flex; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(27, 31, 35, .92); }
.lightbox img {
    position: relative;
    max-width: min(92vw, 1400px);
    max-height: calc(100vh - 88px);
    width: auto;
    border-radius: var(--radius);
}
.lightbox-close {
    position: absolute;
    top: 12px;
    right: 16px;
    padding: 8px 14px;
    border: 2px solid var(--snow);
    border-radius: var(--radius);
    color: var(--snow);
    font-weight: 600;
    text-decoration: none;
}
.lightbox-close:hover { background: var(--snow); color: var(--ink); }

/* ---------- 3D-visning (GLB) ---------- */
.model-viewer { margin-top: 20px; padding: 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--white); }
.model-viewer h2 { margin: 0 0 12px; font-size: 1.25rem; }
.model-stage { position: relative; aspect-ratio: 4 / 3; background: var(--concrete); border-radius: var(--radius); overflow: hidden; touch-action: none; }
.model-stage img { display: block; width: 100%; height: 100%; object-fit: cover; }
.model-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.model-stage canvas:active { cursor: grabbing; }
.model-viewer.is-live .model-stage img { display: none; }
.model-label { position: absolute; transform: translate(-50%, -50%); padding: 1px 7px; border: 1px solid var(--bod-red); border-radius: var(--radius); background: rgba(255, 255, 255, .92); color: var(--bod-red-dark); font-size: .8125rem; font-weight: 700; white-space: nowrap; pointer-events: none; }
.model-label[hidden] { display: none; }
.model-dims { margin: 12px 0 0; font-weight: 600; }
.model-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 12px 0 0; }
.model-actions [hidden] { display: none; }
.model-box-toggle { font-size: .9375rem; color: var(--ink-soft); cursor: pointer; }
.model-status { margin: 8px 0 0; font-size: .9375rem; color: var(--ink-soft); }
.tile-media { position: relative; }
.tile-badge { position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: var(--radius); background: var(--ink); color: var(--snow); font-size: .8125rem; font-weight: 700; letter-spacing: .04em; }

/* ---------- Mindre skjermer ---------- */
@media (max-width: 960px) {
    .category-strip {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(180px, 42%);
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 8px;
    }
    .category-strip li { scroll-snap-align: start; }
    .custom-inner, .workshop, .product { grid-template-columns: minmax(0, 1fr); }
    .product-info { position: static; }
    .footer-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .footer-inner > div:first-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    .menu-button { display: inline-flex; }
    .site-header-inner { flex-wrap: wrap; }
    .site-nav { display: none; flex-basis: 100%; padding-bottom: 16px; }
    .menu-toggle:checked ~ .site-nav { display: block; }
    .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
    .site-nav a:not(.btn) { padding: 14px 0; border-top: 1px solid var(--rule); }
    .site-nav li:last-child { margin: 12px 0 0; }
    .site-nav .btn { width: 100%; }

    .hero-row, .section-head { grid-template-columns: minmax(0, 1fr); }
    .hero-photos { gap: 8px; }
    .hero-photos span { font-size: .8125rem; line-height: 1.3; }
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 14px; }
    .tile-price { font-size: 1.3125rem; }
    .steps { grid-template-columns: minmax(0, 1fr); }
    .actions .btn { flex: 1 1 auto; }
}

@media (max-width: 420px) {
    .footer-inner { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .btn { transition: none; }
}
