/* The Jean Pouch. Palette: raw indigo, mid wash, bleach, topstitch thread, rivet copper. */
:root {
  color-scheme: light;
  --indigo: #16233f;
  --denim: #2f4b7c;
  --wash: #5c7fb0;
  --faded: #c7d3e3;
  --bleach: #eef2f7;
  --paper: #f8fafc;
  --thread: #e0a53a;
  --thread-dark: #a86f10;
  --copper: #b86a34;
  --ink: #131c30;
  --muted: #4b5a75;
  --danger: #a3271f;
  /* Text and surface roles. These are the tokens the dark theme redefines. */
  --heading: #16233f;
  --link: #2f4b7c;
  --surface: #ffffff;
  --field-border: #9fb0c9;
  --solid: #16233f;
  --solid-hover: #2f4b7c;
  --art-bg: #eef2f7;
  --display: "Zilla Slab", "Noto Serif Sinhala", "Noto Serif Tamil", Georgia, "Times New Roman", serif;
  --body: "Figtree", "Noto Sans Sinhala", "Noto Sans Tamil", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 6px;
  --wrap: 1140px;
}

/* Dark theme. Applies when the visitor picks it, or when their device is dark and they have not picked. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --indigo: #131e36; --denim: #24406f; --faded: #283a5e; --bleach: #1a2743; --paper: #0c1424;
    --thread-dark: #e0a53a; --ink: #e6ecf7; --muted: #a5b4cd; --danger: #ff9a8f;
    --heading: #f1f5fb; --link: #a9c1e6; --surface: #152039; --field-border: #40557f;
    --solid: #3d62a0; --solid-hover: #4d74b5; --art-bg: #c7d3e3;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --indigo: #131e36; --denim: #24406f; --faded: #283a5e; --bleach: #1a2743; --paper: #0c1424;
  --thread-dark: #e0a53a; --ink: #e6ecf7; --muted: #a5b4cd; --danger: #ff9a8f;
  --heading: #f1f5fb; --link: #a9c1e6; --surface: #152039; --field-border: #40557f;
  --solid: #3d62a0; --solid-hover: #4d74b5; --art-bg: #c7d3e3;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { margin: 0; font-family: var(--body); font-size: 1.0625rem; line-height: 1.55; color: var(--ink); background: var(--paper); }
img, svg { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); line-height: 1.08; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.75rem); }
h3 { font-size: 1.25rem; line-height: 1.2; }
p { margin: 0 0 1em; max-width: 62ch; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--thread); outline-offset: 3px; border-radius: 3px; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); }
.skip { position: absolute; left: -999px; top: 0; background: var(--thread); color: var(--ink); padding: .6rem 1rem; z-index: 100; }
.skip { color: #131c30; }
.skip:focus { left: 0; }

/* Twill weave: fine diagonal lines over solid colour */
.twill-deep, .twill-mid { color: #fff; background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.045) 0 1px, transparent 1px 5px), repeating-linear-gradient(-45deg, rgba(0,0,0,.08) 0 1px, transparent 1px 7px); }
.twill-deep { background-color: var(--indigo); }
.twill-mid { background-color: var(--denim); }

/* Header */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--paper); border-bottom: 1px solid var(--faded); }
.header-row { display: flex; align-items: center; gap: 1.25rem; min-height: 68px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; margin-right: auto; }
.brand-mark { width: 30px; height: 33px; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 1.4rem; color: var(--heading); }
.site-nav { display: flex; gap: 1.5rem; }
.site-nav a { text-decoration: none; font-weight: 600; font-size: .98rem; color: var(--heading); padding-block: .4rem; border-bottom: 2px dashed transparent; }
.site-nav a:hover { border-bottom-color: var(--thread-dark); }
.nav-toggle { display: none; }
.cart-button, .nav-toggle { font: inherit; font-weight: 600; background: var(--solid); color: #fff; border: 0; border-radius: var(--radius); padding: .55rem .9rem; cursor: pointer; }
.nav-toggle { background: transparent; color: var(--heading); border: 1.5px solid var(--heading); }
.cart-count { display: inline-block; min-width: 1.5em; margin-left: .3rem; padding: 0 .35em; border-radius: 99px; background: var(--thread); color: #131c30; text-align: center; font-size: .85em; }

/* Buttons */
.btn { display: inline-block; font: inherit; font-weight: 700; text-decoration: none; text-align: center; border: 0; border-radius: var(--radius); padding: .85rem 1.4rem; cursor: pointer; transition: transform .12s ease, background-color .12s ease; }
.btn:active { transform: translateY(1px); }
.btn-thread { background: var(--thread); color: #131c30; box-shadow: inset 0 0 0 2px var(--thread), inset 0 0 0 3.5px rgba(19,28,48,.0); outline: 1.5px dashed rgba(19,28,48,.45); outline-offset: -6px; }
.btn-thread:hover { background: #ecb654; }
.btn-thread:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px var(--indigo); }
.btn-ghost { color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.7); }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-plain { background: transparent; color: var(--link); }
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* Hero */
.hero { position: relative; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 2rem; padding-block: clamp(3rem, 7vw, 5.5rem) clamp(4rem, 8vw, 6.5rem); }
.hero h1 { max-width: 13ch; }
.lede { font-size: 1.2rem; color: #d7e0ee; max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 1.8rem; }
.hero-art svg { width: min(100%, 440px); margin-inline: auto; filter: drop-shadow(0 18px 24px rgba(5,10,22,.45)); }
/* Selvedge edge: the white strip with a coloured line found on the inside seam of good denim */
.selvedge { height: 14px; background: linear-gradient(#f4efe6 0 5px, #b3372b 5px 7px, #f4efe6 7px 14px); }
@media (prefers-reduced-motion: no-preference) {
  .hero-art svg > g:first-of-type { animation: tuck .9s cubic-bezier(.2,.8,.2,1) .15s both; }
  @keyframes tuck { from { transform: translateY(-46px) rotate(-7deg); opacity: 0; } }
}

/* Steps */

/* Donate */
.donate-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.donate-intro p { color: #dbe4f1; }
.donate-intro h3 { margin-top: 1.8rem; color: var(--thread); }
.takes li { padding: .45rem 0 .45rem 1.6rem; position: relative; border-bottom: 1px solid rgba(255,255,255,.16); }
.takes li::before { content: ""; position: absolute; left: 0; top: 1.05rem; width: .9rem; border-top: 2px dashed var(--thread); }
.note { font-size: .92rem; color: var(--muted); }
.twill-mid .note { color: #c9d6ea; margin-top: 1rem; }
.dropoffs li { padding: .7rem 0; border-bottom: 1px solid rgba(255,255,255,.16); }
.dropoffs strong { display: block; }
.dropoffs span { font-size: .95rem; color: #dbe4f1; }

.card { background: var(--paper); color: var(--ink); border-radius: 10px; }
.stitched { position: relative; padding: clamp(1.5rem, 3.5vw, 2.5rem); box-shadow: 0 24px 40px -18px rgba(5,10,22,.6); }
.stitched::before { content: ""; position: absolute; inset: 9px; border: 2px dashed var(--thread-dark); border-radius: 6px; pointer-events: none; opacity: .75; }
.donate-form > * + * { margin-top: 1.25rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend, .field { font-weight: 600; font-size: .98rem; }
legend { padding: 0; margin-bottom: .6rem; }
.field { display: block; }
.optional { font-weight: 400; color: var(--muted); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
input[type="text"], input[type="tel"], input[type="number"], select, textarea { display: block; width: 100%; margin-top: .35rem; font: inherit; font-weight: 400; color: var(--ink); background: var(--surface); border: 1.5px solid var(--field-border); border-radius: var(--radius); padding: .65rem .75rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--thread); outline-offset: 1px; border-color: var(--denim); }
textarea { resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips label { cursor: pointer; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chips span { display: inline-block; padding: .5rem .9rem; border: 1.5px solid var(--field-border); border-radius: 99px; background: var(--surface); font-weight: 500; font-size: .95rem; }
.chips input:checked + span { background: var(--denim); border-color: var(--denim); color: #fff; }
.chips input:focus-visible + span { outline: 3px solid var(--thread); outline-offset: 2px; }
.error { display: block; margin: .4rem 0 0; color: var(--danger); font-weight: 600; font-size: .92rem; }
.hp { position: absolute; left: -9999px; }
.form-status { margin: .9rem 0 0; font-weight: 600; }
.form-status:empty { display: none; }

/* Shop */
.shop-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1.25rem; margin-bottom: 2rem; }
.shop-head p { color: var(--muted); margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.filters button { font: inherit; font-weight: 600; font-size: .95rem; padding: .45rem .95rem; border-radius: 99px; border: 1.5px solid var(--link); background: transparent; color: var(--link); cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--solid); border-color: var(--solid); color: #fff; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.5rem; }
.product { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--faded); border-radius: 10px; overflow: hidden; }
.product-art { background: var(--art-bg); padding: 1rem; border-bottom: 2px dashed var(--faded); }
.product-art img { width: 100%; aspect-ratio: 32 / 25; object-fit: cover; }
.product-info { display: flex; flex-direction: column; flex: 1; padding: 1.1rem 1.2rem 1.3rem; }
.product-info h3 { margin-bottom: .3rem; }
.product-info p { color: var(--muted); font-size: .96rem; margin-bottom: 1rem; }
.product-buy { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: auto; }
.price { font-family: var(--display); font-weight: 700; font-size: 1.3rem; color: var(--heading); }
.product-buy .btn { padding: .6rem 1rem; background: var(--solid); color: #fff; }
.product-buy .btn:hover { background: var(--solid-hover); }

/* About */
.about-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.about-grid p { color: #d7e0ee; }
.facts li { display: grid; grid-template-columns: minmax(6.5rem, max-content) 1fr; align-items: baseline; gap: 1rem; padding: 1.1rem 0; border-bottom: 2px dashed rgba(224,165,58,.55); }
.facts li:first-child { border-top: 2px dashed rgba(224,165,58,.55); }
.facts strong { font-family: var(--display); font-size: 2.4rem; line-height: 1; color: var(--thread); }

/* Contact and footer */
.section-tint { background: var(--bleach); }
.contact-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.contact-list { margin-top: 1.75rem; border-top: 2px dashed var(--thread-dark); }
.contact-list li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .1rem 1rem; padding: 1rem 0; border-bottom: 1px solid var(--faded); }
.contact-label { grid-column: 1 / -1; font-size: .88rem; color: var(--muted); }
.contact-list a, .contact-value { font-family: var(--display); font-weight: 600; font-size: 1.25rem; color: var(--heading); overflow-wrap: anywhere; text-decoration: none; min-width: 0; }
.contact-list a:hover { text-decoration: underline dashed var(--thread-dark); text-underline-offset: .3em; }
.copy-btn { font: inherit; font-size: .88rem; font-weight: 600; padding: .35rem .8rem; border-radius: 99px; border: 1.5px solid var(--link); background: transparent; color: var(--link); cursor: pointer; white-space: nowrap; }
.copy-btn:hover { background: var(--surface); }
.contact-intro .note { margin-top: 1.1rem; }
.card-raised { background: var(--surface); border: 1px solid var(--faded); box-shadow: 0 18px 36px -22px rgba(5,10,22,.45); }
.contact-form > * + * { margin-top: 1.25rem; }
/* Footer: selvedge edge, a last invitation to donate, four columns, then the base line */
.site-footer { font-size: .97rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-decoration-style: dashed; text-decoration-color: var(--thread); text-underline-offset: .3em; }
.footer-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.25rem 2rem; padding-block: clamp(2.5rem, 5vw, 3.75rem); border-bottom: 2px dashed rgba(224,165,58,.55); }
.footer-cta h2 { margin: 0 0 .3rem; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.footer-cta p { margin: 0; color: #d7e0ee; }
.footer-cta .btn:hover { text-decoration: none; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.4fr; gap: 2.5rem 2rem; padding-block: clamp(2.5rem, 5vw, 3.5rem); }
.footer-logo { display: inline-flex; align-items: center; gap: .7rem; font-family: var(--display); font-weight: 700; font-size: 1.6rem; color: #fff; margin-bottom: .9rem; }
.footer-logo:hover { text-decoration: none; }
.footer-mark { width: 38px; height: 42px; }
.footer-brand p { color: #c9d6ea; max-width: 32ch; margin: 0; }
.footer-col h3 { font-family: var(--body); font-size: .95rem; font-weight: 700; color: var(--thread); margin-bottom: .9rem; }
.footer-col ul { display: grid; gap: .6rem; }
.footer-col a { color: #e6ecf7; }
.footer-contact li { display: grid; gap: .1rem; }
.footer-contact li > span:first-child { font-size: .85rem; color: #a9bad6; }
.footer-contact a, .footer-hours { color: #fff; font-weight: 600; overflow-wrap: anywhere; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; padding-block: 1.25rem; border-top: 1px solid rgba(255,255,255,.16); font-size: .9rem; color: #c9d6ea; }
.footer-base p { margin: 0; max-width: none; }
.footer-base a { color: #fff; font-weight: 600; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }

/* Cart drawer */
.cart { margin: 0 0 0 auto; height: 100vh; height: 100dvh; max-height: none; width: min(100%, 420px); max-width: none; border: 0; padding: 0; background: var(--paper); color: var(--ink); box-shadow: -20px 0 50px rgba(5,10,22,.35); }
.cart::backdrop { background: rgba(10,18,36,.55); }
.cart[open] { display: flex; flex-direction: column; }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.4rem; background: var(--indigo); color: #fff; border-bottom: 3px dashed var(--thread); }
.cart-head h2 { font-size: 1.5rem; margin: 0; }
.icon-btn { font-size: 1.8rem; line-height: 1; background: transparent; border: 0; color: inherit; cursor: pointer; padding: .1rem .5rem; }
.cart-body { flex: 1; overflow-y: auto; padding: 1.25rem 1.4rem 1.6rem; display: flex; flex-direction: column; gap: 1rem; }
.cart-items li { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; padding: .9rem 0; border-bottom: 1px solid var(--faded); }
.cart-items h3 { font-family: var(--body); font-size: 1rem; font-weight: 600; margin: 0; }
.line-price { font-weight: 700; }
.qty { display: inline-flex; align-items: center; gap: .6rem; }
.qty button { width: 2rem; height: 2rem; border-radius: 50%; border: 1.5px solid var(--link); background: var(--surface); color: var(--link); font: inherit; font-weight: 700; cursor: pointer; }
.remove { background: none; border: 0; font: inherit; font-size: .9rem; color: var(--muted); text-decoration: underline; cursor: pointer; justify-self: end; }
.cart-foot { margin-top: auto; }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 .4rem; max-width: none; font-size: 1.05rem; }
.cart-total strong { font-family: var(--display); font-size: 1.6rem; }
.cart-empty { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%); background: var(--indigo); color: #fff; padding: .8rem 1.2rem; border-radius: var(--radius); border-bottom: 3px dashed var(--thread); font-weight: 600; z-index: 60; opacity: 0; visibility: hidden; transition: transform .25s ease, opacity .25s ease, visibility .25s; max-width: calc(100% - 2rem); }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

@media (max-width: 900px) {
  .hero-grid, .donate-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .hero-art svg { width: min(62%, 280px); }
}
@media (max-width: 1040px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0; background: var(--paper); border-bottom: 1px solid var(--faded); padding: .5rem 1.25rem 1rem; }
  .site-nav.open { display: flex; }
  .site-nav a { padding-block: .8rem; border-bottom: 1px solid var(--faded); }
}
@media (max-width: 560px) {
  .brand-name { font-size: 1.2rem; }
  .header-row { gap: .6rem; }
  .facts strong { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* Splash screen: the bag is sewn together, then the curtain lifts. Pure CSS; total run 3s. */
.splash { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; text-align: center; padding: 1.5rem; animation: splash-lift .65s cubic-bezier(.7,0,.3,1) 2.35s forwards; }
.splash-bag { width: min(50vw, 260px); overflow: visible; }
.splash-name { font-family: var(--display); font-weight: 700; font-size: clamp(1.9rem, 6vw, 2.8rem); margin: 1.4rem 0 .2rem; animation: splash-fade .5s ease 1.3s both; }
.splash-line { color: #c9d6ea; margin: 0; animation: splash-fade .5s ease 1.5s both; }
.splash-body { animation: splash-rise .55s cubic-bezier(.2,.8,.2,1) both; }
.splash-patch { animation: splash-fade .3s ease both; }
.splash-patch.p1 { animation-delay: .35s; } .splash-patch.p2 { animation-delay: .5s; } .splash-patch.p3 { animation-delay: .65s; }
.splash-handle { stroke-dasharray: 1; stroke-dashoffset: 1; animation: splash-draw .6s ease-out .45s forwards; }
.splash-stitch { clip-path: inset(0 100% 0 0); animation: splash-sew .75s linear .85s forwards; }
.splash-tag { transform-box: fill-box; transform-origin: center; animation: splash-pop .35s cubic-bezier(.3,1.6,.5,1) 1.55s both; }
.splash-bag { animation: splash-swing .7s ease-in-out 1.6s; transform-origin: 50% 10%; }
@keyframes splash-rise { from { transform: translateY(26px); opacity: 0; } }
@keyframes splash-fade { from { opacity: 0; } }
@keyframes splash-draw { to { stroke-dashoffset: 0; } }
@keyframes splash-sew { to { clip-path: inset(0); } }
@keyframes splash-pop { from { transform: scale(0); opacity: 0; } }
@keyframes splash-swing { 30% { transform: rotate(4deg); } 65% { transform: rotate(-3deg); } }
@keyframes splash-lift { to { transform: translateY(-100%); visibility: hidden; } }
.no-splash .splash { display: none; }
@media (prefers-reduced-motion: reduce) { .splash { display: none; } }

/* Top bar: language and theme */
.topbar { background: var(--indigo); color: #fff; font-size: .9rem; }
.topbar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem; min-height: 40px; }
.lang-switch { display: flex; gap: .25rem; }
.lang-switch button, .theme-toggle { font: inherit; font-weight: 600; color: #d7e0ee; background: transparent; border: 0; padding: .45rem .6rem; cursor: pointer; border-bottom: 2px dashed transparent; }
.lang-switch button:hover, .theme-toggle:hover { color: #fff; }
.lang-switch button[aria-pressed="true"] { color: #fff; border-bottom-color: var(--thread); }
.theme-toggle { display: inline-flex; align-items: center; gap: .5rem; }
/* Half-filled disc: reads as a light/dark switch without an icon font */
.theme-icon { width: 1em; height: 1em; border-radius: 50%; border: 2px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }

/* Sinhala and Tamil: taller letterforms and longer words need more line height and less display size */
:lang(si) body, :lang(ta) body { line-height: 1.7; }
:lang(si) h1, :lang(si) h2, :lang(si) h3, :lang(ta) h1, :lang(ta) h2, :lang(ta) h3 { line-height: 1.35; letter-spacing: 0; }
:lang(si) h1, :lang(ta) h1 { font-size: clamp(1.9rem, 4.2vw, 3.1rem); }
:lang(si) h2, :lang(ta) h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); }
:lang(si) .hero h1, :lang(ta) .hero h1 { max-width: 20ch; }
:lang(si) .site-nav, :lang(ta) .site-nav { gap: 1.1rem; }
:lang(si) .site-nav a, :lang(ta) .site-nav a { font-size: .92rem; }
.products h3, .steps h3, .btn, .chips span { overflow-wrap: anywhere; }

/* Keep header controls and prices on one line; let the buy row wrap instead when labels are long */
.brand-name, .cart-button, .nav-toggle, .price, .product-buy .btn { white-space: nowrap; }
.product-buy { flex-wrap: wrap; }
.product-buy .btn { flex: 1 0 auto; }
@media (max-width: 560px) {
  .cart-button, .nav-toggle { padding: .5rem .65rem; font-size: .95rem; }
  .brand-mark { width: 24px; height: 27px; }
}

/* ---------- Small screens and touch ---------- */
h1, h2, h3, legend, .field > span { overflow-wrap: anywhere; }
.brand { min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }
.header-row > button { flex-shrink: 0; }

/* Comfortable tap targets (44px) on anything pressable */
.lang-switch button, .theme-toggle, .cart-button, .nav-toggle, .filters button, .copy-btn, .remove, .icon-btn { min-height: 44px; }
.chips span { min-height: 44px; display: inline-flex; align-items: center; }
.qty button, .icon-btn { width: 44px; height: 44px; }
.qty { gap: .75rem; }
.remove { padding-inline: .5rem; }
input[type="text"], input[type="tel"], input[type="number"], select { min-height: 46px; }
.footer-col a, .footer-base a { display: inline-block; padding-block: .35rem; }
.footer-col ul { gap: .25rem; }

/* Room for the phone's home indicator and notch */
.cart-body { padding-bottom: calc(1.6rem + env(safe-area-inset-bottom, 0px)); }
.toast { bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
.site-footer { padding-bottom: env(safe-area-inset-bottom, 0px); }

@media (max-width: 700px) {
  .section { padding-block: 3rem; }
  .hero-grid { gap: 1.5rem; padding-block: 2.5rem 3rem; }
  .hero-actions .btn { flex: 1 1 12rem; }
  .lede { font-size: 1.08rem; }
  .shop-head { flex-direction: column; align-items: stretch; }
  .shop-head > * { min-width: 0; }
  .products { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
  .product-art { padding: .6rem; }
  .product-info { padding: .85rem .85rem 1rem; }
  .product-info h3 { font-size: 1.08rem; }
  .product-info p { font-size: .9rem; }
  .price { font-size: 1.15rem; }
  .product-buy .btn { flex: 1 1 100%; min-width: 0; padding: .65rem .6rem; font-size: .95rem; white-space: normal; }
  .product { min-width: 0; }
  .stitched { padding: 1.6rem 1.35rem; }
  .stitched::before { inset: 6px; }
  .footer-cta .btn { width: 100%; }
  .contact-list a, .contact-value { font-size: 1.1rem; }
}
@media (max-width: 420px) {
  .wrap { width: min(100% - 2rem, var(--wrap)); }
  .topbar-row { flex-wrap: nowrap; }
  .lang-switch button { padding-inline: .45rem; }
  /* Theme switch becomes icon-only; its name stays available to screen readers */
  #theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .theme-icon { width: 1.25em; height: 1.25em; }
  .brand-name { font-size: 1.08rem; }
  .brand { gap: .4rem; }
  .cart-button, .nav-toggle { padding-inline: .55rem; font-size: .9rem; }
  .cart-count { margin-left: .15rem; }
  h1 { font-size: clamp(2rem, 10vw, 2.5rem); }
  :lang(si) h1, :lang(ta) h1 { font-size: clamp(1.6rem, 7.6vw, 1.9rem); }
  .facts strong { font-size: 1.8rem; }
  .facts li { grid-template-columns: minmax(4.5rem, max-content) 1fr; }
}
@media (max-width: 340px) {
  .products { grid-template-columns: 1fr; }
  .brand-mark { display: none; }
}
/* Phones held sideways: keep the sticky header from eating the short screen */
@media (max-height: 480px) and (orientation: landscape) {
  .site-header { position: static; }
  html { scroll-padding-top: 12px; }
}

/* Product pictures keep their shape at any column width */
.product-art img { height: auto; }
.product-info p { overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .products { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
  /* Sinhala and Tamil words run longer: one product per row on phones */
  :lang(si) .products, :lang(ta) .products { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .chips span { border-radius: 22px; }
}
@media (max-width: 420px) {
  .contact-list li { grid-template-columns: 1fr; }
  .copy-btn { justify-self: start; margin-top: .4rem; }
}
@media (max-width: 340px) { .brand-name { font-size: 1rem; } }

/* ---------- Pages: one view per menu item ---------- */
main { min-height: 62vh; }
.site-nav a[aria-current="page"] { border-bottom-color: var(--thread-dark); }
.footer-col a[aria-current="page"] { color: var(--thread); }
.page h2:focus, .hero h1:focus { outline: none; }
.page > .wrap > h2:first-child, .page .shop-head h2, .donate-intro h2, .contact-intro h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
:lang(si) .page h2, :lang(ta) .page h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }
.page-actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--faded); }
.btn-outline { color: var(--heading); box-shadow: inset 0 0 0 1.5px var(--heading); background: transparent; }
.btn-outline:hover { background: var(--surface); }

/* Home: three ways in, then a few products */
.home-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.home-links a { position: relative; display: block; height: 100%; min-height: 10.5rem; padding: 2.25rem 2rem; border-radius: 10px; text-decoration: none; color: #fff; background-color: var(--denim); background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.045) 0 1px, transparent 1px 5px); transition: transform .15s ease; }
.home-links a::before { content: ""; position: absolute; inset: 8px; border: 2px dashed var(--thread); border-radius: 6px; opacity: .7; pointer-events: none; }
.home-links a:hover { transform: translateY(-3px); }
.home-links li:nth-child(2) a { background-color: var(--indigo); }
.home-links li:nth-child(3) a { background-color: var(--wash); }
.home-links h2 { font-size: 1.55rem; margin-bottom: .4rem; }
.home-links p { margin: 0; color: #e6ecf7; }
.shop-head .btn { flex: 0 0 auto; }
@media (max-width: 760px) { .home-links { grid-template-columns: 1fr; } }

/* ---------- How it works page ---------- */
.page-head { max-width: 46rem; }
.page-lede { font-size: 1.2rem; color: var(--muted); }
.page-head .hero-actions { margin-top: 1.5rem; }

/* Timeline: a line of topstitching runs down the left, with a rivet at each step */
.timeline { counter-reset: step; margin-top: clamp(2.5rem, 6vw, 4rem); max-width: 54rem; }
.timeline-step { counter-increment: step; position: relative; display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: start; padding: 0 0 2.75rem 4.25rem; }
.timeline-step::before { content: counter(step); position: absolute; left: 0; top: 0; width: 2.75rem; height: 2.75rem; display: grid; place-items: center; border-radius: 50%; background: var(--copper); color: #fff; font-family: var(--display); font-weight: 700; font-size: 1.2rem; box-shadow: inset 0 0 0 4px #8a4a20; z-index: 1; }
.timeline-step::after { content: ""; position: absolute; left: calc(1.375rem - 1px); top: 2.75rem; bottom: 0; border-left: 2px dashed var(--thread-dark); }
.timeline-step:last-child { padding-bottom: 0; }
.timeline-step:last-child::after { display: none; }
.timeline-body h3 { font-size: 1.6rem; margin: .5rem 0 .4rem; }
.timeline-body p { color: var(--muted); }
.timeline-icon { width: 72px; height: 72px; }
.role { display: inline-block; font-size: .85rem; font-weight: 700; padding: .2rem .7rem; border-radius: 99px; }
.role-you { background: var(--thread); color: #131c30; }
.role-us { background: var(--denim); color: #fff; }
.timeline-body .tip { margin: 0; padding: .8rem 1rem; background: var(--bleach); border-left: 3px solid var(--thread-dark); border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink); font-size: .98rem; }

.parts-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.parts-grid p { color: var(--muted); }
.parts { border-top: 2px dashed var(--thread-dark); }
.parts li { display: grid; grid-template-columns: 11rem 2.5rem 1fr; align-items: center; gap: .75rem; padding: 1rem 0; border-bottom: 1px solid var(--faded); }
.parts strong { font-family: var(--display); font-size: 1.2rem; color: var(--heading); }
.parts-arrow { border-top: 2px dashed var(--thread-dark); position: relative; }
.parts-arrow::after { content: ""; position: absolute; right: -2px; top: -6px; width: 8px; height: 8px; border-top: 2px solid var(--thread-dark); border-right: 2px solid var(--thread-dark); transform: rotate(45deg); }

.prep-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.prep h2, .prep-grid h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.checklist li { position: relative; padding: .7rem 0 .7rem 2.2rem; border-bottom: 1px solid var(--faded); }
.checklist li:last-child { border-bottom: 0; }
.checklist li::before { content: ""; position: absolute; left: .2rem; top: 1rem; width: 1rem; height: .5rem; border-left: 3px solid var(--thread-dark); border-bottom: 3px solid var(--thread-dark); transform: rotate(-45deg); }
.faq { border-top: 2px dashed var(--thread-dark); }
.faq details { border-bottom: 1px solid var(--faded); }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; padding: .75rem 0; cursor: pointer; font-weight: 600; font-size: 1.08rem; color: var(--heading); list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: 0 0 auto; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--link); color: var(--link); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "\2212"; background: var(--solid); border-color: var(--solid); color: #fff; }
.faq details p { color: var(--muted); padding-bottom: 1.1rem; margin: 0; }
.page-cta .footer-cta { border-bottom: 0; }
.page-cta .hero-actions { margin-top: 0; }

@media (max-width: 900px) { .parts-grid, .prep-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .timeline-step { grid-template-columns: 1fr; padding-left: 3.4rem; gap: .5rem; }
  .timeline-icon { display: none; }
  .timeline-step::before { width: 2.4rem; height: 2.4rem; }
  .timeline-step::after { left: calc(1.2rem - 1px); top: 2.4rem; }
  .timeline-body h3 { font-size: 1.35rem; }
  .parts li { grid-template-columns: 1fr; gap: .2rem; }
  .parts-arrow { display: none; }
  .page-cta .hero-actions { width: 100%; }
}

/* ---------- About page ---------- */
.twill-deep .page-lede { color: #d7e0ee; }
.about-grid { align-items: start; }
.facts-title { font-family: var(--body); font-size: .95rem; font-weight: 700; color: var(--thread); margin-bottom: .9rem; }
#about { padding-bottom: 0; }
.selvedge-end { margin-top: clamp(3.5rem, 8vw, 6.5rem); }
.prose p { font-size: 1.15rem; color: var(--ink); }
.prose p:last-child { margin-bottom: 0; }
.values { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; margin-top: 2rem; }
.values li { padding-top: 1.4rem; border-top: 2px dashed var(--thread-dark); }
.values h3 { font-size: 1.45rem; }
.values p { color: var(--muted); margin: 0; }
.join-title { margin-bottom: 1.75rem; }
.home-links h3 { font-size: 1.55rem; margin-bottom: .4rem; }
@media (max-width: 760px) { .values { grid-template-columns: 1fr; gap: 1.5rem; } }
@media (max-width: 700px) { .selvedge-end { margin-top: 3rem; } }
.page-head h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
:lang(si) .page-head h2, :lang(ta) .page-head h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }

/* About: why denim */
.why-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.why-lead { font-family: var(--display); font-weight: 600; font-size: clamp(1.3rem, 2.2vw, 1.65rem); line-height: 1.35; color: var(--heading); margin: 1.25rem 0 0; padding-left: 1.25rem; border-left: 3px dashed var(--thread-dark); max-width: 30ch; }
:lang(si) .why-lead, :lang(ta) .why-lead { font-size: clamp(1.1rem, 1.8vw, 1.3rem); line-height: 1.6; }
.why-list { margin: 0; border-top: 2px dashed var(--thread-dark); }
.why-list > div { padding: 1.4rem 0; border-bottom: 1px solid var(--faded); }
.why-list dt { font-family: var(--display); font-weight: 700; font-size: 1.4rem; color: var(--heading); margin-bottom: .35rem; }
.why-list dd { margin: 0; color: var(--muted); max-width: 52ch; }
@media (max-width: 900px) { .why-grid { grid-template-columns: 1fr; } }

/* ---------- Home: three ways in ---------- */
.start-head { max-width: 40rem; margin-bottom: 2.25rem; }
.start-head p { color: var(--muted); font-size: 1.12rem; margin: 0; }
.start-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.start-card { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--faded); border-radius: 12px; overflow: hidden; box-shadow: 0 18px 34px -24px rgba(5,10,22,.55); transition: transform .18s ease, box-shadow .18s ease; }
.start-card:hover { transform: translateY(-5px); box-shadow: 0 26px 40px -22px rgba(5,10,22,.6); }
.start-card:focus-visible { outline: 3px solid var(--thread); outline-offset: 4px; }
/* Illustration panel: a swatch of denim with a stitched edge and two rivets */
.start-art { position: relative; display: block; padding: 1.75rem 1.5rem 1.25rem; background-color: var(--denim); background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 1px, transparent 1px 5px), repeating-linear-gradient(-45deg, rgba(0,0,0,.08) 0 1px, transparent 1px 7px); border-bottom: 5px solid var(--copper); }
.start-art::before { content: ""; position: absolute; inset: 9px 9px 7px; border: 2px dashed var(--thread); border-radius: 6px; opacity: .8; }
.start-art::after { content: ""; position: absolute; left: 15px; right: 15px; top: 15px; height: 8px; background: radial-gradient(circle at 4px 4px, var(--copper) 0 4px, transparent 4.5px) left / 8px 8px no-repeat, radial-gradient(circle at 4px 4px, var(--copper) 0 4px, transparent 4.5px) right / 8px 8px no-repeat; }
.start-art svg { position: relative; width: min(100%, 230px); margin-inline: auto; filter: drop-shadow(0 10px 10px rgba(5,10,22,.35)); transition: transform .25s ease; }
.start-card:hover .start-art svg { transform: translateY(-4px) rotate(-1.5deg); }
.start-donate .start-art { background-color: #2f4b7c; }
.start-shop .start-art { background-color: #16233f; }
.start-how .start-art { background-color: #5c7fb0; }
.start-body { display: flex; flex-direction: column; flex: 1; gap: .45rem; padding: 1.4rem 1.5rem 1.6rem; }
.start-title { font-family: var(--display); font-weight: 700; font-size: 1.65rem; line-height: 1.15; color: var(--heading); }
:lang(si) .start-title, :lang(ta) .start-title { font-size: 1.35rem; line-height: 1.4; }
.start-text { color: var(--muted); }
.start-cta { margin-top: auto; align-self: flex-start; padding: .65rem 1.1rem; }
.start-body .start-text { margin-bottom: 1rem; }
@media (max-width: 900px) { .start-cards { grid-template-columns: 1fr; max-width: 30rem; } }
@media (max-width: 700px) { .start-cta { align-self: stretch; } }
