/* Sunfiore — field survey instrument */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

@font-face {
  font-family: "Abril Fatface";
  src: url("../fonts/abril-fatface-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;

  --stock: #f1f4f2;
  --stock-deep: #e4e9e6;
  --blue: #22408f;
  --blue-soft: #8b9cc8;
  --blue-mid: #5a6ca3;
  --ink: #141414;
  --ink-2: #3a4540;
  --red: #c63b25;
  --mark: #f6d743;

  --rule: 2px solid var(--blue);
  --hair: 1px solid var(--blue-soft);
  --dots: 2px dotted var(--blue-soft);

  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --wordmark: "Abril Fatface", Didot, "Bodoni 72", serif;

  --gutter: clamp(1rem, 3vw, 2.5rem);
  --qcol: minmax(13rem, 3fr);
  --acol: 9fr;
  --sheet: 82rem;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--blue) var(--stock-deep);
  scroll-padding-top: 1.5rem;
}

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

body {
  margin: 0;
  background: var(--stock);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  caret-color: var(--red);
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--mark);
  color: var(--ink);
}

[hidden] { display: none !important; }

img { display: block; max-width: 100%; height: auto; }

h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

.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: var(--gutter);
  top: -4rem;
  z-index: 10;
  background: var(--red);
  color: #fff;
  padding: 0.6rem 1rem;
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 0.75rem; }

/* ---------- Sheet ---------- */

.sheet {
  max-width: var(--sheet);
  margin: 0 auto;
  padding: var(--gutter);
}

/* ---------- Instrument header: a row of form cells ---------- */

.masthead {
  display: grid;
  grid-template-columns: auto 1fr;
  border: var(--rule);
  background: var(--stock);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.25rem 0.95rem;
  border-right: var(--rule);
  text-decoration: none;
  color: var(--ink);
}

.brand__mark { width: 2rem; height: 2rem; flex: none; }

.brand__name {
  font-family: var(--wordmark);
  font-weight: 400;
  font-size: 1.85rem;
  line-height: 1;
  letter-spacing: 0;
}

.nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.55rem 0.9rem 0.7rem;
  border-right: var(--hair);
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.25s var(--ease-out);
}
.nav a:last-child { border-right: 0; }

.nav__code {
  font-stretch: 70%;
  font-weight: 650;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}

.nav__label {
  font-stretch: 88%;
  font-weight: 750;
  font-size: 1.05rem;
  line-height: 1.1;
}

.nav a:hover { background: var(--stock-deep); }
.nav a[aria-current="page"] { background: var(--mark); }
.nav a[aria-current="page"] .nav__code { color: var(--ink); }

/* ---------- Question rows ---------- */

.q {
  display: grid;
  grid-template-columns: var(--qcol) var(--acol);
  border-bottom: var(--rule);
  border-left: var(--rule);
  border-right: var(--rule);
}

.q__ask {
  padding: 1.5rem 1.25rem 1.75rem;
  border-right: var(--rule);
  color: var(--blue);
}

.q__num {
  display: block;
  font-stretch: 62%;
  font-weight: 700;
  font-size: clamp(2.75rem, 4.5vw, 4rem);
  line-height: 0.9;
  letter-spacing: -0.01em;
}

.q__text {
  display: block;
  margin-top: 0.6rem;
  font-stretch: 85%;
  font-weight: 650;
  font-size: 1.2rem;
  line-height: 1.32;
  max-width: 14em;
  text-wrap: balance;
}

.q__note {
  display: block;
  margin-top: 0.9rem;
  font-stretch: 85%;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--blue);
}

.q__answer {
  padding: 1.5rem clamp(1.25rem, 3vw, 2.5rem) 2rem;
  min-width: 0;
}

/* ---------- Q1: mission ---------- */

.mission {
  font-stretch: 100%;
  font-weight: 830;
  font-size: clamp(2.6rem, 6.2vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  max-width: 15ch;
  text-wrap: balance;
  padding-top: 0.25rem;
}

.mark {
  background-image: linear-gradient(var(--mark), var(--mark));
  background-repeat: no-repeat;
  background-position: 0 88%;
  background-size: 100% 0.42em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  padding: 0 0.06em;
  margin: 0 -0.06em;
}

@media (prefers-reduced-motion: no-preference) {
  .mark--sweep {
    animation: sweep 1.1s var(--ease-out) 0.35s both;
  }
  @keyframes sweep {
    from { background-size: 0% 0.42em; }
    to { background-size: 100% 0.42em; }
  }
}

/* Skip instructions are the actions */

.skip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--red);
  font-stretch: 80%;
  font-weight: 750;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.skip svg {
  width: 1.6em;
  height: 1em;
  flex: none;
  transition: transform 0.35s var(--ease-out);
}

.skip span {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.22em;
}

.skip:hover svg,
.skip:focus-visible svg { transform: translateX(0.3rem); }

.mission + .skip,
.lede + .skip { margin-top: clamp(1.75rem, 3vw, 2.5rem); }

/* ---------- Attachment: field photographs ---------- */

.attachment {
  border-left: var(--rule);
  border-right: var(--rule);
  border-bottom: var(--rule);
}

.attachment__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.6rem 1.25rem;
  border-bottom: var(--hair);
  color: var(--blue);
  font-stretch: 75%;
  font-weight: 650;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.attachment img {
  width: 100%;
  aspect-ratio: 2094 / 796;
  object-fit: cover;
  background: var(--stock-deep);
}

/* ---------- Coded responses (services, product) ---------- */

.codes {
  list-style: none;
  padding: 0;
}

.code {
  display: grid;
  grid-template-columns: 3.25rem minmax(9rem, 14rem) 1fr;
  gap: 0.5rem 1.5rem;
  align-items: start;
  padding: 1.35rem 0;
  border-bottom: var(--dots);
}
.code:first-child { padding-top: 0.5rem; }
.code:last-child { border-bottom: 0; padding-bottom: 0.25rem; }

.code__box {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border: var(--rule);
  color: var(--blue);
  font-stretch: 70%;
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1;
}

/* Ink ring an enumerator draws around the chosen code */
.code__ring {
  position: absolute;
  inset: -0.75rem;
  width: calc(100% + 1.5rem);
  height: calc(100% + 1.5rem);
  pointer-events: none;
  overflow: visible;
}
.code__ring path {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.55s var(--ease-out);
}
.code:hover .code__ring path,
.code:active .code__ring path,
.code:focus-within .code__ring path,
.code.is-ringed .code__ring path {
  stroke-dashoffset: 0;
}

.code__name {
  font-stretch: 100%;
  font-weight: 800;
  font-size: clamp(1.6rem, 2.6vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  padding-top: 0.35rem;
}

.code__desc {
  color: var(--ink-2);
  max-width: 34rem;
  padding-top: 0.55rem;
  font-size: 1.0625rem;
}

/* Product row */

.product {
  display: grid;
  grid-template-columns: 3.25rem auto 1fr;
  gap: 1rem 1.5rem;
  align-items: center;
}

.product__logo {
  width: 8.5rem;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 0.75rem;
  border: var(--hair);
  background: #fff;
}
.product__logo--flush { padding: 0; object-fit: cover; }

.product__body { display: grid; gap: 0.6rem; justify-items: start; }
.product__body .code__desc { padding-top: 0; grid-column: auto; }

.product__name {
  font-weight: 800;
  font-size: clamp(1.6rem, 2.6vw, 2.25rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.ext {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 650;
  color: var(--blue);
}
.ext svg { width: 0.9em; height: 0.9em; }
.ext:hover { color: var(--ink); }

/* ---------- Contact fields ---------- */

.fields {
  display: grid;
  grid-template-columns: minmax(6rem, 9rem) 1fr;
  border: var(--hair);
  background: var(--stock);
}

.fields dt,
.fields dd {
  padding: 1rem 1.25rem;
  border-bottom: var(--hair);
}
.fields dt:last-of-type,
.fields dd:last-of-type { border-bottom: 0; }

.fields dt {
  border-right: var(--hair);
  color: var(--blue);
  font-stretch: 75%;
  font-weight: 650;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-top: 1.2rem;
}

.email {
  display: inline-block;
  font-weight: 800;
  font-size: clamp(1.45rem, 3.4vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration-color: var(--red);
  text-decoration-thickness: 3px;
  overflow-wrap: anywhere;
}
.email:hover { text-decoration-color: var(--ink); }

.email-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.9rem;
  padding: 0.55rem 1.1rem;
  border: var(--rule);
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-stretch: 85%;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}
.btn svg { width: 1.1rem; height: 1.1rem; flex: none; }
.btn:hover { background: var(--blue); color: var(--stock); }

.btn--red {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}
.btn--red:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

.btn[data-state="done"] { background: var(--mark); border-color: var(--ink); color: var(--ink); }

.address {
  font-style: normal;
  line-height: 1.5;
}
.address strong { font-weight: 750; }

.lede {
  font-size: 1.25rem;
  line-height: 1.5;
  max-width: 38rem;
  color: var(--ink-2);
}

.q__answer > * + .fields { margin-top: 2rem; }

/* ---------- Page title row (inner pages) ---------- */

.title {
  font-weight: 830;
  font-size: clamp(2.3rem, 5vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.03em;
  max-width: 18ch;
  text-wrap: balance;
}
.title + .lede { margin-top: 1.25rem; }

/* ---------- Document (privacy policy) ---------- */

.doc {
  display: grid;
  grid-template-columns: var(--qcol) var(--acol);
  border-left: var(--rule);
  border-right: var(--rule);
  border-bottom: var(--rule);
}

.toc {
  border-right: var(--rule);
  padding: 1.5rem 1.25rem;
  color: var(--blue);
}

.toc__inner { position: sticky; top: 1.5rem; }

.toc h2 {
  font-stretch: 75%;
  font-weight: 650;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.toc ol {
  list-style: none;
  padding: 0;
  counter-reset: toc;
  display: grid;
  gap: 0.15rem;
}

.toc li { counter-increment: toc; }

.toc a {
  display: grid;
  grid-template-columns: 1.9rem 1fr;
  padding: 0.3rem 0;
  font-stretch: 88%;
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.3;
  text-decoration: none;
  color: var(--blue);
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-stretch: 70%;
  color: var(--blue-mid);
}
.toc a:hover { color: var(--ink); }

.prose {
  padding: 2rem clamp(1.25rem, 3vw, 2.5rem) 3rem;
  max-width: 46rem;
  min-width: 0;
}

.prose > * + * { margin-top: 1rem; }
.prose > p,
.prose > ul,
.prose > .closing { max-width: 68ch; }

.prose h2 {
  margin-top: 2.75rem;
  padding-top: 1rem;
  border-top: var(--hair);
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
  scroll-margin-top: 1.5rem;
}
.prose h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose h2 + * { margin-top: 0.75rem; }

.prose ul {
  padding-left: 1.25rem;
}
.prose li + li { margin-top: 0.35rem; }
.prose li::marker { color: var(--blue); }

.prose a { color: var(--blue); }
.prose a:hover { color: var(--ink); }

.prose .closing {
  margin-top: 2.5rem;
  padding: 1.1rem 1.25rem;
  border: var(--rule);
  background: var(--stock-deep);
}

.effective {
  display: inline-flex;
  margin-top: 1.5rem;
  border: var(--hair);
}
.effective span {
  padding: 0.5rem 0.9rem;
}
.effective span:first-child {
  border-right: var(--hair);
  color: var(--blue);
  font-stretch: 75%;
  font-weight: 650;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
}

/* ---------- End of instrument ---------- */

.end {
  border-left: var(--rule);
  border-right: var(--rule);
  border-bottom: var(--rule);
  padding: clamp(2rem, 5vw, 3.5rem) 1.25rem;
  text-align: center;
  color: var(--blue);
}

.end__title {
  font-stretch: 70%;
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.end__thanks {
  margin-top: 0.4rem;
  font-size: 1.1rem;
  font-style: italic;
}

.colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: 1.1rem 0.25rem 0;
  color: var(--ink-2);
  font-size: 0.92rem;
}
.colophon nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.colophon a { color: var(--blue); }
.colophon a:hover { color: var(--ink); }

/* ---------- Responsive ---------- */

@media (max-width: 60rem) {
  :root { --qcol: minmax(10rem, 2.4fr); }
  .code:not(.product) { grid-template-columns: 3.25rem 1fr; }
  .code__desc { grid-column: 2; padding-top: 0; }
}

@media (max-width: 46rem) {
  .masthead { grid-template-columns: 1fr; }
  .brand { border-right: 0; border-bottom: var(--rule); justify-content: flex-start; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav a:nth-child(2) { border-right: 0; }
  .nav a:nth-child(-n + 2) { border-bottom: var(--hair); }

  .q,
  .doc { grid-template-columns: 1fr; }

  .q__ask {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 0.25rem 0.85rem;
    border-right: 0;
    border-bottom: var(--hair);
    padding: 1rem 1rem 0.9rem;
  }
  .q__num { font-size: 2.25rem; }
  .q__text { margin-top: 0; max-width: none; }
  .q__note { grid-column: 1 / -1; margin-top: 0.25rem; }

  .q__answer { padding: 1.25rem 1rem 1.75rem; }

  .toc { border-right: 0; border-bottom: var(--rule); padding: 1.25rem 1rem; }
  .toc__inner { position: static; }
  .prose { padding: 1.5rem 1rem 2.5rem; }

  .product { grid-template-columns: 3.25rem 1fr; }
  .product__logo { grid-column: 2; width: 7rem; }
  .product__body { grid-column: 2; }

  .fields { grid-template-columns: 1fr; }
  .fields dt { border-right: 0; border-bottom: 0; padding: 0.9rem 1rem 0; }
  .fields dd { padding: 0.35rem 1rem 1rem; }
  .fields dd:not(:last-of-type) { border-bottom: var(--hair); }

  .attachment img { aspect-ratio: 4 / 3; object-position: 30% 50%; }
}

@media (max-width: 24rem) {
  .brand__name { font-size: 1.6rem; }
  .nav__label { font-size: 0.98rem; }
}

@media print {
  .skip-link, .email-actions, .toc { display: none; }
  .doc { grid-template-columns: 1fr; }
}
