/* -----------------------------------------------------------------------
   Variables
----------------------------------------------------------------------- */
:root {
    --spotcolor: #FFE365;
    --black: #000;
    --white: #fff;
    --font-display: peckham-press, sans-serif;
    --font-hand: salted, sans-serif;
    --font-mono: 'Roboto Mono', monospace;
    --clip-full: polygon(0 0, calc(100% - 170px) 0, 100% 100%, 0 100%);
    --clip-bar:  polygon(0 0, calc(100% - 170px) 0, calc(100% - 160px) 140px, 0 200px);
    /*--clip-full: polygon(0 0, 88% 0, 100% 100%, 0 100%);
    --clip-bar:  polygon(0 0, 88% 0, calc(100% - 160px) 140px, 0 200px);*/
}

/* -----------------------------------------------------------------------
   Reset & base
----------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    background: var(--white); /* white wedge area where spot-bg is clipped away */
    overflow-x: hidden;       /* prevents scrollbars during page transition scaling */
}

body {
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.6;
    color: var(--black);
    background: transparent; /* let spot-bg show through */
    position: relative;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

:focus { outline: none; }
:focus-visible {
    outline: 3px solid var(--black);
    outline-offset: 2px;
    box-shadow: 0 0 0 5px var(--spotcolor);
}

/* -----------------------------------------------------------------------
   Container
----------------------------------------------------------------------- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* -----------------------------------------------------------------------
   View Transitions
----------------------------------------------------------------------- */
@view-transition { navigation: auto; }

/* Homepage → product/cart: old full diagonal shrinks to bar */
:root:has(body.page-product)::view-transition-old(dynamic-shape),
:root:has(body.page-cart)::view-transition-old(dynamic-shape) {
    animation-name: spot-full-to-bar;
    animation-duration: 0.5s;
    animation-timing-function: ease-in-out;
    animation-fill-mode: forwards;
}
:root:has(body.page-product)::view-transition-new(dynamic-shape),
:root:has(body.page-cart)::view-transition-new(dynamic-shape) {
    animation-name: none;
}

/* Product/cart → homepage: new full diagonal grows from bar */
:root:has(body.page-home)::view-transition-old(dynamic-shape) {
    animation-name: none;
}
:root:has(body.page-home)::view-transition-new(dynamic-shape) {
    animation-name: spot-bar-to-full;
    animation-duration: 0.5s;
    animation-timing-function: ease-in-out;
    animation-fill-mode: forwards;
}

@keyframes spot-full-to-bar {
    from { clip-path: var(--clip-full); }
    to   { clip-path: var(--clip-bar); }
}

@keyframes spot-bar-to-full {
    from { clip-path: var(--clip-bar); }
    to   { clip-path: var(--clip-full); }
}

/* Global default: all named transitions run at the same pace */
::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) {
    animation-duration: 0.5s;
    animation-timing-function: ease-in-out;
}


/* Tagline: snapshots at natural size to prevent upscaling during morph */
::view-transition-old(tagline),
::view-transition-new(tagline) {
    object-fit: none;
    object-position: 0 0;
}
::view-transition-image-pair(tagline) {
    overflow: clip;
}

/* -----------------------------------------------------------------------
   Yellow background — fixed behind all content, diagonal wedge right
----------------------------------------------------------------------- */
.spot-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(100% + 30px);
    background-color: var(--spotcolor);
    z-index: -1;
    clip-path: var(--clip-full);
    view-transition-name: dynamic-shape;
    will-change: transform;
}

.page-product .spot-bg, page-cart . spot-bg {
    height: 100vh;
}

.page-product .spot-bg {
    clip-path: var(--clip-bar);
    will-change: transform;
}


.page-cart .spot-bg {
    clip-path: var(--clip-bar);
    will-change: transform;
}

/* -----------------------------------------------------------------------
   Header — sits transparently on the spot background
----------------------------------------------------------------------- */
.site-header {
    position: relative;
    background: transparent;
    padding: 40px 0 16px;
    z-index: 1;
}

.header-inner {
    position: relative;
}

.site-name {
    display: block;
    line-height: 1;
    text-decoration: none;
    color: var(--black);
    transform: rotate(-1.5deg);
    transform-origin: left bottom;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .site-name { white-space: normal; line-height: 0.9; }
    .site-name .of { display: block; margin-bottom: 2px; }
    .site-name .spite { display: block; }
    .cart-circle { background-color: var(--white)!important; }
}

.site-name:hover { text-decoration: none; }

.site-name .of {
    font-family: var(--font-hand);
    font-weight: 400;
    font-style: normal;
    font-size: clamp(2rem, 5vw, 4rem);
    display: inline;
    vertical-align: baseline;
    view-transition-name: site-of;
}

.site-name .spite {
    font-family: var(--font-display);
    font-weight: 400;
    font-style: normal;
    font-size: clamp(50px, 7.8vw, 100px);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    display: inline;
    vertical-align: baseline;
    view-transition-name: site-spite;
}

.site-tagline {
    font-family: var(--font-hand);
    font-weight: 400;
    font-style: normal;
    font-size: clamp(20px, 2vw, 26px);
    margin: -16px 0 0;
    white-space: nowrap;
    view-transition-name: tagline;
    transform: rotate(-1.5deg);
    transform-origin: left bottom;
}

/* Cart circle — white circle on spot background */
.cart-circle {
    position: absolute;
    top: 16px;
    right: clamp(16px, 2.5vw, 40px);
    width: clamp(60px, 6.25vw, 80px);
    height: clamp(60px, 6.25vw, 80px);
    border-radius: 50%;
    background: var(--spotcolor);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--black);
    text-decoration: none;
    flex-shrink: 0;
    z-index: 2;
}

.cart-circle img { display: block; }

.cart-circle:hover { opacity: 0.8; text-decoration: none; }


.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--black);
    color: var(--spotcolor);
    font-family: var(--font-mono);
    font-size: 18px;
    line-height: 1;
    padding: 4px;
    min-width: 18px;
    text-align: center;
    width: 28px;
    height: 28px;
    border-radius: 14px;
}

/* -----------------------------------------------------------------------
   Page main
----------------------------------------------------------------------- */
.page-main { /* open — each page controls its own layout */ }

/* -----------------------------------------------------------------------
   Inner-page content wrapper (product, cart, success, cancel)
----------------------------------------------------------------------- */
.page-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 24px 72px;
}

/* -----------------------------------------------------------------------
   Inner-page header bar
----------------------------------------------------------------------- */
.page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--black);
}

.page-header h1 {
    font-family: var(--font-hand);
    font-weight: 400;
    font-style: normal;
    font-size: 38px;
    text-transform: lowercase;
}

.page-header a {
    font-family: var(--font-mono);
    font-size: 18px;
    /* border: 2px solid var(--black);*/
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.page-header a:hover {
    transform: rotate(0deg);
}

/* -----------------------------------------------------------------------
   Homepage layout — sidebar text + product grid on spot background
----------------------------------------------------------------------- */
.home-layout {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 3fr;
    gap: 0 48px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 24px 64px;
}

.home-sidebar {
    padding: 8px 0 0;
}

.sidebar-headline {
    font-family: var(--font-hand);
    font-weight: 400;
    font-style: normal;
    font-size: clamp(32px, 3.3vw, 42px);
    line-height: 1.05;
    margin-bottom: 20px;
    view-transition-name: tagline;
}

.sidebar-copy {
    font-family: var(--font-mono);
    font-size: clamp(14px, 1.2vw, 16px);
    line-height: 1.8;
    color: var(--black);
    margin-bottom: 14px;
}

.home-products {
    padding: 8px 0 0;
}

/* -----------------------------------------------------------------------
   Product grid
----------------------------------------------------------------------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px 20px;
}

/* -----------------------------------------------------------------------
   Product tile
----------------------------------------------------------------------- */
.product-tile {
    text-decoration: none;
    color: var(--black);
    display: block;
    position: relative;
}

.product-tile:hover { text-decoration: none; }

/*.product-tile.sold-out { opacity: 0.5; }*/

.tile-image-wrap {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    overflow: hidden;
    padding: 14px;
}

.tile-image-wrap img {
    max-width: 86%;
    max-height: 86%;
    object-fit: contain;
    transform: rotate(-3deg);
    transition: transform 0.25s ease;
}

.product-tile:hover .tile-image-wrap img {
    transform: rotate(0deg) scale(1.05);
}

.product-tile.sold-out:hover .tile-image-wrap img {
    transform: rotate(-3deg);
}

.tile-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 11px;
    font-family: var(--font-mono);
}

.tile-name {
    font-family: var(--font-hand);
    font-weight: 400;
    font-style: normal;
    font-size: clamp(21px, 1.9vw, 28px);
    line-height: 1.15;
    margin-bottom: 6px;
    text-transform: lowercase;
}

.product-tile.sold-out .tile-name {
    text-decoration: line-through;
}

.tile-price {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: bold;
    display: inline-block;
    background: var(--spotcolor);
    padding: 2px 6px;
}

.tile-tagline,
.tile-category {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: normal;
}

.sold-out-label {
    position: absolute;
    top: 25%;
    left: 0; 
    right: 0; 
    margin-inline: auto; 
    width: fit-content;
    background: var(--black);
    color: var(--white);
    font-family: var(--font-hand);
    font-size: 18px;
    padding: 0.25em 2em;
    text-transform: uppercase;
    letter-spacing: .06em;
    z-index: 2;
    transform: rotate(-12deg);
}

/* -----------------------------------------------------------------------
   Product detail
----------------------------------------------------------------------- */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 48px;
    align-items: start;
    margin-bottom: 48px;
}

.gallery-main {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    display: block;
    margin-bottom: 12px;
    padding: 28px;
    /*transform: rotate(-2.5deg);*/
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.gallery-thumb {
    width: 64px;
    height: 64px;
    border: 2px solid transparent;
    cursor: pointer;
    opacity: 0.65;
    background: #f5f5f5;
    padding: 4px;
    transition: opacity 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.gallery-thumb.active,
.gallery-thumb:hover { border-color: var(--black); opacity: 1; }

.product-info h1 {
    font-family: var(--font-hand);
    font-weight: 400;
    font-style: normal;
    font-size: 40px;
    line-height: 1.1;
    margin-bottom: 8px;
    text-transform: lowercase;
}

.product-tagline {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    color: #555;
    margin-bottom: 12px;
}

.product-size {
    font-family: var(--font-mono);
    font-size: 13px;
    color: #444;
    margin-bottom: 16px;
}

.product-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    color: #777;
    margin-bottom: 16px;
}

.product-meta span { margin-right: 16px; }

.product-price {
    font-family: var(--font-mono);
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 6px;
}

.product-description {
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
    margin-top: 20px;
    margin-bottom: 24px;
}

.add-to-cart-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.qty-input {
    width: 64px;
    padding: 10px 8px;
    border: 2px solid var(--black);
    font-size: 16px;
    font-family: var(--font-mono);
    text-align: center;
    background: var(--white);
    -moz-appearance: textfield;
}

.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button { opacity: 1; }

.add-confirm {
    font-family: var(--font-hand);
    font-size: 1.2em;
    font-weight: bold;
    color: #080;
}

.stock-warning {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: bold;
    background: var(--spotcolor);
    color: var(--black);
    padding: 6px 12px;
    margin-bottom: 14px;
    display: inline-block;
}

.sold-out-msg {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: bold;
    background: var(--black);
    color: var(--white);
    padding: 10px 18px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* -----------------------------------------------------------------------
   Buttons
----------------------------------------------------------------------- */
.btn {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .06em;
    border: 2px solid var(--black);
    padding: 10px 20px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
    background: var(--white);
    color: var(--black);
    transition: background 0.1s, color 0.1s;
}

.btn:hover { background: var(--black); color: var(--white); text-decoration: none; }
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: #333; }
.btn-spot { background: var(--spotcolor); border-color: var(--black); color: var(--black); }
.btn-spot:hover { background: #f0d200; }
.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-danger { border-color: #c00; color: #c00; background: var(--white); }
.btn-danger:hover { background: #c00; color: var(--white); }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; padding: 6px; line-height: 1; border: none; }

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

/* -----------------------------------------------------------------------
   Alerts
----------------------------------------------------------------------- */
.alert {
    padding: 10px 16px;
    border: 2px solid;
    margin-bottom: 16px;
    font-family: var(--font-mono);
    font-size: 13px;
}

.alert-error   { border-color: #c00; background: #fff0f0; color: #900; }
.alert-success { border-color: #080; background: #f0fff0; color: #050; }
.alert-info    { border-color: #06c; background: #f0f8ff; color: #036; }
.alert-warning { border-color: #840; background: var(--spotcolor); color: #630; }

/* -----------------------------------------------------------------------
   Cart
----------------------------------------------------------------------- */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-family: var(--font-mono);
}

.cart-table th {
    text-align: left;
    border-bottom: 2px solid var(--black);
    padding: 8px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.cart-table td {
    border-bottom: 1px solid #e0e0e0;
    padding: 14px 8px;
    font-size: 16px;
    vertical-align: middle;
}

.cart-table a { text-decoration: underline; }

.cart-thumb { width: 56px; height: 56px; object-fit: contain; background: #f5f5f5; }
.cart-thumb-empty { width: 56px; height: 56px; background: #f5f5f5; }
.cart-warning { font-size: 11px; color: #840; margin-top: 4px; }

.cart-qty-input {
    width: 56px;
    padding: 5px 6px;
    border: 2px solid var(--black);
    font-size: 16px;
    font-family: var(--font-mono);
    text-align: center;
}

.cart-totals {
    max-width: 380px;
    margin-left: auto;
    border: 2px solid var(--black);
    padding: 20px;
    font-family: var(--font-mono);
    margin-bottom: 24px;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    font-size: 14px;
    border-bottom: 1px solid #eee;
}

.totals-row.total {
    font-weight: bold;
    font-size: 18px;
    border-bottom: none;
    border-top: 2px solid var(--black);
    padding-top: 12px;
    margin-top: 4px;
}

.cart-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-bottom: 48px;
    gap: 8px;
}

.cart-terms-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}

.cart-terms-label a {
    text-decoration: underline;
}

.cart-terms-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.cart-terms-error {
    color: #CC0000;
    font-size: 12px;
    margin: 0;
}

/* -----------------------------------------------------------------------
   Footer
----------------------------------------------------------------------- */
.site-footer {
    background: transparent;
    color: var(--black);
    padding: 20px 0;
    font-family: var(--font-mono);
    font-size: 12px;
    margin-top: 0;
    border-top: 2px dashed var(--white);
    transform: rotate(-2deg);
}

.site-footer .container {
    display: flex;
    align-items: center;
    gap: 24px;
}

.site-footer a {
    color: inherit;
    text-decoration: underline;
}

@media (max-width: 600px) {
    .site-footer .container {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
}

.page-cart .site-footer, .page-product .site-footer {
    border-color: var(--black);
}

/* -----------------------------------------------------------------------
   Misc
----------------------------------------------------------------------- */
.empty-state {
    padding: 56px 0;
    font-family: var(--font-mono);
    font-size: 14px;
    color: #666;
}

.empty-state p { margin-bottom: 20px; }

/* -----------------------------------------------------------------------
   Responsive
----------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root {
        --clip-full: polygon(0 0, 100% 0, 100% 100%, 0 100%);
        --clip-bar:  polygon(0 0, 100% 0, 100% 90px, 0 120px);
    }
    .cart-circle {
        position: fixed;
        top: 16px;
        right: 16px;
        z-index: 100;
        border: 3px solid var(--spotcolor);
    }
    .page-cart .cart-circle { position: absolute; }
    .home-layout { grid-template-columns: 1fr; gap: 20px 0; padding: 16px 20px 48px; }

    .product-detail { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 520px) {
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .home-products { padding: 20px 16px; }
    .page-content { padding: 24px 16px 48px; }
    .tile-name { font-size: 21px; }
    .site-name { white-space: normal; line-height: 0.9; }
    .site-name .of { display: block; margin-bottom: 2px; font-size: 1.5em; }
    .site-name .spite { display: block; font-size: 38px; }
    .site-tagline { margin: -8px 0 0; }
}
