/* style.css - Savannah's Art Works */

:root {
    --cream: #f6f1e8;
    --cream-dark: #ebe2d4;
    --paper: #fffdf9;
    --ink: #292721;
    --muted: #777166;
    --line: #d9d0c2;
    --brown: #675342;
    --brown-dark: #403429;
    --forest: #1c261f;
    --serif: "Cormorant Garamond", Georgia, serif;
    --sans: "Montserrat", Arial, sans-serif;

    /* Motion: tuned curves instead of the default "ease" */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);      /* fast start, soft landing */
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* tiny overshoot */

    /* Fluid spacing: grows smoothly with the screen, no jumps */
    --gutter: clamp(16px, 4vw, 32px);
    --section: clamp(56px, 9vw, 110px);
    --header-h: clamp(64px, 8vw, 76px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--forest); }

body {
    color: var(--ink);
    font-family: var(--sans);
    font-size: clamp(14px, 0.85rem + 0.2vw, 16px);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

img { display: block; max-width: 100%; }
a { color: inherit; }

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* Lenis smooth scrolling helpers */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-stopped { overflow: clip; }

/* ---------- Accessibility ---------- */

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    padding: 10px 16px;
    background: var(--paper);
    color: var(--ink);
    font-weight: 600;
    transform: translateY(-160%);
    transition: transform 0.3s var(--ease-out);
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
    outline: 2px solid #e9c46a;
    outline-offset: 3px;
}

/* ---------- Background photo ----------
   The photo is as wide as the screen and taller than it.
   script.js slides it up as you scroll, so the bottom
   (the water) is revealed by the time you reach the end. */

.bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: var(--forest) url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDABALDA4MChAODQ4SERATGCgaGBYWGDEjJR0oOjM9PDkzODdASFxOQERXRTc4UG1RV19iZ2hnPk1xeXBkeFxlZ2P/2wBDARESEhgVGC8aGi9jQjhCY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2P/wAARCAAgABgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwCvcOkbApGSAC3Pc9ulJafuo84HJ6E9fQVXur6OV+QOBjgdafaFHIWTDMB8uW2j8aiN0tTNrQsiZY12Ku9u59KKAoPzRjax6rjgGipM2itc21m8rE3O09fu9PaqYSOM/u3Lcf3a0mthuOcEnuOaUWgXkDtWyRbnZbCadNcyRneEYZGdx2nHr3oqeNdvSijlXYjmP//Z") center top / cover no-repeat;
    view-transition-name: page-bg;
}

.bg img {
    width: 100%;
    height: auto;
    min-height: 135vh;            /* phones: still tall enough to scroll through */
    object-fit: cover;
    will-change: transform;
    opacity: 0;
    transition: opacity 0.9s var(--ease-out);
}

.bg img.loaded { opacity: 1; }

/* Darkens the photo so cards and white text stay easy to read. */
.bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(14, 22, 16, 0.55) 0%,
        rgba(14, 22, 16, 0.35) 40%,
        rgba(10, 20, 22, 0.5) 100%);
}

/* ---------- Header (hides on scroll down, returns on scroll up) ---------- */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    color: #fff;
    transition: transform 0.5s var(--ease-out), color 0.4s var(--ease-out);
    view-transition-name: site-header;
}

/* Frosted bar that fades in once you've scrolled a little */
.site-header::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 253, 249, 0.88);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    backdrop-filter: blur(14px) saturate(1.2);
    box-shadow: 0 1px 0 rgba(64, 52, 41, 0.12);
    opacity: 0;
    transition: opacity 0.4s var(--ease-out);
}

.site-header.is-scrolled { color: var(--brown-dark); }
.site-header.is-scrolled::before { opacity: 1; }
.site-header.is-hidden { transform: translateY(-100%); }

.header-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-h);
    gap: 16px;
}

.logo {
    font-family: var(--serif);
    font-size: clamp(21px, 1.2rem + 0.8vw, 28px);
    font-weight: 600;
    text-decoration: none;
    color: inherit;
}

.cart-link {
    position: relative;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: inherit;
    padding: 6px 0;
}

/* Underline that draws in on hover */
.cart-link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.45s var(--ease-out);
}

.cart-link:hover::after,
.cart-link[aria-current="page"]::after {
    transform: scaleX(1);
    transform-origin: left;
}

.cart-count { display: inline-block; }
.cart-count.bump { animation: bump 0.5s var(--ease-spring); }

@keyframes bump {
    0% { transform: scale(1); }
    40% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

/* ---------- Intro ---------- */

.intro {
    padding: calc(var(--header-h) + clamp(56px, 10vw, 120px)) 0 clamp(40px, 6vw, 72px);
    text-align: center;
    color: #fff;
    text-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}

h1 {
    font-family: var(--serif);
    font-size: clamp(40px, 1.5rem + 5vw, 84px);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: var(--brown-dark);
}

.intro h1 { color: #fff; }

.intro-text {
    font-family: var(--serif);
    font-size: clamp(20px, 1rem + 1vw, 28px);
    font-style: italic;
    color: var(--cream);
    margin-top: 12px;
}

.intro-sub {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--cream-dark);
    margin-top: 14px;
}

/* Headline words rise in one after another */
.split-words .word {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    padding-bottom: 0.08em;
}

.split-words .word > span {
    display: inline-block;
    transform: translateY(110%);
    transition: transform 1.1s var(--ease-out);
    transition-delay: var(--delay, 0s);
}

.split-words.is-visible .word > span { transform: translateY(0); }

/* ---------- Scroll reveals ---------- */

.js .reveal {
    opacity: 0;
    transform: translateY(32px) scale(0.985);
    transition:
        opacity 0.9s var(--ease-out),
        transform 1.1s var(--ease-out);
    transition-delay: var(--delay, 0s);
}

.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- Gallery ---------- */

.gallery-section { padding: 0 0 var(--section); }

/* Wide gaps so the photo shows between the cards. */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: clamp(32px, 5vw, 56px);
    max-width: 1060px;
    margin: 0 auto;
    align-items: start;
}

.gallery:focus { outline: none; }

.art-card {
    position: relative;
    background: var(--paper);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.32);
    transition:
        opacity 0.9s var(--ease-out),
        transform 0.6s var(--ease-out);
}

/* Deeper shadow that fades in on hover (opacity only, so it stays smooth) */
.art-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 28px 60px rgba(0, 0, 0, 0.42);
    opacity: 0;
    transition: opacity 0.6s var(--ease-out);
    pointer-events: none;
}

@media (hover: hover) {
    .art-card.is-visible:hover { transform: translateY(-6px); }
    .art-card:hover::after { opacity: 1; }
    .art-card:hover .art-photo img.loaded { transform: scale(1.035); }
}

/* Photo box. Its size is reserved up front so nothing jumps. */
.art-photo {
    position: relative;
    overflow: hidden;
    border-radius: 6px 6px 0 0;
    background: var(--cream-dark);
}

.art-photo a { display: block; }

/* Shimmer while the photo loads */
.art-photo::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: shimmer 1.4s var(--ease-in-out) infinite;
}

.art-photo.loaded::before { display: none; }

@keyframes shimmer {
    to { transform: translateX(100%); }
}

.art-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.04);
    transition:
        opacity 0.8s var(--ease-out),
        transform 1.2s var(--ease-out);
}

.art-photo img.loaded { opacity: 1; transform: scale(1); }

.photo-placeholder {
    aspect-ratio: 4 / 5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 13px;
}

.art-info {
    padding: 20px 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.art-info h2,
.cart-item-info h2 {
    font-family: var(--serif);
    font-size: clamp(22px, 1.2rem + 0.4vw, 26px);
    font-weight: 600;
    line-height: 1.2;
}

.art-details {
    font-size: 13px;
    color: var(--muted);
}

.art-price {
    font-weight: 600;
    margin-bottom: 10px;
}

.option-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.option-select {
    width: 100%;
    padding: 11px 12px;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: #fff;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s var(--ease-out);
}

.option-select:hover { border-color: var(--brown); }

.is-sold .art-photo { opacity: 0.6; }

.sold-label {
    display: block;
    text-align: center;
    padding: 12px;
    border: 1px solid var(--line);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- Buttons ---------- */

.button {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: block;
    width: 100%;
    padding: 13px 18px;
    border: 1px solid var(--brown);
    border-radius: 3px;
    background: var(--brown);
    color: #fff;
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.35s var(--ease-out);
}

/* Darker fill that sweeps up from the bottom on hover */
.button::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--brown-dark);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.45s var(--ease-out);
}

@media (hover: hover) {
    .button:hover { transform: translateY(-2px); }
    .button:hover::before { transform: scaleY(1); }
}

.button:active { transform: translateY(0) scale(0.97); transition-duration: 0.1s; }

.button.added::after {
    content: "\2713";
    margin-left: 8px;
    display: inline-block;
    animation: pop 0.4s var(--ease-spring);
}

@keyframes pop {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.button:disabled {
    background: var(--line);
    border-color: var(--line);
    color: var(--muted);
    cursor: not-allowed;
    transform: none;
}

.button:disabled::before { display: none; }

/* ---------- Cart page ---------- */

.cart-page { padding: calc(var(--header-h) + clamp(32px, 6vw, 70px)) 0 var(--section); }
.cart-page:focus { outline: none; }

.cart-container {
    max-width: 760px;
    width: calc(100% - 32px);
    background: var(--paper);
    border-radius: 6px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    padding: clamp(28px, 5vw, 44px) clamp(20px, 5vw, 40px);
}

.cart-container h1 { margin-bottom: 30px; font-size: clamp(36px, 1.5rem + 3vw, 56px); }

.cart-item {
    display: grid;
    grid-template-columns: clamp(70px, 12vw, 90px) 1fr auto;
    gap: clamp(12px, 2.5vw, 18px);
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
    animation: slide-in 0.6s var(--ease-out) both;
}

.no-anim .cart-item { animation: none; }

.cart-item.leaving {
    animation: slide-out 0.35s var(--ease-in-out) both;
}

@keyframes slide-in {
    from { opacity: 0; transform: translateX(-16px); }
}

@keyframes slide-out {
    to { opacity: 0; transform: translateX(24px); }
}

.cart-thumb {
    aspect-ratio: 4 / 5;
    background: var(--cream-dark);
    overflow: hidden;
    border-radius: 3px;
}

.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }

.cart-item-price { font-weight: 600; }

.qty {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.qty-button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: #fff;
    color: var(--ink);
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.3s var(--ease-spring), border-color 0.3s var(--ease-out);
}

.qty-button:hover { border-color: var(--brown); }
.qty-button:active { transform: scale(0.88); }

.qty-number { min-width: 18px; text-align: center; font-weight: 600; }

.remove-button {
    background: none;
    border: none;
    padding: 0;
    margin-left: 8px;
    font-family: var(--sans);
    font-size: 12px;
    color: var(--brown);
    text-decoration: underline;
    cursor: pointer;
}

.cart-summary {
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 24px;
    margin: 30px 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
}

.summary-row.total {
    font-weight: 600;
    font-size: 17px;
    border-top: 1px solid var(--line);
    margin: 8px 0 20px;
    padding-top: 14px;
}

.small-note {
    font-size: 12px;
    color: var(--muted);
    margin-top: 10px;
    text-align: center;
}

.thank-you {
    background: var(--cream);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 24px;
    margin-bottom: 24px;
}

.thank-you h2 {
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 6px;
}

.empty { color: var(--muted); padding: 20px 0; }

.back-link {
    font-size: 13px;
    color: var(--brown);
}

/* ---------- Footer ---------- */

.site-footer {
    background: rgba(28, 38, 31, 0.92);
    color: var(--cream);
    padding: clamp(32px, 5vw, 44px) 0;
    text-align: center;
    font-size: 14px;
}

.footer-inner { display: flex; flex-direction: column; gap: 6px; }

.site-footer a { color: var(--cream); }

.copyright { font-size: 12px; opacity: 0.7; margin-top: 8px; }

/* ---------- Pop-up message ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 60;
    transform: translate(-50%, 24px);
    background: var(--ink);
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s var(--ease-out), transform 0.5s var(--ease-spring);
    max-width: calc(100% - 32px);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Page transitions (cross-fade between pages) ---------- */

@view-transition { navigation: auto; }

::view-transition-old(root) { animation: 0.35s var(--ease-in-out) both fade-out; }
::view-transition-new(root) { animation: 0.5s var(--ease-out) both fade-in; }

@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

/* ---------- Reduced motion ----------
   For people whose device asks for less movement:
   no sliding, no smooth-scroll, no parallax. Things just appear. */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }

    .js .reveal { opacity: 1; transform: none; }
    .split-words .word > span { transform: none; }
    .bg img { transform: none !important; }

    @view-transition { navigation: none; }
}

/* ---------- Loading and status bits ---------- */

/* Placeholder cards while the paintings load */
.art-card.skeleton {
    aspect-ratio: 3 / 4.6;
    overflow: hidden;
    background: rgba(255, 253, 249, 0.82);
}

.art-card.skeleton::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.6) 50%, transparent 70%);
    transform: translateX(-100%);
    animation: shimmer 1.4s var(--ease-in-out) infinite;
}

.load-error {
    grid-column: 1 / -1;
    text-align: center;
    color: #fff;
    background: rgba(28, 38, 31, 0.7);
    padding: 24px;
    border-radius: 6px;
}

.original-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--cream-dark);
    color: var(--brown-dark);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: 2px;
}

.one-of-a-kind {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.shipping-note {
    font-size: 13px;
    color: var(--muted);
    margin: -8px 0 16px;
}

/* ---------- On-page checkout ---------- */

.pay-area { margin-top: 4px; }

.paypal-button { min-height: 48px; position: relative; z-index: 1; }

.pay-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.pay-divider::before,
.pay-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.card-toggle { background: var(--ink); border-color: var(--ink); }
.card-toggle.is-open { border-radius: 3px 3px 0 0; }

.card-form {
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 4px 4px;
    background: var(--paper);
    padding: 18px 16px 20px;
    animation: slide-in 0.4s var(--ease-out) both;
}

.card-form fieldset { border: none; margin: 0 0 16px; padding: 0; }

.card-form legend {
    font-family: var(--serif);
    font-size: 20px;
    font-weight: 600;
    color: var(--brown-dark);
    margin-bottom: 6px;
}

.card-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin: 10px 0 4px;
}

.card-form input,
.card-form select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    font-family: var(--sans);
    font-size: 16px;
    color: var(--ink);
}

.card-form input:focus,
.card-form select:focus { border-color: var(--brown); outline: none; }

/* PayPal puts each card box (an iframe) inside these */
.card-field { min-height: 46px; }
.card-field iframe { width: 100% !important; }

.field-row { display: flex; gap: 10px; }
.field-row > div { min-width: 0; }
.field-row .grow { flex: 1; }
.field-row select { min-width: 84px; }
.field-row input#shipZip { width: 100px; }

@media (max-width: 420px) {
    .field-row { flex-wrap: wrap; }
    .field-row .grow { flex-basis: 100%; }
}

.checkout-error {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 4px;
    background: #f8e3dd;
    color: #8a2f20;
    font-size: 14px;
}
