/* OwenClarke.ca — mobile-first.
   Breakpoints (min-width only, no overlapping ranges):
   - base      phones: single column, one article card per row
   - 40em      ≥640px: wider centred column, two article cards per row
   - 64em      ≥1024px: two-column wall (combo board left, pegboard right) */

:root {
  color-scheme: light;
  --ink: #211f1d;
  --muted-ink: #5f574e;
  --paper: #fbf8f2;
  --wall: #e9dfcf;
  --label-bg: #24211d;
  --label-ink: #fffaf1;
  --focus: #1b1611;
  --gutter: 12px;
  --frame: clamp(13px, 4vw, 16px); /* oak frame width around whiteboard + cork */
  --peg-pitch: 24px;  /* pegboard hole spacing, identical on every board */
  --board-shadow: 0 18px 30px rgba(78, 51, 28, .17), 0 3px 8px rgba(78, 51, 28, .12);
  /* Whiteboard marker ink. No handwriting font could be bundled in this build, so marker-like
     system fonts are used where the device has them (Apple: Marker Felt / Noteworthy;
     Windows: Ink Free / Segoe Print), otherwise a plain readable sans. */
  --marker-font: "Marker Felt", "Noteworthy", "Ink Free", "Segoe Print", "Bradley Hand", "Chalkboard SE", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --marker-ink: #1a1a1a;
  --marker-dim: #666462;
  --marker-accent: #1c4f9c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

/* ---------- Room lighting by the visitor's local clock ----------
   The inline script in <head> sets html[data-daypart] from the device's local hour only.
   Only the photographed room (wall/desk), the window bloom and the lamp's light change;
   boards, cards and text sit above these layers and are never dimmed.
   Registered properties let the colours ease between periods; without @property support
   (or with reduced motion) the change is instant. Default (no JS) = daylight. */
@property --room-top { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0); }
@property --room-mid { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0); }
@property --room-desk { syntax: "<color>"; inherits: true; initial-value: rgba(255, 255, 255, 0); }
@property --room-base { syntax: "<color>"; inherits: true; initial-value: #e9dfcf; }
@property --bloom-core { syntax: "<color>"; inherits: true; initial-value: rgba(255, 248, 224, .24); }
@property --bloom-mid { syntax: "<color>"; inherits: true; initial-value: rgba(255, 236, 193, .09); }
@property --lamp-glow { syntax: "<number>"; inherits: true; initial-value: 1; }
@property --lamp-spill { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  /* day (also the no-JavaScript fallback): the photograph as shot */
  --room-top: rgba(255, 255, 255, 0);
  --room-mid: rgba(255, 255, 255, 0);
  --room-desk: rgba(255, 255, 255, 0);
  --room-base: #e9dfcf;
  --bloom-core: rgba(255, 248, 224, .24);
  --bloom-mid: rgba(255, 236, 193, .09);
  --lamp-glow: 1;
  --lamp-spill: 0;
  transition: --room-top 2.4s ease, --room-mid 2.4s ease, --room-desk 2.4s ease, --room-base 2.4s ease,
    --bloom-core 2.4s ease, --bloom-mid 2.4s ease, --lamp-glow 1.2s ease, --lamp-spill 1.2s ease;
}

/* 06–09: soft peach morning light */
html[data-daypart="morning"] {
  --room-top: rgba(255, 196, 156, .22);
  --room-mid: rgba(255, 212, 176, .12);
  --room-desk: rgba(255, 194, 138, .08);
  --room-base: #eed9c3;
  --bloom-core: rgba(255, 226, 192, .38);
  --bloom-mid: rgba(255, 204, 156, .14);
  --lamp-glow: .9;
}

/* 17–21: low amber evening light, slightly deeper desk */
html[data-daypart="evening"] {
  --room-top: rgba(220, 120, 60, .22);
  --room-mid: rgba(200, 108, 52, .17);
  --room-desk: rgba(120, 58, 24, .24);
  --room-base: #d9c2a8;
  --bloom-core: rgba(255, 186, 116, .28);
  --bloom-mid: rgba(255, 150, 80, .11);
  --lamp-spill: .6;
}

/* 21–06: dim warm room, window glow almost gone, the desk lamp carries the light */
html[data-daypart="night"] {
  --room-top: rgba(30, 26, 38, .44);
  --room-mid: rgba(40, 29, 22, .38);
  --room-desk: rgba(38, 23, 12, .4);
  --room-base: #857a6e;
  --bloom-core: rgba(196, 208, 255, .07);
  --bloom-mid: rgba(170, 186, 240, .03);
  --lamp-spill: 1;
}

html {
  min-width: 320px;
  background: var(--room-base);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

html.is-sheet-open { overflow: hidden; }

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  color: var(--ink);
  /* Layer 1: time-of-day tint over the room photo (transparent by day).
     Layer 2: the photograph. Plain url() first for browsers without unprefixed image-set. */
  background-color: var(--wall);
  background-image:
    linear-gradient(180deg, var(--room-top), var(--room-mid) 62%, var(--room-desk)),
    url("./assets/background/daylit-wall.webp");
  background-image:
    linear-gradient(180deg, var(--room-top), var(--room-mid) 62%, var(--room-desk)),
    image-set(url("./assets/background/daylit-wall.webp") type("image/webp"), url("./assets/background/daylit-wall.jpg") type("image/jpeg"));
  background-position: 0 0, center bottom;
  background-size: 100% 100%, cover;
  background-repeat: no-repeat;
}

/* Soft window bloom from the upper left; its colour follows the time of day
   (decorative, paused for reduced motion). */
body::before {
  position: fixed;
  inset: -8%;
  z-index: 0;
  pointer-events: none;
  content: "";
  background: radial-gradient(ellipse at 11% 9%, var(--bloom-core) 0%, var(--bloom-mid) 24%, transparent 49%);
  mix-blend-mode: screen;
  opacity: .6;
  transform-origin: 11% 9%;
  animation: lamp-breathe 5.8s ease-in-out infinite;
}

button, a { font: inherit; }
button { color: inherit; }

:where(a, button):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Page shell ---------- */

.site-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 18px;
  width: 100%;
  max-width: 46rem;
  margin-inline: auto;
  padding:
    max(18px, env(safe-area-inset-top))
    max(var(--gutter), env(safe-area-inset-right))
    max(88px, calc(env(safe-area-inset-bottom) + 64px))
    max(var(--gutter), env(safe-area-inset-left));
}

/* Section headings: label-maker tape, always before the content. */
.board-label {
  display: inline-block;
  margin: 0 0 14px;
  padding: 7px 12px 6px;
  border-radius: 3px;
  color: var(--label-ink);
  background: var(--label-bg);
  box-shadow: 0 2px 4px rgba(30, 18, 8, .28), inset 0 1px rgba(255, 255, 255, .08);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .14em;
  line-height: 1.2;
  text-transform: uppercase;
}

#writing, #apps, #projects { scroll-margin-top: 12px; }

/* ---------- Whiteboard + corkboard: one oak-framed combination board ---------- */

.combo-board {
  position: relative;
  border: var(--frame) solid #c4935e;
  border-image: url("./assets/board/oak-frame.webp") 39 35 40 34 / var(--frame) stretch;
  border-radius: 6px;
  background: #b8834f;
  box-shadow: var(--board-shadow);
  animation: board-mount .28s cubic-bezier(.18, .8, .24, 1) backwards;
}

.whiteboard {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 14px 12px 18px;
  background:
    linear-gradient(rgba(255, 255, 255, .16), rgba(255, 255, 255, .24)),
    #f0f0ee url("./assets/board/whiteboard-surface.webp") center 45% / cover no-repeat;
  box-shadow: inset 0 3px 6px rgba(70, 52, 30, .13), inset 2px 0 4px rgba(70, 52, 30, .06), inset -2px 0 4px rgba(70, 52, 30, .06);
}

/* Oak divider rail between the whiteboard and the cork. */
.whiteboard::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  height: 11px;
  content: "";
  background: #c4935e url("./assets/board/oak-rail.webp") center / 100% 100% no-repeat;
  box-shadow: 0 2px 3px rgba(48, 26, 8, .32), inset 0 1px rgba(255, 255, 255, .3), inset 0 -1px rgba(90, 52, 20, .25);
}

.signature-picture {
  display: block;
  width: min(58%, 220px);
  margin-top: -2px;
}

.signature {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  mix-blend-mode: multiply;
  filter: contrast(1.25) saturate(.7);
}

/* ---------- Contact, written on the whiteboard ---------- */

.contact {
  display: grid;
  justify-items: center;
  width: 100%;
  color: var(--marker-ink);
  font-family: var(--marker-font);
}

/* Live, selectable text. On phones the line is capped so it wraps after "@" on purpose. */
.contact-address {
  max-width: 8.5em;
  margin: 0;
  font-size: clamp(28px, 8.4vw, 36px);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: .005em;
  text-align: center;
  text-shadow: 0 0 .6px rgba(20, 20, 20, .45); /* slight marker bleed */
  overflow-wrap: normal;
}

.contact-address .seg {
  padding-bottom: 5px; /* room for the underline is always reserved */
  background: url("./assets/board/marker-underline.svg") left bottom / 100% 0 no-repeat;
  transition: color .18s ease, background-size .18s ease;
}

.contact-address[data-emphasis="local"] .seg-local,
.contact-address[data-emphasis="domain"] .seg-domain,
.contact-address[data-emphasis="all"] .seg { background-size: 100% 7px; }

.contact-address[data-emphasis="local"] .seg-at,
.contact-address[data-emphasis="local"] .seg-domain,
.contact-address[data-emphasis="domain"] .seg-local,
.contact-address[data-emphasis="domain"] .seg-at { color: var(--marker-dim); }

.contact-controls {
  display: flex;
  justify-content: center;
  gap: clamp(10px, 5vw, 26px);
  margin-top: 8px;
}

.contact-toggle {
  display: grid;
  justify-items: center;
  gap: 1px;
  min-width: 64px;
  min-height: 44px;
  padding: 2px 4px 0;
  border: 0;
  border-radius: 12px;
  color: var(--marker-ink);
  background: transparent;
  cursor: pointer;
  font-family: var(--marker-font);
  -webkit-tap-highlight-color: transparent;
}

.contact-icon {
  display: block;
  width: 50px;
  height: 50px;
  overflow: visible;
  transition: transform .18s ease;
}

.contact-toggle:nth-child(1) .contact-icon { transform: rotate(-4deg); }
.contact-toggle:nth-child(2) .contact-icon { transform: rotate(3deg); }
.contact-toggle:nth-child(3) .contact-icon { transform: rotate(-2deg); }

.contact-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-toggle[aria-pressed="true"] { color: var(--marker-accent); }
.contact-toggle[aria-pressed="true"] .ring { stroke-width: 3.2; }

/* The small label is always laid out; it only becomes visible under the selected icon. */
.contact-caption {
  min-height: 20px;
  color: var(--marker-accent);
  font-size: 15px;
  line-height: 20px;
  opacity: 0;
  transition: opacity .18s ease;
}

.contact-toggle[aria-pressed="true"] .contact-caption { opacity: 1; }

@media (hover: hover) {
  .contact-toggle:hover .contact-icon { transform: rotate(0deg) scale(1.04); }
}

/* Reserved row for the selected detail or action: same height in every state. */
.contact-detail {
  display: grid;
  width: 100%;
  min-height: 44px;
  place-items: center;
}

.contact-value,
.contact-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 0;
  padding: 0 10px;
  font-size: 20px;
  line-height: 1.1;
}

.contact-value { color: var(--marker-ink); }

.contact-action {
  color: var(--marker-accent);
  background: url("./assets/board/marker-underline.svg") left calc(100% - 7px) / 100% 6px no-repeat;
  text-decoration: none;
}

.corkboard {
  position: relative;
  padding: 16px 10px 20px;
  background: #b98450 url("./assets/corkboard-amber-mobile.webp") center / cover no-repeat;
  background-image:
    linear-gradient(128deg, rgba(255, 222, 178, .12), transparent 43%, rgba(72, 35, 13, .2)),
    image-set(url("./assets/corkboard-amber-mobile.webp") type("image/webp"), url("./assets/corkboard-amber.png") type("image/png"));
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 5px 7px rgba(60, 30, 8, .3), inset 0 0 24px rgba(84, 42, 14, .18);
}

.article-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin: 0;
  padding: 8px 0 0;
  list-style: none;
}

.article-card {
  position: relative;
  display: grid;
  grid-template-columns: clamp(4.75rem, 28%, 7.5rem) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px 8px 8px;
  border-radius: 6px;
  color: #2a221c;
  background: var(--paper);
  box-shadow: inset 0 1px rgba(255, 255, 255, .85), 0 3px 4px rgba(56, 28, 8, .22), 0 12px 16px rgba(56, 28, 8, .16);
  text-decoration: none;
  transform: rotate(var(--tilt, 0deg));
  transition: transform .2s ease, box-shadow .2s ease;
  animation: pin-piece .22s cubic-bezier(.18, .8, .24, 1) backwards;
}

.article-list li:nth-child(1) .article-card { --tilt: -.7deg; animation-delay: .03s; }
.article-list li:nth-child(2) .article-card { --tilt: .5deg; animation-delay: .08s; }
.article-list li:nth-child(3) .article-card { --tilt: -.4deg; animation-delay: .13s; }
.article-list li:nth-child(4) .article-card { --tilt: .8deg; animation-delay: .18s; }

.article-thumb { display: block; }

.article-thumb img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 3px;
  background: #e9e3d8;
  filter: saturate(.85) contrast(.98);
}

.article-title {
  font-size: clamp(15px, 4.2vw, 16px);
  font-weight: 650;
  line-height: 1.28;
  text-wrap: pretty;
}

.article-arrow {
  color: #8e5e39;
  font-weight: 700;
  white-space: nowrap;
}

@media (hover: hover) {
  .article-card:hover { transform: translateY(-3px) rotate(var(--tilt, 0deg)); box-shadow: inset 0 1px rgba(255, 255, 255, .85), 0 5px 6px rgba(56, 28, 8, .2), 0 18px 22px rgba(56, 28, 8, .2); }
}

.article-card:focus-visible { transform: translateY(-3px) rotate(var(--tilt, 0deg)); }

.pushpin {
  position: absolute;
  top: -10px;
  left: 18%; /* over the thumbnail on phones; centred on the card from 40em */
  z-index: 3;
  width: 19px;
  height: 19px;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  box-shadow: 0 5px 5px rgba(48, 28, 14, .3), 0 12px 0 -8px rgba(66, 54, 44, .9), inset 0 2px 2px rgba(255, 255, 255, .48), inset 0 -3px 4px rgba(52, 26, 12, .24);
  transform: translateX(-50%);
}

.pushpin::before {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 6px;
  height: 4px;
  content: "";
  border-radius: 50%;
  background: rgba(255, 255, 255, .74);
  filter: blur(.35px);
  transform: rotate(-24deg);
}

.pushpin-blue { background: radial-gradient(circle at 34% 27%, #e7f4ff 0 7%, transparent 8%), radial-gradient(circle at 36% 28%, #71c7ff 0 13%, transparent 14%), linear-gradient(145deg, #4cabe8, #1264a2); }
.pushpin-red { background: radial-gradient(circle at 34% 27%, #fff2ed 0 7%, transparent 8%), radial-gradient(circle at 36% 28%, #ff9a81 0 13%, transparent 14%), linear-gradient(145deg, #ed6a4e, #a52920); }
.pushpin-yellow { background: radial-gradient(circle at 34% 27%, #fffce0 0 7%, transparent 8%), radial-gradient(circle at 36% 28%, #ffe77b 0 13%, transparent 14%), linear-gradient(145deg, #f6c844, #bf7a13); }
.pushpin-green { background: radial-gradient(circle at 34% 27%, #f0fff2 0 7%, transparent 8%), radial-gradient(circle at 36% 28%, #8fe5a4 0 13%, transparent 14%), linear-gradient(145deg, #54c77c, #18844e); }

/* ---------- Pegboards ---------- */

.pegboard {
  position: relative;
  isolation: isolate;
  padding: 18px 14px;
  border-radius: 4px;
  background-color: #efe6d8;
  background-image:
    linear-gradient(116deg, rgba(255, 255, 255, .2), transparent 40%, rgba(75, 46, 24, .07)),
    url("./assets/board/pegboard-tile.webp");
  background-size: auto, calc(var(--peg-pitch) * 5) calc(var(--peg-pitch) * 5);
  background-position: 0 0, 0 0;
  box-shadow: var(--board-shadow), inset 0 0 0 1px rgba(120, 88, 58, .2), inset 0 1px rgba(255, 255, 255, .7), inset 0 -2px 3px rgba(102, 66, 37, .1);
  animation: board-mount .28s .05s cubic-bezier(.18, .8, .24, 1) backwards;
}

.board-group { min-width: 0; }

.board-group + .board-group:not([hidden]) {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(99, 72, 48, .2);
}

.app-folder {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 4px;
  width: min(100%, 22rem);
  margin: 2px auto 0;
  padding: 18px 8px 14px;
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 28px;
  background: rgba(250, 245, 237, .74);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
  backdrop-filter: blur(14px) saturate(1.08);
  box-shadow: 0 16px 26px rgba(43, 26, 12, .18), 0 2px 6px rgba(43, 26, 12, .1), inset 0 1px rgba(255, 255, 255, .7);
}

.app-icon-button {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 7px;
  min-width: 44px;
  min-height: 44px;
  padding: 4px 0 6px;
  border: 0;
  border-radius: 16px;
  color: #2b241e;
  background: transparent;
  cursor: pointer;
  font-size: clamp(14px, 3.9vw, 15px);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  animation: pin-piece .22s cubic-bezier(.18, .8, .24, 1) backwards;
}

.app-icon-button:nth-child(1) { animation-delay: .12s; }
.app-icon-button:nth-child(2) { animation-delay: .15s; }
.app-icon-button:nth-child(3) { animation-delay: .18s; }
.app-icon-button:nth-child(4) { animation-delay: .21s; }
.app-icon-button:nth-child(5) { animation-delay: .24s; }
.app-icon-button:nth-child(6) { animation-delay: .27s; }

.app-icon-button picture { display: block; }

.app-icon-button img {
  display: block;
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 23%;
  box-shadow: 0 6px 9px rgba(38, 24, 12, .24), 0 0 0 1px rgba(255, 255, 255, .42), inset 0 1px rgba(255, 255, 255, .32);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s ease;
}

.app-icon-button-brewbet img { background: #e3aa31; }
.app-icon-button-covrme img { padding: 1px; object-fit: cover; background: #1b4332; }

@media (hover: hover) {
  .app-icon-button:hover img { transform: translateY(-3px) scale(1.04); box-shadow: 0 10px 14px rgba(38, 24, 12, .26), 0 0 0 1px rgba(255, 255, 255, .5); }
}

.app-icon-button:focus-visible { outline-offset: 2px; }

/* Projects and resources (hidden until real content is supplied). */
.project-cards,
.resource-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.project-card,
.resource-card {
  position: relative;
  min-height: 108px;
  border: 0;
  cursor: pointer;
  box-shadow: 0 10px 12px rgba(75, 48, 24, .2), inset 0 1px rgba(255, 255, 255, .25);
}

.project-card {
  display: grid;
  align-content: space-between;
  justify-items: center;
  padding: 16px 8px 10px;
  border-radius: 5px 5px 2px 2px;
  color: #2b1d12;
  background: linear-gradient(115deg, rgba(255, 255, 255, .13), transparent 32%), linear-gradient(115deg, #c79d73, #ba8c61);
  font-size: 15px;
  font-weight: 700;
}

.project-mark { display: block; }
.project-mark-circle { width: 32px; height: 32px; border: 9px solid #f8f0e2; border-radius: 50%; }
.project-mark-triangle { width: 0; height: 0; border-right: 17px solid transparent; border-bottom: 30px solid #f8f0e2; border-left: 17px solid transparent; }
.project-mark-bars { display: grid; gap: 6px; }
.project-mark-bars i { display: block; width: 34px; height: 7px; border-radius: 8px; background: #f8f0e2; }

.resource-card {
  padding: 34px 10px 12px;
  color: #2b1d12;
  background: linear-gradient(160deg, #ecdcc6, #d8bf9f);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}

.resource-card::before {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 15px;
  height: 15px;
  content: "";
  border-radius: 50%;
  background: #69513d;
  box-shadow: 0 3px 4px rgba(46, 27, 12, .2);
  transform: translateX(-50%);
}

/* ---------- Detail sheet ---------- */

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(39, 28, 17, .34);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.detail-drawer {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  z-index: 21;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 36px);
  max-height: calc(100dvh - max(24px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom)));
  overflow: hidden;
  border: 1px solid rgba(113, 77, 45, .18);
  border-radius: 18px;
  background: rgba(250, 244, 235, .98);
  box-shadow: 0 24px 70px rgba(45, 26, 9, .26), 0 2px 8px rgba(45, 26, 9, .12);
  opacity: 0;
  transform: translateY(24px);
  transition: transform .28s cubic-bezier(.17, .84, .28, 1), opacity .2s ease;
}

.detail-drawer.is-open { opacity: 1; transform: none; }

.drawer-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 4px 22px;
}

.drawer-kicker {
  margin: 0;
  color: var(--muted-ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.drawer-close {
  display: grid;
  flex: none;
  width: 48px;
  height: 48px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(70, 50, 30, .24);
  border-radius: 50%;
  color: #2a221c;
  background: #fff;
  box-shadow: 0 1px 2px rgba(45, 26, 9, .1);
  cursor: pointer;
}

.drawer-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; }
.drawer-close:hover { background: #f4ece1; }

.drawer-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 22px 24px;
}

.detail-drawer h2 {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 8vw, 40px);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.05;
}

#detail-description {
  margin: 0;
  color: #4b443c;
  font-size: 16px;
  line-height: 1.55;
}

.drawer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin-top: 20px;
  padding: 0 20px;
  border-radius: 12px;
  color: #fffaf1;
  background: #2a221c;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.drawer-link:hover { background: #3d3128; }

/* ---------- Motion ---------- */

@keyframes board-mount {
  from { opacity: .65; translate: 0 4px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes pin-piece {
  from { opacity: .48; translate: 0 -4px; }
  to { opacity: 1; translate: 0 0; }
}

@keyframes lamp-breathe {
  0%, 100% { opacity: .62; transform: scale(.985); }
  50% { opacity: .9; transform: scale(1.025); }
}

/* ---------- ≥640px: roomier column, two article cards per row ---------- */

@media (min-width: 40em) {
  :root { --gutter: 24px; --frame: 18px; --peg-pitch: 26px; }

  .site-shell { gap: 24px; padding-top: max(32px, env(safe-area-inset-top)); }

  .whiteboard { gap: 8px; padding: 22px 24px 24px; }
  .signature-picture { width: min(44%, 250px); }
  .contact-address { max-width: none; font-size: 36px; }
  .contact-icon { width: 54px; height: 54px; }

  .corkboard { padding: 18px 18px 24px; }
  .article-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 18px; align-items: start; }
  .article-card { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 10px; padding: 8px 8px 12px; }
  .article-thumb img { aspect-ratio: 16 / 9; }
  .pushpin { left: 50%; }
  .article-title { padding: 0 6px 0 4px; font-size: 16px; }

  .pegboard { padding: 24px 22px; }
  .app-folder { width: min(100%, 25rem); gap: 18px 8px; padding: 22px 14px 18px; }
  .app-icon-button { font-size: 15px; }
  .app-icon-button img { width: 66px; height: 66px; }

  .detail-drawer {
    top: 50%;
    right: max(24px, env(safe-area-inset-right));
    bottom: auto;
    left: auto;
    width: min(440px, calc(100vw - 48px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    transform: translate(24px, -50%);
  }

  .detail-drawer.is-open { transform: translate(0, -50%); }
  .drawer-header { padding: 14px 14px 4px 28px; }
  .drawer-body { padding: 2px 28px 30px; }
}

/* ---------- ≥1024px: two boards side by side on the wall ---------- */

@media (min-width: 64em) {
  :root { --frame: 20px; --peg-pitch: 28px; }

  .site-shell {
    grid-template-columns: minmax(0, 34rem) minmax(0, 1fr);
    align-items: stretch;
    column-gap: clamp(32px, 4vw, 56px);
    row-gap: 24px;
    max-width: 80rem;
    padding: clamp(36px, 7vh, 88px) clamp(32px, 5vw, 72px) 140px;
  }

  .combo-board { grid-column: 1; grid-row: 1 / span 2; align-self: start; }
  .projects-board, .apps-board { grid-column: 2; }
  .projects-board:not([hidden]) + .apps-board { grid-row: 2; }
  .projects-board[hidden] + .apps-board { grid-row: 1 / span 2; }

  /* The pegboard hangs top-aligned beside the combo board at roughly 4:3, with the folder
     centred on it; it grows if more apps or resources are restored. */
  .apps-board { display: flex; flex-direction: column; align-self: start; min-height: clamp(22rem, 46vh, 27rem); }
  .app-group { display: flex; flex: 1 1 auto; flex-direction: column; align-items: flex-start; }
  .app-group .app-folder { margin-block: auto; }

  .whiteboard { padding: 24px 28px 26px; }
  .signature-picture { width: min(52%, 260px); }

  .pegboard { padding: 28px; }
  .app-folder { width: min(100%, 28rem); gap: 24px 10px; padding: 28px 16px 24px; border-radius: 34px; }
  .app-icon-button img { width: 76px; height: 76px; }
}

/* ---------- Desk lamp: desktop with a mouse/trackpad only ---------- */

.desk-lamp { display: none; }

@media (min-width: 64em) and (hover: hover) and (pointer: fine) {
  /* Stands on the photographed desk (the desk band sits at the page bottom), under the
     Apps pegboard, aligned to the right edge of the page content. No z-index here, so the
     drawing paints behind the boards (.site-shell is z-index 1). */
  .desk-lamp {
    position: absolute;
    right: calc(50% - min(40rem, 50vw) + clamp(32px, 5vw, 72px) + clamp(12px, 5vw, 110px));
    bottom: 56px;
    display: block;
    width: clamp(210px, 19vw, 290px);
    pointer-events: none;
  }

  .lamp-art { display: block; width: 100%; height: auto; overflow: visible; will-change: transform; } /* own layer: lamp frames never repaint the room */
  .lamp-led { fill: #f3b245; filter: drop-shadow(0 0 2px rgba(255, 196, 92, .9)); }
  .lamp-lens { fill: url(#lamp-lens-on); }
  /* Lamp light strength follows the room (stronger at evening/night); the switch alone
     decides on/off. */
  .lamp-light { opacity: var(--lamp-glow); transition: opacity .45s ease; }
  .lamp-spill { opacity: var(--lamp-spill); }

  .desk-lamp.is-off .lamp-light { opacity: 0; }
  .desk-lamp.is-off .lamp-lens { fill: url(#lamp-lens-off); }
  .desk-lamp.is-off .lamp-led { fill: #a69d90; filter: none; }

  /* The only interactive part: a 48px switch over the light on the base. */
  .lamp-switch {
    position: absolute;
    z-index: 2;
    left: calc(153 / 260 * 100% - 24px);
    top: calc(279.5 / 300 * 100% - 24px);
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    pointer-events: auto;
  }

  /* Two-tone focus ring: visible on the bright daytime desk and the dim night desk. */
  .lamp-switch:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    box-shadow: 0 0 0 3px #fffaf1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
