/* DMM Carpentry: plain CSS, no frameworks */
:root {
  /* Colors from the old dmmcarpentry.com (2019-2025), tuned for WCAG AA contrast.
     Contrast check: dmmcarpentry-tools/contrast.py */
  --rust: #7f3f00;          /* old background fade, left */
  --fade-gray: #555555;     /* old fade right was #666666, darkened for white text */
  --bg: linear-gradient(90deg, var(--rust), var(--fade-gray));
  --bg-alt: rgba(0,0,0,.2); /* darker band laid over the fade */
  --ink: #ffffff;
  --muted: #f2efd9;         /* very light tan */
  --gold: #daa520;          /* old title color */
  --gold-light: #f0c850;    /* goldenrod, lightened for headings on the fade */
  --tan: #cdc893;           /* old tagline color */
  --olive: #6f992c;
  --olive-panel: #4d6b1c;   /* old green panel, darkened for white text */
  --green: #8bc64f;         /* old Services button */
  --deep-blue: #125ca6;     /* old Read More button / blue panel */
  --mid-blue: #348bcf;
  --blue: #2473c1;
  --link: #9fd0ff;          /* light blue for links on the dark fade */
  --line: #b2b2b2;          /* old borders */
  --header-bg: linear-gradient(90deg, rgba(63,31,0,.97), rgba(51,51,51,.97));
  --footer-bg: linear-gradient(90deg, #2b1500, #2b2b2b);
  --wood: var(--deep-blue);
  --wood-2: var(--blue);
  --accent: var(--gold);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.2), 0 6px 18px rgba(0,0,0,.25);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --header-h: 64px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body { margin: 0; background: var(--rust); background-image: var(--bg); color: var(--ink); font: 400 1.0625rem/1.65 var(--font); overflow-x: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); }
a:hover { color: #ffffff; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); color: var(--gold-light); line-height: 1.2; margin: 0 0 .5em; font-weight: 700; }
h2 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.4rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.wrap { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
.narrow > p { max-width: 68ch; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 1rem; top: -100px; background: var(--deep-blue); color: #fff; padding: .6rem 1rem; border-radius: 6px; z-index: 100; }
.skip-link:focus { top: .75rem; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: #3f1f00; background-image: var(--header-bg); border-bottom: 1px solid var(--line); backdrop-filter: saturate(1.2) blur(6px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: var(--header-h); flex-wrap: wrap; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.4rem; color: var(--gold); text-decoration: none; letter-spacing: .02em; }
.brand span { color: var(--tan); font-weight: 400; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem .5rem; }
.site-nav a { display: block; padding: .5rem .7rem; text-decoration: none; color: #ffffff; font-weight: 600; font-size: .98rem; border-radius: 6px; }
.site-nav a:hover { background: rgba(255,255,255,.14); color: #ffffff; }
.site-nav .nav-cta { background: var(--deep-blue); color: #fff; }
.site-nav .nav-cta:hover { background: var(--blue); color: #fff; }
.nav-toggle { display: none; }

@media (max-width: 760px) {
  .js .nav-toggle { display: inline-flex; align-items: center; gap: .5rem; background: none; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; font: 600 .95rem var(--font); color: #ffffff; cursor: pointer; min-height: 44px; }
  .nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 18px; height: 2px; background: currentColor; position: relative; content: ""; }
  .nav-toggle-bars::before { position: absolute; top: -6px; }
  .nav-toggle-bars::after { position: absolute; top: 6px; }
  .js .site-nav { display: none; width: 100%; padding-bottom: .75rem; }
  .js .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: .15rem; }
  .js .site-nav a { padding: .75rem .5rem; font-size: 1.05rem; }
  html:not(.js) .header-inner { padding-block: .5rem; }
  html:not(.js) .site-nav ul { flex-direction: row; }
}

/* Hero */
.hero { position: relative; min-height: clamp(520px, 86vh, 820px); display: flex; align-items: flex-end; color: #fff; overflow: hidden; background: #2b1500; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }
/* No shade over the photo: it stays clear down to Services. Text sits on a small dark panel instead
   (rust #2b1500 at 85%), so it reads even where the photo is white. Checked by contrast.py. */
.hero-content { position: relative; padding-block: 2rem 1.5rem; display: flex; justify-content: center; }
.hero-panel { background: rgba(43,21,0,.85); border-radius: 14px; padding: 1rem 1.5rem 1.15rem; text-align: center; max-width: 32rem; box-shadow: 0 4px 18px rgba(0,0,0,.35); }
.hero h1 { color: var(--gold); font-size: clamp(2.3rem, 1.6rem + 3vw, 3.6rem); margin-bottom: .15em; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .82rem; font-weight: 700; color: var(--muted); margin-bottom: .35rem; }
.tagline { font-size: clamp(1.05rem, 1rem + .4vw, 1.25rem); max-width: 34ch; margin-inline: auto; color: var(--tan); }
.hero .hero-actions { justify-content: center; margin-top: 1rem; }
/* Phones: the whole photo shows on top (both columns and the window), text panel right below it. */
@media (max-width: 700px) {
  .hero { display: block; min-height: 0; }
  .hero-img { position: static; display: block; height: auto; aspect-ratio: 4 / 3.2; object-position: 50% 45%; }
  .hero-content { padding-block: 0 1.5rem; margin-top: -1.75rem; }
  .hero-panel { padding: 1rem 1.1rem 1.2rem; width: 100%; }
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: .75rem 1.4rem; border-radius: 999px; font-weight: 700; font-size: 1.02rem; text-decoration: none; border: 2px solid transparent; transition: background .15s, color .15s, border-color .15s; }
.btn-primary { background: var(--deep-blue); color: #fff; }
.btn-primary:hover { background: #0e4a87; color: #fff; }
.btn-ghost { color: #fff; border-color: rgba(255,255,255,.8); }
.btn-ghost:hover { background: rgba(255,255,255,.15); color: #fff; }
.btn-outline { color: #fff; border-color: #fff; }
.btn-outline:hover { background: #fff; color: var(--deep-blue); }

/* Sections */
.section { padding-block: clamp(3rem, 2rem + 4vw, 5rem); }
.section-alt { background: var(--bg-alt); }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 60ch; margin-bottom: 2rem; }

.services { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.services li { background: var(--olive-panel); border: 1px solid var(--olive); border-top: 4px solid var(--green); border-radius: var(--radius); padding: 1.25rem 1.35rem; box-shadow: var(--shadow); }
.services li:nth-child(even) { background: var(--deep-blue); border-color: var(--mid-blue); }
.services h3 { color: #ffffff; }
.services p { margin: 0; color: #ffffff; }

/* Facebook feed (Page Plugin) beside Services on computers, under it on phones */
.services-layout { display: grid; gap: 2rem; }
@media (min-width: 1000px) {
  .services-layout { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); align-items: start; }
}
/* Wide screens: feed column fits Facebook's 500px maximum (500 + box padding and border) */
@media (min-width: 1180px) {
  .services-layout { grid-template-columns: minmax(0, 1fr) 538px; }
}
@media (min-width: 1000px) {
  .services-layout .services { grid-template-columns: repeat(2, 1fr); }
  .fb-feed { position: sticky; top: calc(var(--header-h) + 1rem); }
}
.fb-feed { min-width: 0; background: rgba(0,0,0,.25); border: 1px solid rgba(178,178,178,.45); border-top: 4px solid var(--gold); border-radius: var(--radius); padding: 1.1rem 1.1rem 1.25rem; box-shadow: var(--shadow); }
.fb-feed h3 { color: var(--gold-light); margin-bottom: .25rem; }
.fb-feed-note { color: var(--muted); font-size: .95rem; margin-bottom: .85rem; }
.fb-frame { position: relative; background: #ffffff; border-radius: 8px; overflow: hidden; min-height: 200px; max-width: 500px; }
/* "Scroll for more" hint: short fade + small arrow at the bottom of the feed. Drawn on our side of
   Facebook's frame; pointer-events: none so scrolling and tapping inside the feed still work. */
.fb-frame::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 48px; pointer-events: none; z-index: 2;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,.92)); }
.fb-frame::before { content: ""; position: absolute; left: 50%; bottom: 14px; width: 12px; height: 12px; margin-left: -6px; pointer-events: none; z-index: 3;
  border-right: 3px solid var(--deep-blue); border-bottom: 3px solid var(--deep-blue); transform: rotate(45deg); opacity: .8;
  animation: fb-nudge 1.8s ease-in-out infinite; }
@keyframes fb-nudge { 0%, 100% { transform: translateY(0) rotate(45deg); } 50% { transform: translateY(4px) rotate(45deg); } }
@media (prefers-reduced-motion: reduce) { .fb-frame::before { animation: none; } }
.fb-frame .fb-page, .fb-frame .fb-page > span, .fb-frame iframe { width: 100% !important; max-width: 100%; }
.fb-frame blockquote { margin: 0; padding: 1rem; }
.fb-frame blockquote a { color: var(--deep-blue); font-weight: 700; }
.fb-more { margin: 1rem 0 0; }
/* Phones: thinner box padding so the feed gets more of the screen width */
@media (max-width: 560px) { .fb-feed { padding: .9rem .6rem 1rem; } .fb-feed h3, .fb-feed-note { padding-inline: .4rem; } }
.fb-more .btn { width: 100%; }

/* Gallery */
.gallery { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
@media (max-width: 560px) { .gallery { grid-template-columns: 1fr 1fr; gap: .5rem; } }
.gallery a { display: block; border-radius: 8px; overflow: hidden; background: var(--line); aspect-ratio: 4 / 3; box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.gallery a:hover img, .gallery a:focus-visible img { transform: scale(1.04); }
/* Exactly 5 photos: first photo is a large feature tile, the other 4 sit in a 2x2 block
   beside it (desktop) or below it (phone), so no row is left with a single photo. */
.gallery:has(> li:first-child:nth-last-child(5)) { grid-template-columns: repeat(4, 1fr); }
.gallery > li:first-child:nth-last-child(5) { grid-column: span 2; grid-row: span 2; }
.gallery > li:first-child:nth-last-child(5) a { height: 100%; }
@media (max-width: 560px) {
  .gallery:has(> li:first-child:nth-last-child(5)) { grid-template-columns: 1fr 1fr; }
  .gallery > li:first-child:nth-last-child(5) { grid-row: auto; }
  .gallery > li:first-child:nth-last-child(5) a { height: auto; }
}
/* Exactly 6 photos: 3 across on computers (2 even rows), 2 across on phones (3 rows). */
.gallery:has(> li:first-child:nth-last-child(6)) { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) { .gallery:has(> li:first-child:nth-last-child(6)) { grid-template-columns: 1fr 1fr; } }

/* Exactly 21 photos (Oct 26): 11 doors first, then trim, kitchen/bathroom last.
   Big tiles: front-door trio (9-11) = "trio-main" big door + two "trio-stack" photos stacked in one column
   on its right; "tall" (2 rows) = octagon ceiling (14) + coffered ceiling (15), a matched pair side by side, and the
   hallway arch (16) beside its other-side photo (17), with the keystone opening (18) under 17; the shop photo (last)
   is "wide". Dense flow places everything in order with no holes (every row is full).
   Computers: 4 across = 28 cells, 7 full rows. Rows 3-4: big door cols 1-2, stacked pair col 3 (pinned), 12-13 col 4.
   Rows 5-6: octagon c1, coffered c2, hallway arch c3, other-side arch c4 (row 5) with the keystone opening below it.
   Row 7: kitchen pair + the wide photo.
   Phones and tablets: 2 across = 26 cells, 13 full rows. Big door double height on the left with the pair beside it;
   12+13; octagon + coffered side by side (both double height); hallway arch double height with 17 and 18 stacked
   beside it; the kitchen pair; the wide photo. Keep these positions if photos are added or moved. */
.gallery li.wide { grid-column: span 2; }
.gallery li.wide a { aspect-ratio: auto; height: 100%; }
.gallery li.tall { grid-row: span 2; }
.gallery li.tall a { aspect-ratio: auto; height: 100%; }
.gallery li.feature { grid-column: span 2; }
.gallery li.feature a { aspect-ratio: auto; height: 100%; }
.gallery li.trio-main { grid-column: span 2; grid-row: span 2; }
.gallery li.trio-main a { aspect-ratio: auto; height: 100%; }
/* spanning tiles take their size from the grid (rows set by the normal 4:3 tiles), not from the image's own size */
.gallery li.wide a, .gallery li.tall a, .gallery li.feature a, .gallery li.trio-main a { position: relative; }
.gallery li.wide img, .gallery li.tall img, .gallery li.feature img, .gallery li.trio-main img { position: absolute; inset: 0; }
.gallery:has(> li:first-child:nth-last-child(21)) { grid-template-columns: repeat(4, 1fr); grid-auto-flow: row dense; }
.gallery:has(> li:first-child:nth-last-child(21)) li.trio-stack { grid-column: 3; }
@media (max-width: 900px) {
  .gallery:has(> li:first-child:nth-last-child(21)) { grid-template-columns: 1fr 1fr; }
  .gallery:has(> li:first-child:nth-last-child(21)) li.trio-stack { grid-column: auto; }
  .gallery li.trio-main { grid-column: auto; }
  .gallery li.wide a { aspect-ratio: 8 / 3; height: auto; }
  .gallery li.feature a { aspect-ratio: 4 / 3; height: auto; }
  /* two tall tiles side by side (ceiling pair) have no normal tile to size their rows: give tall tiles their own
     height = two 4:3 rows + the gap (padding % is measured from the tile's width) */
  .gallery li.tall a::before { content: ""; display: block; padding-top: calc(150% + .75rem); }
}
@media (max-width: 560px) { .gallery li.tall a::before { padding-top: calc(150% + .5rem); } }

/* Short note under the gallery about the kitchen photos (last two) */
.kitchen-note { margin-top: 1.25rem; max-width: 60ch; padding: 1rem 1.25rem; border-left: 4px solid var(--gold-light); background: rgba(0,0,0,.25); border-radius: 0 var(--radius) var(--radius) 0; }
.kitchen-note h3 { color: var(--gold-light); margin-bottom: .35rem; }
.kitchen-note p { margin: 0; color: #ffffff; }

/* About / area / contact */
.text-link { font-weight: 700; }
.contact { background: var(--deep-blue); background-image: linear-gradient(90deg, #0f4c8a, var(--deep-blue)); color: #ffffff; }
.contact h2 { color: #fff; }
.contact-email { font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem); font-weight: 700; overflow-wrap: anywhere; }
.contact-email a { color: #fff; }
.contact .btn-outline { color: #fff; border-color: rgba(255,255,255,.85); }
.contact .btn-primary { background: var(--green); color: #000; }
.contact .btn-primary:hover { background: #a3d872; color: #000; }
.contact .btn-outline:hover { background: #fff; color: var(--deep-blue); }
.contact a:focus-visible { outline-color: var(--gold-light); }

/* Footer: old-site wordmark in a rust-to-gray band (David picked sample B, Oct 25).
   Band is deeper than the old #7f3f00 -> #666 fade so the tan tagline passes 4.5:1. */
.site-footer { background: #2b1500; background-image: var(--footer-bg); color: var(--muted); font-size: .95rem; padding-block: 0 1.25rem; }
.footer-band { background: #5e2f00; background-image: linear-gradient(90deg, #5e2f00, #4a4a4a); border-bottom: 1px solid rgba(178,178,178,.35); padding-block: 2.25rem 2rem; text-align: center; }
.footer-band p { margin: 0; }
.wordmark { font-family: "Trebuchet MS", Tahoma, Ubuntu, Verdana, "DejaVu Sans", sans-serif; color: var(--gold); font-weight: 400; letter-spacing: .01em; line-height: 1.1; font-size: clamp(2.4rem, 1.6rem + 3.5vw, 3.6rem); text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.footer-tagline { font-family: "Trebuchet MS", Tahoma, Ubuntu, Verdana, "DejaVu Sans", sans-serif; color: var(--tan); font-size: clamp(1rem, .9rem + .5vw, 1.25rem); margin-top: .4rem !important; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; padding-top: 1.25rem; }
.footer-inner p { margin: 0; }
.site-footer a { color: var(--gold); }

/* Lightbox */
.lightbox { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; background: rgba(18,12,8,.95); color: #fff; }
.lightbox::backdrop { background: rgba(18,12,8,.9); }
.lightbox[open] { display: flex; flex-direction: column; }
.lb-stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 3.5rem .75rem .5rem; }
.lb-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.lb-bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem 1rem; }
.lb-caption { margin: 0; flex: 1; text-align: center; font-size: .95rem; color: #eadfd2; }
.lb-btn { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; min-width: 48px; min-height: 48px; font: 700 1.4rem/1 var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.lb-btn:hover { background: rgba(255,255,255,.25); }
.lb-btn:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 2px; }
.lb-close { position: absolute; top: .6rem; right: .75rem; }
.lb-count { position: absolute; top: 1.1rem; left: 1rem; font-size: .9rem; color: #d9cbbb; }

/* 404 */
.notfound { min-height: calc(100vh - 140px); display: grid; place-items: center; text-align: center; padding: 3rem 0; }
.notfound .big { font-family: var(--serif); font-size: clamp(4rem, 3rem + 6vw, 7rem); color: var(--gold-light); margin: 0; line-height: 1; }
