/* Shared styles for every page. Colours are tokens on :root. */
:root {
  --fg:#1d1d1b; --muted:#4a4a46; --accent:#9a5a00;
  --sky-top:#3f9be4; --sky-bottom:#c6e6fb; --card:rgba(255,255,255,.93);
  --text-w:46em; --side-w:15rem; --gap:24px; --pad:16px;
}
* { box-sizing:border-box; }
/* always show the scrollbar track, so short pages line up with long ones */
html { overflow-y:scroll; }
body {
  margin:0; min-height:100vh; padding:0 var(--pad) 32px; color:var(--fg);
  font:18px/1.6 system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
  background:linear-gradient(to bottom,var(--sky-top),var(--sky-bottom)) fixed var(--sky-bottom);
}
.card {
  position:relative; z-index:1; padding:32px 28px;
  background:var(--card); border-radius:16px; box-shadow:0 8px 30px rgba(0,40,90,.18);
}

/* top bar: docked to the top edge, full width and solid, so the page scrolls cleanly beneath it */
.topbar {
  position:sticky; top:0; z-index:20; margin:0 calc(-1 * var(--pad)) var(--gap); padding:8px var(--pad);
  background:#fff; box-shadow:0 2px 12px rgba(0,40,90,.25); text-align:left;
}
.menu.card {
  display:flex; flex-wrap:wrap; align-items:center; gap:4px 14px; max-width:76rem; margin:0 auto; padding:0;
  background:none; box-shadow:none; border-radius:0;
}
.menu .brand {
  display:flex; align-items:center; gap:10px; padding:2px 10px 2px 4px; border-radius:8px;
  font-weight:700; line-height:1.2; text-decoration:none;
}
.menu .brand:hover { background:rgba(63,155,228,.14); }
.menu .brand[aria-current="page"] { background:rgba(154,90,0,.1); }
.menu .brand img { width:40px; height:40px; flex:none; }
.menu ul { margin:0; padding:0; list-style:none; display:flex; flex-wrap:wrap; gap:2px 2px; }
.menu li a {
  display:block; padding:.4em 11px; border-bottom:3px solid transparent; border-radius:6px;
  text-decoration:none; font-size:.95rem; white-space:nowrap;
}
.menu li a:hover { background:rgba(63,155,228,.14); }
.menu li a[aria-current="page"] { border-bottom-color:var(--accent); background:rgba(154,90,0,.1); font-weight:700; }
.nav-button {
  display:none; margin-left:auto; padding:.45em 1.1em; border:2px solid var(--accent); border-radius:999px;
  background:#fff; color:var(--accent); font-family:inherit; font-size:.95rem; font-weight:600; line-height:1.2;
  letter-spacing:.06em; text-transform:uppercase; cursor:pointer;
}
.nav-button:focus-visible, .menu a:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }

/* page frame: the text card, with the Current Work card on its left and the gallery card on its right.
   On narrow screens everything is one column: text, then gallery, then Current Work. */
.layout {
  display:grid; grid-template-columns:minmax(0,var(--text-w)); justify-content:center; gap:var(--gap);
  align-items:start; margin:0 auto;
}

header { text-align:center; }
.icon { width:140px; height:140px; }
h1 { margin:.2em 0 .25em; font-size:clamp(1.6rem,5vw,2.5rem); letter-spacing:.02em; text-wrap:balance; }
h2 { margin:1.4em 0 .4em; font-size:1.15rem; }
.badge {
  display:inline-block; margin:.25em 0 1em; padding:.3em 1em;
  border:2px solid var(--accent); color:var(--accent); border-radius:999px;
  font-weight:600; text-transform:uppercase; letter-spacing:.12em; font-size:.8rem;
}
/* the Under Construction pill: the Send button's look, but not a control */
.pill {
  display:inline-block; margin:.2em 0 .6em; padding:.55em 1.6em; border:2px solid var(--accent); border-radius:999px;
  background:#fff; color:var(--accent); font-size:1rem; font-weight:600; line-height:1.2; letter-spacing:.06em; text-transform:uppercase;
}
p { margin:.9em 0; }
a { color:var(--fg); }
.small { margin:.5em 0; font-size:.85rem; color:var(--muted); text-align:center; }

/* side cards: Current Work, and the gallery (thumbnails in a plain column; click opens a larger view) */
.gallery, .work { padding:18px 14px; }
.gallery .head, .work .head {
  display:flex; justify-content:space-between; align-items:center; gap:10px; margin:0 0 .8em; padding:0 6px .7em; white-space:nowrap;
  border-bottom:1px solid rgba(0,0,0,.12); font-size:inherit; font-weight:700; line-height:1.2;
}
.gallery .head img, .work .head img { width:40px; height:40px; flex:none; }
/* an empty space as wide as the icon centres the title on the card; it gives way in narrow cards */
.gallery .head::after, .work .head::after { content:""; flex:0 1 40px; }
.work .date { margin:0 6px .5em; font-size:.8rem; font-weight:700; letter-spacing:.06em; color:var(--accent); text-align:center; }
.work p { margin:.6em 6px; font-size:.85rem; line-height:1.45; }
.work .date + p { margin-top:0; }
.work ul { margin:.6em 6px; padding-left:1.3em; font-size:.85rem; line-height:1.45; }
.work li { margin:.2em 0; }
.gallery .note { margin:0 6px 1em; font-size:.8rem; line-height:1.4; color:var(--muted); }
.pile { margin:0; padding:0 4px; list-style:none; display:flex; flex-direction:column; gap:18px; }
.thumb {
  display:block; max-width:18rem; margin:0 auto; padding:6px 6px 4px; background:#fff;
  border:1px solid rgba(0,0,0,.14); border-radius:8px; box-shadow:0 3px 10px rgba(0,40,90,.18);
  text-decoration:none; color:var(--fg);
}
.thumb:hover { border-color:var(--accent); }
.thumb:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
.thumb img { display:block; width:100%; height:auto; border-radius:4px; background:#eef3f7; }
.thumb .cap { display:block; padding:.35em 2px 0; font-size:.8rem; line-height:1.3; text-align:center; color:var(--muted); }

/* the pop-up (a native modal dialog) */
dialog#viewer { border:0; padding:0; background:transparent; max-width:96vw; max-height:96vh; overflow:visible; }
dialog#viewer::backdrop { background:rgba(10,25,45,.72); }
#viewer figure { position:relative; margin:0; padding:10px 10px 8px; background:#fff; border-radius:12px; }
#viewer img { display:block; max-width:calc(96vw - 20px); max-height:calc(100vh - 110px); width:auto; height:auto; margin:0 auto; }
#viewer figcaption { padding:.5em 44px 0; font-size:.9rem; text-align:center; color:var(--muted); }
/* zoomable drawings (thumbnails marked data-zoom): click to zoom to full width, scroll inside */
dialog#viewer.zoomable img { cursor:zoom-in; }
dialog#viewer.zoomed { overflow:auto; border-radius:12px; }
dialog#viewer.zoomed img { max-width:none; max-height:none; height:auto; margin:0; cursor:zoom-out; }
dialog#viewer.zoomed figure { width:max-content; min-width:100%; }
dialog#viewer.zoomed .close { position:fixed; top:calc(2vh + 8px); right:calc(2vw + 12px); }
#viewer .close {
  position:absolute; top:6px; right:6px; width:44px; height:44px; border:0; border-radius:50%;
  background:rgba(255,255,255,.92); color:var(--fg); font:700 26px/1 system-ui,sans-serif; cursor:pointer;
  box-shadow:0 1px 6px rgba(0,0,0,.3);
}
#viewer .close:focus-visible { outline:3px solid var(--accent); }

/* Home's Fixed or Tracked card and its reading pop-up (assets/js/reader.js) */
.reader-open, .anim-open {
  display:block; width:fit-content; margin:0 auto; padding:.55em 1.6em; background:#fff; border:2px solid var(--accent);
  border-radius:999px; color:var(--accent); font-weight:600; font-size:1rem; line-height:1.2; letter-spacing:.06em;
  text-transform:uppercase; text-align:center; text-decoration:none;
}
.reader-open:hover, .anim-open:hover { background:rgba(154,90,0,.1); }
.reader-open:focus-visible, .anim-open:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
dialog#reader { border:0; padding:0; background:#fff; border-radius:12px; width:min(46em,96vw); max-height:96vh; overflow:hidden; }
dialog#reader[open] { display:flex; flex-direction:column; }
dialog#reader::backdrop { background:rgba(10,25,45,.72); }
.reader-frame { display:flex; flex-direction:column; min-height:0; max-height:96vh; }
.reader-bar { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 14px; border-bottom:1px solid rgba(0,0,0,.12); }
.reader-bar h2 { display:flex; align-items:center; gap:10px; margin:0; font-size:1.15rem; line-height:1.2; }
.reader-bar h2 img { width:40px; height:40px; flex:none; }
.reader-tools { display:flex; gap:6px; flex:none; }
.reader-tools button {
  min-width:44px; height:44px; padding:0 .6em; border:1px solid rgba(0,0,0,.2); border-radius:22px; background:#fff;
  color:var(--fg); font:700 1rem/1 system-ui,sans-serif; cursor:pointer;
}
.reader-tools button:hover { border-color:var(--accent); }
.reader-tools button:disabled { opacity:.4; cursor:default; }
.reader-tools .close, .reader-tools .zoom-out, .reader-tools .zoom-in { font-size:26px; }
.reader-tools button:focus-visible, .reader-body:focus-visible, .reader-foot a:focus-visible { outline:3px solid var(--accent); }
.reader-body { flex:1 1 auto; min-height:0; overflow:auto; padding:6px 28px 10px; font-size:calc(18px * var(--rz, 1)); }
.reader-body h2 { font-size:calc(1.15rem * var(--rz, 1)); }
.reader-foot { margin:0; padding:8px 14px; border-top:1px solid rgba(0,0,0,.12); font-size:.85rem; text-align:center; }

/* Contact form */
.contact-form label { display:block; margin-bottom:.25em; font-weight:600; font-size:.95rem; }
.contact-form input[type="text"], .contact-form input[type="email"], .contact-form textarea {
  display:block; width:100%; padding:.55em .7em; border:1px solid rgba(0,0,0,.35); border-radius:8px;
  background:#fff; color:var(--fg); font:inherit;
}
.contact-form textarea { resize:vertical; }
.contact-form input:focus-visible, .contact-form textarea:focus-visible { outline:3px solid var(--accent); outline-offset:1px; }
.contact-form button {
  padding:.55em 1.6em; border:2px solid var(--accent); border-radius:999px; background:#fff; color:var(--accent);
  font-family:inherit; font-size:1rem; font-weight:600; line-height:1.2; letter-spacing:.06em; text-transform:uppercase; cursor:pointer;
}
.contact-form button:hover { background:rgba(154,90,0,.1); }
.contact-form button:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
.contact-form .cancel {
  display:inline-block; margin-left:.8em; padding:.55em 1.6em; border:2px solid var(--muted); border-radius:999px;
  background:#fff; color:var(--muted); font-family:inherit; font-size:1rem; font-weight:600; line-height:1.2; letter-spacing:.06em; text-transform:uppercase; text-decoration:none;
}
.contact-form .cancel:hover { background:rgba(0,0,0,.06); }
.contact-form .cancel:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
.contact-form .publish { margin-bottom:2.2em; }
.contact-form .publish label { display:inline-flex; align-items:center; gap:.6em; }
.contact-form .publish input { flex:none; width:1.3em; height:1.3em; margin:0; accent-color:var(--accent); }
.contact-form .hp { position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }

/* wider windows: the side cards sit beside the text */
@media (min-width:1100px) {
  .layout.has-work { grid-template-columns:var(--side-w) minmax(0,var(--text-w)); }
  .layout.has-work .work, .layout.has-work .work-column { grid-column:1; grid-row:1; }
  .layout.has-work .content { grid-column:2; grid-row:1; }
  .layout.has-gallery { grid-template-columns:minmax(0,var(--text-w)) var(--side-w); }
  .layout.has-gallery .content { grid-column:1; grid-row:1; }
  .layout.has-gallery .gallery, .layout.has-gallery .side { grid-column:2; grid-row:1; }
  /* both cards, but not yet room for three columns: Current Work goes below the text */
  .layout.has-work.has-gallery .work, .layout.has-work.has-gallery .work-column { grid-column:1; grid-row:2; }
}
@media (min-width:1380px) {
  .layout.has-work.has-gallery { grid-template-columns:var(--side-w) minmax(0,var(--text-w)) var(--side-w); }
  .layout.has-work.has-gallery .work, .layout.has-work.has-gallery .work-column { grid-column:1; grid-row:1; }
  .layout.has-work.has-gallery .content { grid-column:2; grid-row:1; }
  .layout.has-work.has-gallery .gallery, .layout.has-work.has-gallery .side { grid-column:3; grid-row:1; }
}

/* Bill of Materials: wide text card, tables scroll sideways when the window is narrow */
h2[id] { scroll-margin-top:72px; }
.table-wrap { margin:.6em 0 1.2em; overflow-x:auto; }
.table-wrap:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
table.bom { width:100%; min-width:54rem; border-collapse:collapse; font-size:.85rem; line-height:1.4; text-align:left; }
table.bom.key { min-width:0; }
table.bom th, table.bom td { padding:.45em .6em; border-bottom:1px solid rgba(0,0,0,.14); vertical-align:top; }
table.bom thead th { border-bottom:2px solid rgba(0,0,0,.35); white-space:nowrap; }
table.bom tbody th { font-weight:700; }
table.bom .num { text-align:right; }
table.bom .status { white-space:nowrap; }
table.bom tr.open td, table.bom tr.open th { background:rgba(154,90,0,.09); }
@media (min-width:1100px) {
  .layout.has-work.wide { grid-template-columns:minmax(0,76rem); }
  .layout.has-work.wide .content { grid-column:1; grid-row:1; }
  .layout.has-work.wide .work, .layout.has-work.wide .work-column { grid-column:1; grid-row:2; }
}
/* from 1240px the tables (min 54rem, plus the card's padding and a scrollbar) still fit beside the Current Work card */
@media (min-width:1240px) {
  .layout.has-work.wide { grid-template-columns:var(--side-w) minmax(0,76rem); }
  .layout.has-work.wide .work, .layout.has-work.wide .work-column { grid-column:1; grid-row:1; }
  .layout.has-work.wide .content { grid-column:2; grid-row:1; }
}

/* wide windows: the bar is only as wide as its links */
@media (min-width:1221px) { .menu.card { width:fit-content; } }

/* narrower windows: the section links fold into a Menu button (needs the small script) */
@media (max-width:1220px) {
  .js .nav-button { display:block; }
  .js .menu ul { display:none; width:100%; flex-direction:column; padding:6px 0 4px; }
  .js .menu ul.open { display:flex; }
  .js .menu li a { border-bottom:0; border-left:4px solid transparent; padding:.55em 12px; }
  .js .menu li a[aria-current="page"] { border-left-color:var(--accent); }
  .menu.card { max-height:calc(100vh - 20px); overflow-y:auto; }
}
@media (max-width:480px) {
  :root { --pad:10px; }
  .card { padding:24px 18px; }
  .gallery, .work { padding:18px 10px; }
  .pile { padding:0 2px; }
  .reader-body { padding:6px 16px 10px; }
}
.skip { position:absolute; left:-999px; top:0; }
.skip:focus { left:8px; top:8px; z-index:100; padding:.5em 1em; background:#fff; border-radius:6px; }

/* Home: two cards stacked in the right-hand column (Fixed or Tracked, then Animation) */
.side { display:flex; flex-direction:column; gap:var(--gap); min-width:0; }
/* Current Work and the FAQ card stacked in one column */
.work-column { display:flex; flex-direction:column; gap:var(--gap); min-width:0; }
button.reader-open { font-family:inherit; cursor:pointer; }
.anim-card .anim-still { position:relative; margin-bottom:.9em; }
.anim-card .play {
  position:absolute; left:50%; top:50%; width:52px; height:52px; margin:-26px 0 0 -26px; border-radius:50%;
  background:rgba(255,255,255,.92); box-shadow:0 2px 10px rgba(0,0,0,.35);
}
.anim-card .play::after {
  content:""; position:absolute; left:20px; top:14px; border-style:solid; border-width:12px 0 12px 19px;
  border-color:transparent transparent transparent var(--accent);
}
.anim-card .anim-still:hover .play { background:#fff; }
.anim-card .note { margin-bottom:0; text-align:center; }

/* Videos: the Animation button and its pop-up (assets/js/animation.js) */
.anim-open { margin:.4em 0; }
dialog#anim, dialog#faq { border:0; padding:0; background:#fff; border-radius:12px; width:min(96vw,1500px); max-width:none; height:min(94vh,1000px); max-height:none; overflow:hidden; }
dialog#anim[open], dialog#faq[open] { display:flex; flex-direction:column; }
dialog#anim::backdrop, dialog#faq::backdrop { background:rgba(10,25,45,.72); }
.anim-frame { display:flex; flex-direction:column; flex:1 1 auto; min-height:0; }
.anim-frame iframe { flex:1 1 auto; width:100%; min-height:0; border:0; background:#0b1a2b; }
/* the FAQ window: a small section panel on the left; the text is sized by Reduce and Enlarge (assets/js/faq.js) */
.faq-main { flex:1 1 auto; display:flex; min-height:0; }
.faq-index { flex:none; display:flex; flex-direction:column; gap:2px; width:12.25rem; overflow-x:hidden; overflow-y:auto; padding:10px 8px; background:#eef5fb; border-right:1px solid rgba(0,0,0,.12); }
.faq-index button { flex:none; padding:.45em .6em; border:0; border-left:4px solid transparent; border-radius:6px; background:none; color:var(--fg); font:inherit; font-size:.8rem; line-height:1.3; text-align:left; overflow-wrap:anywhere; cursor:pointer; }
.faq-index button:hover { background:rgba(63,155,228,.14); }
.faq-index button[aria-current="true"] { border-left-color:var(--accent); background:rgba(154,90,0,.1); font-weight:700; }
.faq-index button:focus-visible { outline:3px solid var(--accent); outline-offset:-3px; }
.faq-body { flex:1 1 auto; min-width:0; overflow:auto; padding:6px 28px 0; font-size:calc(18px * var(--zoom, 1)); overflow-wrap:anywhere; }
.faq-body > * { max-width:46em; margin-left:auto; margin-right:auto; }
/* room below the last section, so every heading can be brought to the top */
.faq-body::after { content:""; display:block; height:calc(100% - 4em); }
.faq-body h2 { font-size:calc(1.15rem * var(--zoom, 1)); }
.faq-body .q, .faq-body .a { display:flex; gap:.7em; margin:.4em 0; }
.faq-body .q b, .faq-body .a b { flex:none; width:1.1em; }
.faq-body .q { color:var(--accent); font-family:Georgia,"Times New Roman",serif; font-weight:700; }
.faq-body .a { color:var(--muted); }
.faq-body .a-list { margin:.2em 0 .6em; padding:0 0 0 1.8em; list-style:none; color:var(--muted); }
.faq-body .a-list li { display:flex; gap:.5em; }
.faq-body .a-list li::before { content:"\2022"; flex:none; }
.faq-body .a-more { margin:.4em 0; padding-left:1.8em; color:var(--muted); }
.faq-body:focus-visible { outline:3px solid var(--accent); }
@media (max-width:520px) {
  .faq-index { width:min(7.6rem, 42vw); padding:6px 4px; }
  .faq-index button { padding:.45em .3em; font-size:.75rem; }
  .faq-body { padding:6px 12px 0; }
  dialog#anim, dialog#faq { width:100vw; height:100vh; height:100dvh; border-radius:0; }
}
