/* ================================================================
   Alves & Sons — Materials & Accessories (standalone section)
   Self-contained dark/gold theme matching the main site.
   British English throughout.
================================================================ */

/* ── Accessibility: visible keyboard focus + reduced motion ─────── */
[data-acc-page] a:focus-visible,
[data-acc-page] button:focus-visible,
[data-acc-page] input:focus-visible,
.length-btn:focus-visible {
    outline: 3px solid var(--gold, #d4a574);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

:root {
    --dark-bg:    #1a1c1e;
    --darker-bg:  #141618;
    --card-dark:  #23262a;
    --card-soft:  #1f2226;
    --gold:       #d4a574;
    --gold-light: #e6c79c;
    --green:      #48bb78;
    --red:        #e53e3e;
    --text:       #f3f4f6;
    --grey:       #a0a0a0;
    --grey-light: #c8ccd2;
    --border:     rgba(255,255,255,0.08);
    --radius:     14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--dark-bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

/* ── Header — IDÊNTICO ao das outras páginas (catalogue.css) ──── */
header {
    position: fixed; top: 0; width: 100%; z-index: 900;
    background: rgba(26,28,30,0.96); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 80px;
}
.header-container {
    max-width: 1400px; margin: 0 auto; padding: 0 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
    height: 100%;
}
.logo-section { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.logo-section img { height: 44px; width: auto; }
.logo-text { color: var(--gold); font-weight: 600; letter-spacing: 0.1em; font-size: 0.82rem; text-transform: uppercase; white-space: nowrap; }
.header-actions { display: flex; align-items: center; gap: 1.25rem; }
.hdr-link { color: var(--grey); font-size: 0.875rem; font-weight: 500; text-decoration: none; transition: color 0.2s; white-space: nowrap; }
.hdr-link:hover { color: white; }
.hdr-link.active { color: var(--gold); }
.cart-button {
    position: relative; background: none;
    border: 1.5px solid var(--gold); color: var(--gold);
    padding: 0.55rem 1.1rem; border-radius: 9999px;
    cursor: pointer; transition: all 0.25s;
    display: flex; align-items: center; gap: 0.45rem;
    font-weight: 600; font-size: 0.82rem;
}
.cart-button:hover { background: var(--gold); color: var(--dark-bg); }
.cart-count {
    position: absolute; top: -7px; right: -7px;
    background: #e53e3e; color: white; border-radius: 50%;
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.68rem; font-weight: 700;
}

/* ── Layout (padding-top = altura do header fixo) ─────────────── */
main { max-width: 1180px; margin: 0 auto; padding: calc(80px + 1.5rem) 1.25rem 4rem; }

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--grey);
    margin: 0.5rem 0 1.5rem;
}
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb .sep { opacity: 0.5; }
.breadcrumb .current { color: var(--grey-light); }

/* ── Hero / headings ───────────────────────────────────────── */
.hero { text-align: center; padding: 2.5rem 1rem 1.5rem; }
.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold);
    margin: 0 0 0.5rem;
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0 0 0.75rem; }
.hero-text { color: var(--grey); max-width: 620px; margin: 0 auto; }

.section-heading { margin: 2.5rem 0 1.25rem; }
.section-heading h2 { font-size: 1.5rem; margin: 0.25rem 0 0; }

/* ── Category cards grid ───────────────────────────────────── */
.category-grid {
    display: grid;
    /* min(100%, …) prevents horizontal overflow on ~320px screens */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.category-card {
    background: var(--card-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 1.25rem;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s, background 0.2s;
}
/* Only apply hover lift on devices that actually hover (avoids sticky hover on touch) */
@media (hover: hover) {
    .category-card:hover {
        transform: translateY(-4px);
        border-color: rgba(212,165,116,0.4);
        background: var(--card-soft);
    }
}
/* Touch feedback instead of hover */
.category-card:active { background: var(--card-soft); }
.category-icon {
    width: 56px; height: 56px;
    margin: 0 auto 0.9rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: rgba(212,165,116,0.12);
    color: var(--gold);
}
.category-card h2 { font-size: 1.05rem; margin: 0 0 0.4rem; }
.category-card p { font-size: 0.85rem; color: var(--grey); margin: 0; min-height: 2.4em; }
.category-card .cat-count { display:block; margin-top:0.6rem; font-size:0.75rem; color:var(--gold); font-weight:700; }

/* ── Product grid / cards ──────────────────────────────────── */
.product-grid {
    display: grid;
    /* min(100%, …) keeps a single column from overflowing on small phones */
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 1.1rem;
    margin-top: 1rem;
}
.acc-card {
    background: var(--card-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, border-color 0.2s;
}
@media (hover: hover) {
    .acc-card:hover { transform: translateY(-3px); border-color: rgba(212,165,116,0.35); }
}
.acc-card-imgwrap {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #111;
    overflow: hidden;
    cursor: pointer;
}
.acc-card-imgwrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.acc-card:hover .acc-card-imgwrap img { transform: scale(1.04); }
.acc-card-badge {
    position: absolute; top: 0.55rem; left: 0.55rem;
    background: var(--gold); color: var(--dark-bg);
    font-size: 0.62rem; font-weight: 800; letter-spacing: 0.05em;
    text-transform: uppercase; padding: 0.2rem 0.5rem; border-radius: 20px;
}
.acc-card-body { padding: 0.9rem 1rem 1.1rem; display: flex; flex-direction: column; flex: 1; }
.acc-card-cat {
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--gold); margin-bottom: 0.25rem;
}
.acc-card-name { font-size: 0.98rem; font-weight: 700; margin: 0 0 0.3rem; line-height: 1.3; }
.acc-card-desc {
    font-size: 0.8rem; color: var(--grey); margin: 0 0 0.7rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.acc-price-row { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.2rem; }
.acc-price-inc { font-size: 1.25rem; font-weight: 800; color: var(--gold); }
.acc-price-ex { font-size: 0.75rem; color: var(--grey); }
.acc-unit-label {
    display: inline-block;
    font-size: 0.68rem; color: var(--grey-light);
    background: rgba(255,255,255,0.05);
    border-radius: 6px; padding: 0.12rem 0.45rem; margin-bottom: 0.7rem;
    align-self: flex-start;
}
.acc-card-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.5rem; }

/* ── Length selector (door bars) ───────────────────────────── */
.length-options { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.length-btn {
    flex: 1 1 auto;
    min-width: 92px;
    background: var(--card-soft);
    border: 2px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.18s, background 0.18s;
    font-family: inherit;
}
.length-btn .len-size { display: block; font-weight: 700; font-size: 0.9rem; }
.length-btn .len-price { display: block; font-size: 0.72rem; color: var(--grey); margin-top: 0.15rem; }
.length-btn.active { border-color: var(--gold); background: rgba(212,165,116,0.14); }
.length-btn.active .len-price { color: var(--gold-light); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    border: none; border-radius: 9px; cursor: pointer;
    font-family: inherit; font-weight: 700; font-size: 0.9rem;
    padding: 0.7rem 1rem; transition: opacity 0.18s, background 0.18s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn-gold { background: var(--gold); color: var(--dark-bg); }
.btn-gold:hover { opacity: 0.92; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--grey-light); }
.btn-ghost:hover { border-color: rgba(212,165,116,0.4); color: var(--gold); }
.btn-block { width: 100%; }

.detail-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.detail-share-btn {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0.65rem 0.9rem;
    border: 1px solid rgba(212,165,116,0.38);
    border-radius: 10px;
    background: rgba(212,165,116,0.08);
    color: var(--gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s, background 0.18s, border-color 0.18s;
}

.detail-share-btn:hover,
.detail-share-btn:focus-visible {
    transform: translateY(-1px);
    background: rgba(212,165,116,0.16);
    border-color: var(--gold);
}
.btn-link-detail {
    background: none; border: none; color: var(--gold); cursor: pointer;
    font-size: 0.78rem; font-weight: 600; text-decoration: underline;
    text-underline-offset: 2px; padding: 0; font-family: inherit; align-self: flex-start;
}

/* ── Detail page layout ────────────────────────────────────── */
.details-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2.2rem; align-items: start; }
.detail-gallery { position: sticky; top: 80px; }
.detail-main-img {
    width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
    border-radius: var(--radius); border: 1px solid var(--border); background: #111;
}
.detail-thumbs { display: flex; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap; }
.detail-thumb {
    width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
    border: 2px solid var(--border); cursor: pointer; background: #111;
}
.detail-thumb.active { border-color: var(--gold); }
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }

.detail-cat {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--gold); margin-bottom: 0.4rem;
}
.detail-title { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 0.75rem; }
.detail-desc { color: var(--grey-light); margin: 0 0 1.25rem; white-space: pre-line; }
.detail-price { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 1.25rem; }
.detail-price .inc { font-size: 2rem; font-weight: 800; color: var(--gold); }
.detail-price .ex { font-size: 0.9rem; color: var(--grey); }

.calc-panel {
    background: rgba(212,165,116,0.06);
    border: 1px solid rgba(212,165,116,0.18);
    border-radius: 12px; padding: 1.1rem 1.2rem; margin-bottom: 1.25rem;
}
.calc-panel h3 { font-size: 0.85rem; color: var(--gold); margin: 0 0 0.75rem; font-weight: 700; }
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 0.75rem; }
.calc-field label { display: block; font-size: 0.72rem; color: var(--grey); margin-bottom: 0.25rem; }
.calc-field input {
    width: 100%; background: var(--darker-bg); border: 1px solid var(--border);
    border-radius: 7px; padding: 0.5rem 0.65rem; color: var(--text);
    font-size: 0.9rem; outline: none; font-family: inherit;
}
.calc-field input:focus { border-color: var(--gold); }
.room-rows { display: flex; flex-direction: column; gap: 0.6rem; }
.room-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.5rem; align-items: end; }
.room-row .btn-removeroom {
    background: rgba(229,62,62,0.12); border: 1px solid rgba(229,62,62,0.3);
    color: var(--red); border-radius: 7px; width: 38px; height: 38px; cursor: pointer; font-size: 1.1rem;
}
.calc-addroom {
    background: none; border: 1px dashed rgba(212,165,116,0.4); color: var(--gold);
    border-radius: 7px; padding: 0.45rem; cursor: pointer; font-size: 0.8rem; width: 100%;
    margin-top: 0.6rem; font-family: inherit;
}
.calc-result {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px solid var(--border);
}
.calc-result .label { font-size: 0.85rem; color: var(--grey); }
.calc-result .value { font-size: 1.15rem; font-weight: 800; color: var(--gold); }
.calc-note { font-size: 0.74rem; color: var(--grey); margin-top: 0.45rem; line-height: 1.4; }

.qty-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.qty-row label { font-size: 0.85rem; color: var(--grey-light); }
.qty-stepper { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.qty-stepper button {
    background: var(--card-soft); border: none; color: var(--text);
    width: 36px; height: 36px; cursor: pointer; font-size: 1.1rem; font-family: inherit;
}
.qty-stepper input {
    width: 52px; height: 36px; text-align: center; border: none;
    background: var(--darker-bg); color: var(--text); font-size: 0.95rem; outline: none;
    -moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.inline-error {
    display: none; color: var(--red); font-size: 0.8rem; margin: 0.4rem 0 0.6rem;
}

.related-section { grid-column: 1 / -1; margin-top: 2.5rem; }
.related-section h2 { font-size: 1.3rem; margin: 0 0 1rem; }

/* ── States ────────────────────────────────────────────────── */
.loading-state, .empty-state {
    text-align: center; padding: 3.5rem 1rem; color: var(--grey);
    grid-column: 1 / -1;
}
.spinner {
    width: 38px; height: 38px; margin: 0 auto 1rem;
    border: 3px solid rgba(212,165,116,0.2); border-top-color: var(--gold);
    border-radius: 50%; animation: accspin 0.8s linear infinite;
}
@keyframes accspin { to { transform: rotate(360deg); } }

/* ── Toast ─────────────────────────────────────────────────── */
.acc-toast {
    position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(140%);
    background: var(--card-dark); border: 1px solid rgba(212,165,116,0.35);
    color: var(--text); padding: 0.85rem 1.25rem; border-radius: 10px;
    display: flex; align-items: center; gap: 0.6rem; z-index: 9999;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5); transition: transform 0.32s ease; font-size: 0.9rem;
}
.acc-toast.show { transform: translateX(-50%) translateY(0); }
.acc-toast svg { color: var(--green); flex-shrink: 0; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border);
    text-align: center; padding: 2rem 1rem; color: var(--grey); font-size: 0.85rem;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 860px) {
    .details-layout { grid-template-columns: 1fr; }
    .detail-gallery { position: static; }
}
@media (max-width: 768px) {
    header { height: 64px; }
    main { padding: calc(64px + 1.25rem) 1.25rem 4rem; }
    .logo-text { font-size: 0.7rem; }
    .header-actions { gap: 0.7rem; }

    /* Mobile-first touch targets (Apple/WCAG ≥44px) */
    .cart-button { min-height: 44px; }
    .qty-stepper button { width: 44px; height: 44px; font-size: 1.25rem; }
    .qty-stepper input { height: 44px; font-size: 1rem; }
    .length-btn { min-height: 56px; }                 /* easy to tap, shows size+price */
    .btn { padding: 0.85rem 1rem; }                   /* primary actions taller */
    .room-row .btn-removeroom { width: 44px; height: 44px; }
    .detail-thumb { width: 56px; height: 56px; }      /* bigger gallery thumbs */
}
/* Telemóvel: esconde nav de texto + marca já a 600px p/ não apertar a linha */
@media (max-width: 600px) {
    .detail-heading-row { align-items: center; }
    .detail-share-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; }
    .detail-share-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .header-container { padding: 0 1rem; }
    .header-actions { gap: 0.6rem; }
    .hdr-link { display: none; }                        /* logo (=home) + conta + cesta bastam */
    .logo-text { display: none; }                       /* logo circular já identifica a marca */
    .logo-section img { height: 40px; }
}
@media (max-width: 480px) {
    main { padding: calc(64px + 1rem) 0.9rem 3rem; }   /* header fixo + gutter menor */
    .hdr-link { display: none; }                       /* esconde links de texto; logo+cesta ficam */
    .logo-text { display: none; }
    .hero { padding: 1.25rem 0.5rem 1rem; }
    .hero h1 { font-size: clamp(1.5rem, 6vw, 2rem); }
    .category-card { padding: 1.25rem 1rem; }
    .calc-grid { grid-template-columns: 1fr; }         /* width/length stack on tiny screens */
    .detail-price .inc { font-size: 1.6rem; }
    .acc-card-name { font-size: 0.95rem; }
}
