/* ============================================================
   Mayna Diamonds - storefront design system.

   Every colour here reads a CSS variable. The variables are written into :root by
   the layout from the theme row in the database, so Admin -> Appearance re-themes
   the whole site without touching this file. The values below are only fallbacks
   for the case where the theme has not loaded.
   ============================================================ */

:root {
    --ivory:      #F8F5EF;
    --ink:        #17140F;
    --gold:       #C3A15F;
    --gold-soft:  #D8BE8C;
    --beige:      #EDE4D3;
    --emerald:    #14523F;
    --stone:      #5F594E;
    --gold-text:  #8A6A28;
    --ticker-bg:  #0D1220;
    --line:       rgba(23, 20, 15, .12);
    --radius:     .9rem;
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body:    'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--ivory);
    color: var(--ink);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16.5px;
    line-height: 1.65;
    letter-spacing: .01em;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold); color: #fff; }

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

.wrap { width: min(1280px, 100% - 3rem); margin-inline: auto; }
@media (max-width: 640px) { .wrap { width: calc(100% - 2rem); } }

.font-display { font-family: var(--font-display); }

/* ---------- editorial helpers ---------- */
.eyebrow {
    font-size: .76rem; letter-spacing: .3em; text-transform: uppercase;
    color: var(--gold-text); font-weight: 600; margin: 0 0 .75rem;
}
.hairline { height: 1px; background: var(--line); border: 0; }
.hairline-gold { height: 1px; border: 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

.display-1 {
    font-family: var(--font-display); font-weight: 400; line-height: 1.04;
    letter-spacing: -.01em; font-size: clamp(2.4rem, 6vw, 4.5rem); margin: 0;
}
.display-2 {
    font-family: var(--font-display); font-weight: 400; line-height: 1.1;
    font-size: clamp(1.8rem, 3.6vw, 2.8rem); margin: 0;
}
.display-1 em, .display-2 em { font-style: italic; font-weight: 300; color: var(--gold); }
.lede { color: var(--stone); font-size: 1.05rem; max-width: 56ch; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .75rem;
    font-size: .78rem; letter-spacing: .22em; text-transform: uppercase; font-weight: 600;
    padding: 1rem 2.2rem; border: 1px solid transparent; cursor: pointer;
    transition: background-color .35s, color .35s, letter-spacing .35s, border-color .35s;
    font-family: inherit;
}
.btn-ink { background: var(--ink); color: var(--ivory); }
.btn-ink:hover { background: var(--emerald); letter-spacing: .3em; }
.btn-outline { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-outline:hover { background: var(--ink); color: var(--ivory); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--ink); }
.btn-ghost-light { border-color: rgba(255, 255, 255, .55); color: #fff; }
.btn-ghost-light:hover { background: #fff; color: var(--ink); }
.btn-sm { padding: .65rem 1.3rem; font-size: .72rem; letter-spacing: .16em; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.link-u {
    position: relative; display: inline-block; font-size: .78rem; font-weight: 600;
    letter-spacing: .24em; text-transform: uppercase; padding-bottom: .35rem;
}
.link-u::after {
    content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
    background: var(--gold); transform: scaleX(.35); transform-origin: left;
    transition: transform .45s cubic-bezier(.22, 1, .36, 1);
}
.link-u:hover::after { transform: scaleX(1); }

/* ---------- rates ticker (BRD-06) ---------- */
.rates-bar { overflow: hidden; white-space: nowrap; background: var(--ticker-bg); }
.rates-track {
    display: inline-block; animation: marquee 44s linear infinite; padding: .6rem 0 .6rem 100%;
    font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 600;
}
.rates-bar:hover .rates-track { animation-play-state: paused; }
.rate { margin-right: 2.6rem; color: #CBD2DC; }
.rate b { font-weight: 700; color: var(--gold-soft); letter-spacing: .06em; }
@keyframes marquee { to { transform: translateX(-100%); } }

/* ---------- header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 60;
    background: color-mix(in srgb, var(--ivory) 90%, transparent);
    backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1rem 0; }
.brand { display: inline-flex; flex-direction: column; line-height: 1; flex: 0 0 auto; }
/* The header is a flex row, so without this the logo is the thing that gets
   squashed when the row runs out of space on a phone. */
.brand img { flex: 0 0 auto; width: auto; max-width: 150px; object-fit: contain; }
.brand-name { font-family: var(--font-display); font-size: 1.5rem; letter-spacing: .14em; text-transform: uppercase; }
.brand-sub { font-size: .6rem; letter-spacing: .34em; text-transform: uppercase; color: var(--gold-text); margin-top: .3rem; }

.nav { display: flex; gap: 1.8rem; align-items: center; }
.nav-link {
    font-size: .76rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
    position: relative; padding: .35rem 0; transition: color .25s;
}
.nav-link:hover, .nav-link.active { color: var(--emerald); }
.nav-link::after {
    content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 0;
    background: var(--gold); transition: width .35s;
}
.nav-link:hover::after, .nav-link.active::after { width: 100%; }

.header-actions { display: flex; align-items: center; gap: .35rem; }
.icon-btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 2.4rem; height: 2.4rem; border-radius: 9999px; border: 0; background: transparent;
    color: inherit; cursor: pointer; transition: background .25s;
}
.icon-btn:hover { background: var(--beige); }
.badge-count {
    position: absolute; top: 0; right: 0; min-width: 1.05rem; height: 1.05rem; padding: 0 .2rem;
    border-radius: 9999px; background: var(--emerald); color: #fff; font-size: .64rem;
    display: flex; align-items: center; justify-content: center;
}
.lang-switch { display: flex; gap: .4rem; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; }
.lang-switch a { color: var(--stone); padding: .2rem .35rem; }
.lang-switch a.active { color: var(--ink); border-bottom: 1px solid var(--gold); }

.burger { display: none; }
@media (max-width: 1024px) {
    .nav { display: none; }
    .burger { display: inline-flex; }
}
.mobile-menu {
    position: fixed; inset: 0; z-index: 70; background: var(--ivory); padding: 2rem;
    transform: translateX(100%); transition: transform .45s cubic-bezier(.22, 1, .36, 1);
    overflow-y: auto;
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu a { display: block; padding: .9rem 0; border-bottom: 1px solid var(--line);
    font-size: .9rem; letter-spacing: .16em; text-transform: uppercase; }

/* ---------- hero ---------- */
.hero { position: relative; min-height: 78vh; display: flex; align-items: flex-end;
    background: var(--ink); overflow: hidden; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-veil { position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(23, 20, 15, .8), rgba(23, 20, 15, .2) 48%, rgba(23, 20, 15, .1)); }
.hero-content { position: relative; color: #fff; padding: 4rem 0 5rem; }
.hero-content .display-1 { color: #fff; }
.hero-content .lede { color: rgba(255, 255, 255, .82); }

/* ---------- hero slider ----------
   The campaign artwork already carries its own headline, so nothing is laid over it.
   The aspect ratio is fixed so the page never jumps as a slide loads. */
.hero-slider { position: relative; background: var(--beige); overflow: hidden;
    touch-action: pan-y; }
.hero-track { display: flex; width: 100%; transition: transform .6s cubic-bezier(.4,0,.2,1); }
.hero-slide { flex: 0 0 100%; }
.hero-slide img { display: block; width: 100%; height: auto; aspect-ratio: 1366 / 768;
    object-fit: cover; object-position: center; }
.hero-nav { position: absolute; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(255,255,255,.82); color: var(--ink); font-size: 1.1rem; line-height: 1;
    display: grid; place-items: center; opacity: 0; transition: opacity .25s, background .2s; }
.hero-slider:hover .hero-nav, .hero-nav:focus-visible { opacity: 1; }
.hero-nav:hover { background: #fff; }
.hero-nav.prev { left: 1rem; }
.hero-nav.next { right: 1rem; }
.hero-dots { position: absolute; left: 0; right: 0; bottom: 1rem;
    display: flex; gap: .5rem; justify-content: center; }
.hero-dots button { width: 9px; height: 9px; padding: 0; border-radius: 50%; cursor: pointer;
    border: 1px solid rgba(23,20,15,.45); background: rgba(255,255,255,.65);
    position: relative; }
/* Drawn at 9px, but a thumb gets the usual 44px to aim at. */
.hero-dots button::after { content: ""; position: absolute; left: 50%; top: 50%;
    width: 44px; height: 44px; transform: translate(-50%, -50%); }
.hero-dots button[aria-selected="true"] { background: var(--ink); border-color: var(--ink);
    width: 22px; border-radius: 6px; }
.hero-say { text-align: center; background: var(--ivory); }
.hero-cta { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap;
    margin-top: 1.5rem; }

@media (prefers-reduced-motion: reduce) {
    .hero-track { transition: none; }
}

/* ---------- sections ---------- */
.section { padding: 5rem 0; }
.section-sm { padding: 3rem 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between;
    gap: 2rem; margin-bottom: 2.5rem; flex-wrap: wrap; }

/* ---------- product grid ---------- */
.grid { display: grid; gap: 2rem; }
.grid-products { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card-product { position: relative; background: transparent; }
.card-product .thumb {
    position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--beige);
    border-radius: var(--radius);
}
.card-product .thumb img { width: 100%; height: 100%; object-fit: cover;
    transition: transform .8s cubic-bezier(.22, 1, .36, 1); }
.card-product:hover .thumb img { transform: scale(1.06); }
.card-product .meta { padding-top: 1rem; }
.card-product .title { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.3; }
.card-product .code { font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--stone); }
.card-product .price { margin-top: .4rem; font-weight: 600; }
.card-product .price small { color: var(--stone); font-weight: 400; }
.tag-pill {
    position: absolute; top: .8rem; left: .8rem; background: var(--emerald); color: #fff;
    font-size: .6rem; letter-spacing: .18em; text-transform: uppercase; padding: .3rem .7rem;
    border-radius: 9999px;
}
.tag-pill.gold { background: var(--gold); }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 1.1rem; }
.field > label, .form-label {
    display: block; font-size: .68rem; letter-spacing: .2em; text-transform: uppercase;
    color: var(--stone); font-weight: 600; margin-bottom: .45rem;
}
.form-input, .form-select, .form-textarea {
    width: 100%; padding: .8rem 1rem; border: 1px solid var(--line); background: #fff;
    border-radius: calc(var(--radius) * .5); font-family: inherit; font-size: .95rem; color: var(--ink);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: 2px solid var(--emerald); outline-offset: 2px; border-color: transparent;
}
.form-textarea { min-height: 7rem; resize: vertical; }
.form-help { font-size: .78rem; color: var(--stone); margin-top: .35rem; }
.form-error { font-size: .8rem; color: #B42318; margin-top: .35rem; }

/* ---------- panels and tables ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th {
    text-align: left; font-size: .66rem; letter-spacing: .18em; text-transform: uppercase;
    color: var(--stone); font-weight: 700; padding: .7rem .6rem; border-bottom: 1px solid var(--line);
}
.table td { padding: .8rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tfoot td { font-weight: 600; border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.alert { padding: .9rem 1.2rem; border-radius: calc(var(--radius) * .5); margin-bottom: 1.5rem; font-size: .92rem; }
.alert-ok { background: color-mix(in srgb, var(--emerald) 12%, #fff); color: var(--emerald);
    border: 1px solid color-mix(in srgb, var(--emerald) 30%, transparent); }
.alert-bad { background: #FEF3F2; color: #B42318; border: 1px solid #FECDCA; }
.alert-info { background: var(--beige); color: var(--ink); border: 1px solid var(--line); }

/* ---------- footer ---------- */
.site-footer { background: var(--emerald); color: rgba(255, 255, 255, .82); padding: 4rem 0 2rem; margin-top: 5rem; }
.site-footer a { color: rgba(255, 255, 255, .82); }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; gap: 2.5rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.footer-head { color: #fff; font-size: .7rem; letter-spacing: .24em; text-transform: uppercase; margin-bottom: 1rem; }
.footer-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; font-size: .9rem; }
.footer-bottom { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid rgba(255, 255, 255, .18);
    display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .8rem; }

/* ---------- price break-up ---------- */
.breakup { width: 100%; border-collapse: collapse; font-size: .9rem; }
.breakup td { padding: .5rem 0; border-bottom: 1px dashed var(--line); }
.breakup td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.breakup tr.total td { border-bottom: 0; border-top: 1px solid var(--ink); font-weight: 700; padding-top: .8rem; }

/* ---------- accessibility ---------- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 2px solid var(--emerald); outline-offset: 3px; border-radius: 4px;
}
.skip-link {
    position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--ivory);
    padding: .75rem 1.25rem; z-index: 100;
}
.skip-link:focus { left: 0; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media (max-width: 640px) {
    .btn { padding: .9rem 1.2rem; letter-spacing: .1em; }
    .eyebrow { letter-spacing: .18em; }
    .section { padding: 3.25rem 0; }
    .grid { gap: 1.25rem; }
    .grid-products { grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
    .panel { padding: 1.25rem; }

    /* Type that was set for a wide screen, brought down to a phone. */
    .display-1 { font-size: clamp(2rem, 9vw, 2.9rem); }
    .display-2 { font-size: clamp(1.6rem, 7.4vw, 2.2rem); }
    .lede { font-size: 1rem; }
    .hero-nav { display: none; }
}

/* Nothing on the storefront scrolls the page sideways either; a wide table
   inside a panel scrolls within it. */
html, body { overflow-x: clip; }
.wrap, .panel, .card { min-width: 0; max-width: 100%; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* On a phone the filter rail is put after the results: a visitor should land on
   the jewellery, not on a column of empty selects. Order is visual only, so the
   tab order and the reading order for a screen reader are unchanged. */
@media (max-width: 900px) {
    .g-sidebar > .shop-filters { order: 2; position: static !important; }
    .g-sidebar > .shop-filters + * { order: 1; }
}

/* A finger is not a mouse. */
@media (pointer: coarse) {
    .btn, .nav a, .icon-btn { min-height: 44px; }
    .icon-btn { min-width: 44px; }
}

/* iOS zooms the page in when a focused field's text is under 16px. */
@media (max-width: 720px) and (pointer: coarse) {
    input, select, textarea { font-size: 16px; }
}

/* ---------- phone and web-view shell ----------
   The app the client wraps this in runs these same pages, so the chrome a phone
   adds - the notch, the home indicator, the double-tap zoom, the grey flash on
   every tap - has to be handled here rather than in the wrapper. */
html { -webkit-text-size-adjust: 100%; }
body { text-rendering: optimizeLegibility; }
* { -webkit-tap-highlight-color: transparent; }

/* Keep content clear of a notch and the home indicator when the page is shown
   full-bleed, which is what display:standalone and a web view both do. */
@supports (padding: max(0px)) {
    .site-header, .topbar { padding-left: max(1rem, env(safe-area-inset-left));
                            padding-right: max(1rem, env(safe-area-inset-right)); }
    .site-footer, .content { padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }
}

/* ---------- bottom tab bar ----------
   The phone's primary navigation, and what makes the site read as an app once it is
   wrapped in a shell. Five destinations, thumb height, with the live bag and wishlist
   counts on the tabs themselves. The header nav takes over from 769px up. */
.bottom-nav {
    display: none;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--ivory); border-top: 1px solid var(--line);
    box-shadow: 0 -2px 18px rgba(23, 20, 15, .08);
    padding-bottom: env(safe-area-inset-bottom);
}
.bn-item {
    flex: 1 1 0; min-width: 0; position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .2rem; padding: .5rem .25rem .55rem; min-height: 58px;
    color: var(--stone); font-size: .62rem; font-weight: 600; letter-spacing: .06em;
    text-transform: uppercase; text-decoration: none; text-align: center;
    -webkit-tap-highlight-color: transparent;
}
.bn-item .bi { font-size: 1.24rem; line-height: 1; }
.bn-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bn-item.active { color: var(--ink); }
.bn-item.active .bi { color: var(--gold-text); }
.bn-item.active::before {
    content: ""; position: absolute; top: -1px; left: 26%; right: 26%; height: 2px;
    background: var(--gold); border-radius: 0 0 2px 2px;
}
.bn-badge {
    position: absolute; top: .36rem; left: 56%; min-width: 16px; height: 16px; padding: 0 .24rem;
    border-radius: 9999px; background: var(--emerald); color: #fff;
    font-size: .58rem; line-height: 16px; text-align: center; letter-spacing: 0;
}

@media (max-width: 768px) {
    .bottom-nav { display: flex; }
    /* The footer, and anything sticky at the foot of a page, clears the bar. */
    body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
    /* The header already carries these; on a phone they are in the bar instead. */
    .header-actions .icon-btn[href$="/wishlist"],
    .header-actions .icon-btn[href$="/cart"],
    .header-actions .icon-btn[href$="/portal"] { display: none; }
}

@media print { .bottom-nav { display: none !important; } }
