/*
Theme Name: Handstitched
Theme URI: https://handstitched.co.za/
Author: Handstitched.co.za
Description: Custom theme for Anton van Rensburg's leatherwork site. Hats, Gallery and FAQs are edited from their own screens in the WordPress admin; hero, contact and footer text live under Appearance → Customize → Handstitched.
Version: 1.0.2
Requires at least: 6.2
Requires PHP: 7.4
Text Domain: handstitched
*/

/* Layout: a bottle-green hero band (the colour of the cutting mat and the Celtic bracer) opens on the coral-lined top hat; the page below is pale celadon paper where Anton's warm leathers stand out. Coral, from that hat's lining, is the one accent. */
:root {
  --paper: #e9eae5;      /* pale grey-green paper */
  --paper-2: #dfe1db;
  --rule: #c8ccc4;
  --ink: #1f2623;        /* soft green-black */
  --muted: #5c6560;
  --bottle: #2d3a33;     /* muted bottle green, stays dark in both themes */
  --bottle-ink: #eef0ec;
  --bottle-muted: #b2bbb5;
  --coral: #d9543b;      /* hat lining */
  --coral-ink: #b8402a;  /* coral for text on paper */
  --on-coral: #fff6f2;
  --display: "Libre Caslon Display", "Big Caslon", "Times New Roman", serif;
  --mark: "EB Garamond", Garamond, "Times New Roman", serif;
  --body: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151917; --paper-2: #1c211e; --rule: #2f3632; --ink: #e8eae6; --muted: #a3aaa5;
    --bottle: #222c27; --bottle-ink: #eef0ec; --bottle-muted: #a9b2ac;
    --coral: #ec6a50; --coral-ink: #f08a73; --on-coral: #1c0c08; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151917; --paper-2: #1c211e; --rule: #2f3632; --ink: #e8eae6; --muted: #a3aaa5;
  --bottle: #222c27; --bottle-ink: #eef0ec; --bottle-muted: #a9b2ac;
  --coral: #ec6a50; --coral-ink: #f08a73; --on-coral: #1c0c08; color-scheme: dark;
}

* { box-sizing: border-box; }
body { background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bottle); }
a { color: inherit; }
img { display: block; width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
.wrap { max-width: 1240px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
p { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; text-wrap: balance; line-height: 1.04; }
h1 { font-size: clamp(2.7rem, 6.2vw, 5.4rem); letter-spacing: -.015em; }
h2 { font-size: clamp(2.1rem, 4.4vw, 3.6rem); letter-spacing: -.01em; }
h3 { font-size: clamp(1.5rem, 2.2vw, 1.9rem); line-height: 1.12; }
.label { font: 500 .72rem var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--coral-ink); }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 33em; }

.btn { display: inline-flex; align-items: center; gap: .5em; padding: .85em 1.35em; border-radius: 999px; font: 600 .92rem var(--body); text-decoration: none; border: 1.5px solid transparent; cursor: pointer; transition: transform .15s ease; }
.btn.coral { background: var(--coral); color: var(--on-coral); }
.btn.line { border-color: currentColor; }
.btn:hover { transform: translateY(-1px); }

/* header + hero share the bottle band */
.band { background: var(--bottle); color: var(--bottle-ink); }
header.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bottle); color: var(--bottle-ink); border-bottom: 1px solid rgba(255,255,255,.08); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-block: 14px; }
.mark { text-decoration: none; display: grid; justify-items: center; line-height: 1; }
.mark b { font: 400 1.2rem var(--mark); letter-spacing: .3em; margin-right: -.3em; }
.mark span { font: .68rem var(--mark); letter-spacing: .42em; margin-top: 4px; opacity: .7; }
nav { display: flex; gap: 24px; align-items: center; }
nav a:not(.btn) { text-decoration: none; font-size: .9rem; color: var(--bottle-muted); }
nav a:not(.btn):hover { color: var(--bottle-ink); }
nav .btn { padding: .55em 1.1em; font-size: .85rem; }
@media (max-width: 780px) { nav a:not(.btn) { display: none; } }

.hero .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 72px); align-items: center; padding-block: 56px 72px; }
.hero-copy { display: grid; gap: 26px; min-width: 0; }
.hero-copy .label { color: var(--coral); }
.hero-copy .lede { color: var(--bottle-muted); }
.hero-copy h1 em { font-style: italic; color: var(--coral); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-img { position: relative; min-width: 0; }
.hero-img .main { border-radius: 4px; overflow: hidden; aspect-ratio: 4 / 5; }
.hero-img .main img { height: 100%; object-fit: cover; object-position: 50% 20%; }

/* hat sizing */
.sizing { margin-top: 88px; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: start; }
.sizing > div { display: grid; gap: 18px; min-width: 0; }
.sizing p { color: var(--muted); max-width: 32em; }
.measure { list-style: none; padding: 0; margin: 0; display: grid; counter-reset: m; }
.measure li { counter-increment: m; display: grid; grid-template-columns: 40px 1fr; gap: 2px 12px; padding: 14px 0; border-top: 1px solid var(--rule); }
.measure li::before { content: counter(m); grid-row: span 2; font: 1.7rem/1 var(--display); color: var(--coral-ink); }
.measure b { font-weight: 600; }
.measure span { color: var(--muted); font-size: .95rem; }
.size-card { background: var(--paper-2); border-radius: 6px; padding: clamp(20px, 3vw, 32px); display: grid; gap: 20px; }
.size-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.size-table th, .size-table td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--rule); }
.size-table th { font: 500 .7rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.size-table td:first-child { font: 400 1.25rem var(--display); }
.size-table td:nth-child(2) { font: 500 1rem var(--mono); }
.size-table td:last-child { color: var(--muted); font-size: .9rem; }
.size-table tr.on td { background: color-mix(in srgb, var(--coral) 14%, transparent); }
.finder { display: grid; gap: 8px; }
.finder label { color: var(--muted); }
.finder .row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.finder input { width: 7.5em; font: 500 1.1rem var(--mono); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 4px; padding: 10px 12px; }
.finder output { font-size: .95rem; }
.finder output b { color: var(--coral-ink); font-weight: 600; }
@media (max-width: 860px) { .sizing { grid-template-columns: 1fr; } }
.hero-img .inset { position: absolute; width: 38%; left: -9%; bottom: -8%; border-radius: 4px; overflow: hidden; border: 6px solid var(--bottle); aspect-ratio: 3 / 4; }
.hero-img .inset img { height: 100%; object-fit: cover; }
.hero-img figcaption { position: absolute; right: 0; bottom: -34px; font: .74rem var(--mono); color: var(--bottle-muted); }
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; padding-block: 40px 80px; }
  .hero-img { max-width: 540px; margin-left: auto; width: 92%; }
  .hero-img .inset { left: -8%; }
}

section { padding-block: 96px; }
@media (max-width: 760px) { section { padding-block: 64px; } }
.sec-head { display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: end; margin-bottom: 52px; }
.sec-head > div { display: grid; gap: 14px; min-width: 0; }
.sec-head p { color: var(--muted); max-width: 32em; }
@media (max-width: 760px) { .sec-head { grid-template-columns: 1fr; margin-bottom: 36px; } }

/* hats */
.hats { display: grid; gap: 80px; }
.hat { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
.hat:nth-child(even) { grid-template-columns: 1fr 1.25fr; }
.hat:nth-child(even) .shots { order: 2; }
.shots { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; min-width: 0; }
.shots button { padding: 0; border: 0; background: var(--paper-2); border-radius: 3px; overflow: hidden; cursor: zoom-in; display: block; }
.shots button img { height: 100%; object-fit: cover; transition: transform .5s ease; }
.shots button:hover img { transform: scale(1.03); }
.shots .big { grid-row: span 2; aspect-ratio: 3 / 4; }
.shots .small { aspect-ratio: 1; }
.shots.single { grid-template-columns: 1fr; }
.hat-copy { display: grid; gap: 16px; min-width: 0; }
.hat-copy p { color: var(--muted); max-width: 30em; }
.hat-copy ul { list-style: none; padding: 0; margin: 4px 0 0; display: grid; border-top: 1px solid var(--rule); }
.hat-copy li { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--rule); font-size: .95rem; }
.hat-copy li span:first-child { font: .72rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.hat-copy li span:last-child { text-align: right; }
.num { font-family: var(--display); font-size: 1rem; color: var(--coral-ink); }
@media (max-width: 860px) {
  .hat, .hat:nth-child(even) { grid-template-columns: 1fr; }
  .hat:nth-child(even) .shots { order: 0; }
  .hats { gap: 64px; }
}
.hat-cta { margin-top: 72px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 28px clamp(20px, 4vw, 40px); background: var(--paper-2); border-radius: 6px; }
.hat-cta p { font-family: var(--display); font-size: clamp(1.4rem, 2.4vw, 1.9rem); line-height: 1.2; max-width: 26em; }

/* custom work gallery */
.custom { background: var(--paper-2); }
.gallery { columns: 3 280px; column-gap: 18px; }
.gallery figure { break-inside: avoid; margin: 0 0 18px; display: grid; gap: 10px; }
.gallery button { padding: 0; border: 0; background: none; border-radius: 3px; overflow: hidden; cursor: zoom-in; display: block; width: 100%; }
.gallery button img { transition: transform .5s ease; }
.gallery button:hover img { transform: scale(1.03); }
.gallery figcaption { display: grid; gap: 2px; padding-bottom: 8px; }
.gallery figcaption b { font: 400 1.2rem var(--display); }
.gallery figcaption span { font-size: .9rem; color: var(--muted); }

/* bench + commission */
.comm { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 72px); align-items: start; }
.comm-copy { display: grid; gap: 22px; min-width: 0; }
.ideas { display: flex; flex-wrap: wrap; gap: 8px; }
.ideas span { font: .74rem var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 7px 13px; border: 1px solid var(--rule); border-radius: 999px; }
.ideas span.hot { background: var(--coral); border-color: var(--coral); color: var(--on-coral); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 48px 1fr; gap: 2px 14px; padding: 16px 0; border-top: 1px solid var(--rule); }
.steps li::before { content: counter(s); grid-row: span 2; font: 2rem/1 var(--display); color: var(--coral-ink); }
.steps b { font-weight: 600; }
.steps span { color: var(--muted); font-size: .95rem; }
.bench { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.bench img { aspect-ratio: 4 / 5; object-fit: cover; border-radius: 3px; }

form { background: var(--bottle); color: var(--bottle-ink); padding: clamp(22px, 4vw, 40px); border-radius: 6px; display: grid; gap: 18px; min-width: 0; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 84px); }
form h3 { color: var(--bottle-ink); }
.field { display: grid; gap: 6px; min-width: 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
label { font: .7rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--bottle-muted); }
input, select, textarea { width: 100%; font: 1rem var(--body); color: var(--bottle-ink); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16); border-radius: 4px; padding: 12px 14px; color-scheme: dark; }
textarea { min-height: 120px; resize: vertical; }
.sent { padding: 14px 16px; border: 1px solid var(--coral); border-radius: 4px; font-size: .92rem; }
.wa { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); font-size: .9rem; color: var(--bottle-muted); }
.wa .phone { font: 500 1.05rem var(--mono); color: var(--bottle-ink); user-select: all; }
.linkbtn { background: none; border: 0; padding: 0; font: 600 .88rem var(--body); color: var(--coral); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 900px) { .comm { grid-template-columns: 1fr; } form { position: static; } }

/* shop strip */
.shop { border-top: 1px solid var(--rule); }
.shop-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
.shop-grid > img { aspect-ratio: 4 / 5; object-fit: cover; border-radius: 3px; max-width: 420px; }
.shop-copy { display: grid; gap: 18px; min-width: 0; }
.faq { border-top: 1px solid var(--rule); }
.faq-list { display: grid; border-top: 1px solid var(--rule); max-width: 820px; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; padding: 20px 0; font: 400 clamp(1.15rem, 2vw, 1.4rem)/1.3 var(--display); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 1.5rem/1 var(--body); color: var(--coral-ink); transition: transform .2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); padding: 0 0 22px; max-width: 40em; }
.price-list { list-style: none; padding: 0; margin: 0; display: grid; border-top: 1px solid var(--rule); }
.price-list a { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); text-decoration: none; }
.price-list a:hover b { color: var(--coral-ink); }
.price-list b { font-weight: 500; }
.price-list small { display: block; color: var(--muted); font-size: .86rem; }
.price-list .p { font: 500 .9rem var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 2px; }
@media (max-width: 760px) { .shop-grid { grid-template-columns: 1fr; } .shop-grid > img { max-width: 100%; aspect-ratio: 16 / 10; } }

/* maker */
.maker .wrap { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(32px, 5vw, 72px); align-items: center; }
.maker img { aspect-ratio: 4 / 5; object-fit: cover; border-radius: 3px; }
.maker-copy { display: grid; gap: 18px; min-width: 0; max-width: 38em; }
.maker-copy blockquote { margin: 0; font: italic 400 clamp(1.6rem, 3vw, 2.4rem)/1.2 var(--mark); text-wrap: balance; }
.maker-copy p { color: var(--muted); }
.maker-copy strong { color: var(--ink); font-weight: 500; }
@media (max-width: 860px) { .maker .wrap { grid-template-columns: 1fr; } .maker img { max-width: 420px; } }

footer.band .wrap { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 32px; padding-block: 56px 28px; }
footer.band .wrap > div { display: grid; gap: 8px; align-content: start; min-width: 0; }
footer.band p { color: var(--bottle-muted); font-size: .95rem; }
footer.band .label { color: var(--coral); }
footer.band .base { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.1); font-size: .82rem; color: var(--bottle-muted); }
@media (max-width: 760px) { footer.band .wrap { grid-template-columns: 1fr; } }

/* lightbox */
dialog { border: 0; padding: 0; background: transparent; max-width: min(92vw, 1100px); max-height: 92vh; }
dialog::backdrop { background: rgba(8, 16, 12, .88); }
dialog img { max-height: 84vh; width: auto; max-width: 100%; margin: 0 auto; border-radius: 3px; }
dialog p { color: #edf1ea; text-align: center; margin-top: 10px; font-size: .9rem; }
dialog button { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 16px); right: calc(env(safe-area-inset-right, 0px) + 16px); background: #edf1ea; color: #15261e; border: 0; border-radius: 999px; padding: 8px 16px; font: 600 .85rem var(--body); cursor: pointer; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* multi-page additions */
.crumbs { font: .74rem var(--mono); letter-spacing: .08em; color: var(--bottle-muted); display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs a { color: var(--bottle-muted); }
.page-hero .wrap { display: grid; grid-template-columns: 1.2fr .8fr; gap: clamp(28px, 5vw, 64px); align-items: center; padding-block: 40px 64px; }
.page-hero .copy { display: grid; gap: 20px; min-width: 0; }
.page-hero .copy .label { color: var(--coral); }
.page-hero .copy .lede { color: var(--bottle-muted); }
.page-hero h1 { font-size: clamp(2.4rem, 5.2vw, 4.4rem); }
.page-hero img { aspect-ratio: 4 / 5; object-fit: cover; border-radius: 4px; max-height: 520px; }
@media (max-width: 860px) { .page-hero .wrap { grid-template-columns: 1fr; } .page-hero img { max-width: 420px; } }
.prose { max-width: 42em; display: grid; gap: 18px; }
.prose p, .prose li { color: var(--muted); }
.prose h2 { margin-top: 18px; }
.prose ul { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
.more { display: inline-flex; gap: .4em; font-weight: 600; color: var(--coral-ink); text-decoration: none; }
.more:hover { text-decoration: underline; text-underline-offset: 4px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.card { background: var(--paper-2); border-radius: 6px; padding: 24px; display: grid; gap: 10px; align-content: start; text-decoration: none; }
.card b { font: 400 1.35rem var(--display); }
.card span { color: var(--muted); font-size: .95rem; }
.card:hover b { color: var(--coral-ink); }
.custom .card { background: var(--paper); }
nav a[aria-current="page"] { color: var(--bottle-ink) !important; text-decoration: underline; text-underline-offset: 6px; text-decoration-color: var(--coral); }

/* WordPress additions */
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.prose img { border-radius: 4px; height: auto; }
.prose > * { margin: 0; }
.prose a { color: var(--coral-ink); }
.empty-note { color: var(--muted); font-style: italic; }
.admin-bar header.top { top: calc(env(safe-area-inset-top, 0px) + 32px); }
@media (max-width: 782px) { .admin-bar header.top { top: calc(env(safe-area-inset-top, 0px) + 46px); } }
@media (max-width: 600px) { .admin-bar header.top { top: env(safe-area-inset-top, 0px); } }
/* Hats with a single photo: show the whole picture, uncropped */
.shots.single .big { grid-row: auto; aspect-ratio: auto; }
.shots.single .big img { height: auto; }

/* Commission tags are buttons that fill in the form */
.ideas .tag { font: .74rem var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 7px 13px; border: 1px solid var(--rule); border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease; }
.ideas .tag:hover { border-color: var(--coral); color: var(--coral-ink); transform: translateY(-1px); }
.ideas .tag[aria-pressed="true"], .ideas .tag[aria-pressed="true"]:hover { background: var(--coral); border-color: var(--coral); color: var(--on-coral); }
.ideas .tag:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
.ideas-hint { font-size: .85rem; color: var(--muted); margin-top: -10px; }
@media (prefers-reduced-motion: reduce) { .ideas .tag { transition: none; } }
