@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/source-serif-4-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --wall: #E6DFD0;
  --panel: #FAF6EE;
  --field-bg: #FFFDF8;
  --ink: #22201C;
  --ink-2: #58534A;
  --accent: #2B2A28;
  --track: #ECE5D7;
  --rule: #CFC6B4;
  --field: #8C8473;
  --error: #8A2A24;
  --radius: 4px;
  --float-shadow: 0 1px 3px rgba(30, 36, 34, .25), 0 6px 16px rgba(30, 36, 34, .14);
  --print-shadow: 0 1px 2px rgba(20, 18, 14, .35), 0 6px 12px rgba(20, 18, 14, .22), 0 22px 40px rgba(20, 18, 14, .18);
  font-family: "Source Serif 4", Georgia, serif;
  font-optical-sizing: auto;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--panel);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

a {
  color: var(--ink);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  border-radius: 0;
}

button,
.button {
  display: inline-block;
  border-radius: var(--radius);
  min-height: 44px;
  padding: .6rem 1rem;
  border: 0;
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  color: #FFFFFF;
}

button.secondary,
.button.secondary {
  background: var(--ink-2);
}

button.danger,
.button.danger {
  background: var(--error);
}

button.link,
.link {
  min-height: 0;
  padding: 0;
  background: none;
  color: var(--ink);
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 3px;
}

h1,
h2,
h3 {
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}

fieldset {
  min-width: 0;
  margin: 0 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--rule);
}

legend {
  font-weight: 600;
}

label {
  display: block;
  margin: .8rem 0 .25rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  max-width: 42rem;
  min-height: 44px;
  padding: .6rem .75rem;
  border: 1px solid var(--field);
  border-radius: var(--radius);
  background: var(--field-bg);
}

textarea {
  min-height: 7rem;
}

input[type=checkbox] {
  width: auto;
  min-height: 0;
  border-radius: 0;
  margin-right: .5rem;
}

.checkbox {
  font-weight: 400;
}

.help,
small {
  color: var(--ink-2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Title bar, shared by every page */

.title-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1.75rem;
  padding: 14px 32px;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

.logo {
  max-width: 10rem;
  max-height: 2.2rem;
}

.title-bar nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .9rem;
  font-size: .94rem;
}

/* Ordinary pages */

.container {
  max-width: 1160px;
  margin: 2rem auto;
  padding: 0 1rem;
}

footer {
  max-width: 1160px;
  margin: 3rem auto 1rem;
  padding: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: .9rem;
}

.notice,
.error {
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--rule);
  background: var(--field-bg);
}

.error {
  border-color: var(--error);
  color: var(--error);
}

.card {
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--rule);
  background: var(--field-bg);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .7rem;
  margin: 1rem 0;
}

.inline {
  display: inline;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--field-bg);
}

th,
td {
  padding: .7rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: .85rem;
}

.status {
  display: inline-block;
  padding: .1rem .5rem;
  border: 1px solid var(--rule);
  font-size: .82rem;
  white-space: nowrap;
}

.status-approved,
.status-delivered,
.status-closed {
  border-color: var(--accent);
  color: var(--accent);
}

.status-cancelled,
.status-changes_requested {
  border-color: var(--error);
  color: var(--error);
}

.code {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .06em;
}

.event {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 1px solid var(--rule);
}

.preview {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
}

.queue-count {
  font-weight: 400;
  color: var(--ink-2);
}

.steps {
  padding-left: 1.25rem;
}

.steps li {
  margin-bottom: .6rem;
}

.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 26rem);
  gap: 1.5rem;
  align-items: start;
}

.order-layout form {
  margin-top: 0;
}

.order-layout form > small {
  display: block;
}

.order-layout form > button {
  margin-top: 1rem;
}

/* The framed print: a 19 mm moulding drawn to the print's scale (D42), in the
   colours of STIL LAB's own Studio renders (D43). Each context sets
   --print-width, the drawn width of the print itself, and the template sets
   --print-mm, the print's real width in its orientation. */

@property --moulding {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

.framed {
  --print-mm: 420;
  --moulding-share: calc(19 / var(--print-mm));
  --moulding: max(4px, calc(var(--print-width) * var(--moulding-share)));
  position: relative;
  box-sizing: content-box;
  margin: 0;
  border: var(--moulding) solid;
  /* Each side's measured face; the borders meet in mitres. */
  border-color: #212123 #232226 #201F21 #252628;
  background: #F6F4F0;
  box-shadow: var(--print-shadow);
}

.framed[data-frame=white] {
  border-color: #DFE2E0 #DFE2E0 #E1E2E1 #E0E3E1;
}

/* Natural is a mitred pine border image from tools/pinegrain: the grain runs
   along each side and stops at the mitre. The colours show while it loads. */

.framed[data-frame=natural] {
  border-color: #C9A279 #DFB994 #C8A178 #D3AE81;
  border-image: url("/static/frames/natural.png") 40 round;
}

/* The glass and the shadowed edge where the moulding meets the print. */

.framed::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(120deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .02), rgba(255, 255, 255, 0) 36%, rgba(255, 255, 255, 0), rgba(255, 255, 255, .04));
  box-shadow:
    inset 0 0 2px rgba(0, 0, 0, .32),
    inset 0 0 0 1px rgba(0, 0, 0, .45);
  pointer-events: none;
}

.framed img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}

/* In the page flow the print takes its container's width, moulding included. */

:has(> .framed.in-flow) {
  container-type: inline-size;
}

.framed.in-flow {
  --print-width: calc(100cqw / (1 + 2 * var(--moulding-share)));
  box-sizing: border-box;
  width: 100%;
}

.framed.in-flow img {
  height: auto;
}

/* The wall gives the print its size: as large as fits, with A3 drawn smaller. */

.wall {
  flex: 1;
  container-type: size;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 260px;
}

.wall .framed {
  --scale: .8;
  --room-width: 100cqw;
  --room-height: 100cqh;
  /* The print and its moulding together fit the room. */
  --print-width: calc(min(
    var(--room-width) / (1 + 2 * var(--moulding-share)),
    var(--room-height) / (1 / var(--ratio) + 2 * var(--moulding-share))
  ) * var(--scale));
  width: var(--print-width);
  height: calc(var(--print-width) / var(--ratio));
  transition: width .35s ease, height .35s ease, --moulding .35s ease, border-color .2s;
}

.wall .framed[data-size=A2],
.wall .framed.full-size {
  --scale: 1;
}

.framed.is-loading img {
  opacity: .5;
}

.spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  visibility: hidden;
  animation: spin .9s linear infinite;
}

.js .is-loading .spinner {
  visibility: visible;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

.caption {
  width: 100%;
  max-width: 52rem;
  text-align: center;
  font-size: .875rem;
  color: var(--ink-2);
}

.caption p {
  margin: 0;
}

.caption .credits {
  margin-top: .25rem;
  font-size: .8125rem;
}

.caption .error {
  display: inline-block;
  margin-top: .5rem;
  padding: .5rem .75rem;
}

/* Address search */

.search-form {
  position: relative;
  margin: 0;
}

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-field {
  flex: 1 1 16rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
  height: 52px;
  padding: 0 1rem;
}

.search-field svg {
  flex: none;
}

.search-field label {
  margin: 0;
}

.search-field input {
  flex: 1;
  min-width: 0;
  max-width: none;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.search-field input:focus-visible {
  outline: 0;
}

.search-field:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.search-box .search-submit {
  background: transparent;
  color: var(--ink);
}

.js .search-box .search-submit {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.searching {
  display: none;
  margin: 0;
  padding: .6rem 1rem;
  font-size: .875rem;
  color: var(--ink-2);
}

.searching.htmx-request {
  display: block;
}

.address-results {
  max-height: 45vh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border-top: 1px solid var(--track);
  list-style: none;
}

.address-results button {
  width: 100%;
  border-radius: 0;
  padding: .6rem 1rem;
  background: transparent;
  color: var(--ink);
  font-weight: 400;
  text-align: left;
}

.address-results button:hover,
.address-results button:focus-visible {
  background: var(--track);
  outline-offset: -2px;
}

#address-results .help {
  margin: 0;
  padding: .6rem 1rem;
  font-size: .875rem;
}

/* Storefront: first visit and configurator */

.first-visit,
.configuring {
  display: flex;
  flex-direction: column;
  /* The wall's container units need a definite height, not just a minimum. */
  height: 100vh;
  height: 100dvh;
  min-height: 640px;
  background: var(--wall);
}

.stage {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.search-panel {
  background: var(--field-bg);
  box-shadow: var(--float-shadow);
  view-transition-name: search;
}

.title-bar {
  view-transition-name: title-bar;
}

.wall .framed {
  view-transition-name: print;
}

.sidebar {
  view-transition-name: sidebar;
}

.search-box .coverage {
  margin: 0;
  padding: .6rem 1rem .75rem;
  border-top: 1px solid var(--track);
  font-size: .8125rem;
  color: var(--ink-2);
}

/* First visit: the title bar and the search are one band over the wall. */

.first-visit .title-bar {
  border-bottom: 0;
}

.first-visit .stage {
  gap: 0;
  min-height: 0;
}

.search-band {
  align-self: stretch;
  padding: 20px 32px 36px;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
  view-transition-name: search;
}

.search-band-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 600px;
  margin: 0 auto;
}

.search-band h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.2;
}

.search-band-inner > p {
  margin: 0;
}

.search-band .lede {
  font-size: 15px;
  color: var(--ink-2);
}

.search-band .search-field {
  height: 48px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--field-bg);
}

.search-band .search-submit {
  min-height: 48px;
  padding: 0 1.25rem;
}

/* Suggestions drop over the wall instead of pushing the print down. */
.search-band #address-results:not(:empty),
.search-band .searching.htmx-request {
  position: absolute;
  z-index: 2;
  top: 52px;
  right: 0;
  left: 0;
  border-radius: 6px;
  background: var(--field-bg);
  box-shadow: var(--float-shadow);
  overflow: hidden;
}

.search-band .address-results {
  border-top: 0;
}

.search-band .search-notice {
  font-weight: 600;
}

.search-band .search-help {
  font-size: .875rem;
  color: var(--ink-2);
}

.search-band .coverage {
  font-size: .8125rem;
  color: var(--ink-2);
}

.first-visit .wall {
  min-height: 0;
  padding: 32px;
}

.example {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 0;
}

.first-visit .wall .framed {
  --room-width: min(640px, 100cqw - 64px);
  /* Leave room under the print for its caption and credits. */
  --room-height: calc(100cqh - 64px - 7.5rem);
  --scale: 1;
}

.example .caption {
  max-width: 640px;
}

/* Settings */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--panel);
}

.settings {
  display: flex;
  flex-direction: column;
  gap: 1.375rem;
  padding: 1.5rem 1.75rem;
}

.settings fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.settings legend,
.settings label {
  margin: 0 0 .5rem;
  padding: 0;
  font-size: .8125rem;
  font-weight: 600;
}

.settings input:not([type=hidden]) {
  max-width: none;
  height: 44px;
  font-size: .94rem;
}

.side-by-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem;
}

.segments {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--track);
}

.segments button {
  padding: 0 .4rem;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-2);
  font-size: .875rem;
  line-height: 1.2;
}

.segments button[aria-pressed=true] {
  background: var(--field-bg);
  color: var(--ink);
  box-shadow: 0 1px 1px rgba(20, 18, 14, .2);
}

.segments button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.swatches {
  display: flex;
  gap: .5rem;
  padding: 3px 0;
}

.swatches button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--field);
  border-radius: 50%;
}

.swatches button[value=black] {
  background: #222225;
}

.swatches button[value=white] {
  background: #E0E2E0;
}

.swatches button[value=natural] {
  background: #D1AB82 url("/static/frames/natural.png") -150px 0 / 440px;
}

.swatches button[aria-pressed=true] {
  border: 3px solid var(--accent);
}

.swatches button[value=black][aria-pressed=true] {
  background-clip: content-box;
  padding: 2px;
}

.option-note {
  margin: .4rem 0 0;
  font-size: .8125rem;
  line-height: 1.4;
  color: var(--ink-2);
}

.count {
  display: block;
  margin-top: .25rem;
  font-size: .8125rem;
}

.count[hidden] {
  display: none;
}

.order-bar {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1.25rem 1.75rem 1.5rem;
  border-top: 1px solid var(--rule);
}

.order-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  margin: 0;
  font-size: .94rem;
}

.price {
  font-size: 1.5rem;
  font-weight: 600;
}

.order-bar .primary {
  min-height: 52px;
}

.sheet-handle {
  display: none;
}

@media (min-width: 1024px) {
  .configuring {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(340px, 27vw, 400px);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }

  .configuring .stage {
    min-height: 0;
    padding: 8rem 2.5rem 1.25rem;
    overflow-y: auto;
  }

  .search-box {
    position: absolute;
    z-index: 2;
    top: 20px;
    left: 24px;
    width: min(400px, calc(100% - 48px));
    border-radius: 6px;
    overflow: hidden;
  }

  .sidebar {
    grid-column: 2;
    grid-row: 1 / span 2;
    min-height: 0;
    border-left: 1px solid var(--rule);
  }

  .settings {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
}

@media (max-width: 1023.98px) {
  .title-bar {
    padding: 14px 16px;
  }

  .configuring .search-box {
    position: relative;
    z-index: 2;
    width: 100%;
    box-shadow: none;
    border-bottom: 1px solid var(--rule);
  }

  .configuring #address-results:not(:empty),
  .configuring .searching.htmx-request {
    position: absolute;
    top: 52px;
    right: 0;
    left: 0;
    background: var(--field-bg);
    box-shadow: var(--float-shadow);
  }

  .configuring .wall {
    width: calc(100% - 2rem);
  }

  .configuring .caption {
    padding: 0 1rem 1rem;
  }

  .configuring .order-bar {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: .75rem 1rem 1rem;
  }

  .configuring .order-summary {
    flex: 1;
    flex-direction: column;
    gap: 0;
    line-height: 1.3;
  }

  .configuring .price {
    font-size: 1.2rem;
  }

  .js .configuring .stage {
    padding-bottom: 136px;
  }

  .js .configuring .sidebar {
    position: fixed;
    z-index: 3;
    right: 0;
    bottom: 0;
    left: 0;
    border-top: 1px solid var(--rule);
  }

  .js .configuring .sheet-handle {
    position: relative;
    display: block;
    width: 100%;
    background: transparent;
    touch-action: none;
    cursor: grab;
  }

  .js .configuring .sheet-handle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 4px;
    margin: -2px 0 0 -22px;
    background: var(--field);
  }

  .js .configuring .settings {
    height: var(--sheet, 0);
    padding-top: 0;
    padding-bottom: 0;
    overflow-y: auto;
    visibility: hidden;
    transition: height .25s ease, visibility 0s .25s;
  }

  .js .configuring .sheet-open .settings,
  .js .configuring .sheet-open.sidebar .settings {
    visibility: visible;
    transition: height .25s ease;
  }

  .js .configuring .sheet-dragging.sidebar .settings {
    transition: none;
  }

  .js .configuring .settings > :last-child {
    padding-bottom: 1.5rem;
  }
}

@media (max-width: 820px) {
  .order-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .container {
    margin-top: 1rem;
  }

  .title-bar nav {
    gap: .7rem;
  }

  th,
  td {
    padding: .55rem;
  }

  .card {
    padding: .8rem;
  }

  .first-visit {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .search-band {
    padding: 12px 16px 24px;
  }

  .search-band h1 {
    font-size: 26px;
  }

  .search-band .search-field {
    flex-basis: 100%;
  }

  .search-band .search-submit {
    width: 100%;
  }

  /* Phones scroll: the print takes the width and its natural height. */
  .first-visit .wall {
    flex: none;
    container-type: inline-size;
    padding: 24px 16px 32px;
  }

  .first-visit .wall .framed {
    --print-width: calc(100cqw / (1 + 2 * var(--moulding-share)));
    box-sizing: border-box;
    width: 100%;
    height: auto;
  }

  .first-visit .wall .framed img {
    height: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wall .framed,
  .js .configuring .settings {
    transition: none;
  }

  .spinner {
    animation-duration: 3s;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
