/* The guides and free tools. Colours and fonts are the brand's (the variables come
   from brand.config.ts, written into each page); this file only lays them out. */

@font-face {
  font-family: 'Fredoka Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url(/fonts/fredoka.woff2) format('woff2-variations');
}
@font-face {
  font-family: 'Instrument Sans Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url(/fonts/instrument-sans.woff2) format('woff2-variations');
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font: 400 1.0625rem/1.62 var(--brand-font-body);
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 48rem) {
  body {
    font-size: 1.125rem;
  }
}
a {
  color: var(--c-brand);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}
a:hover {
  text-decoration-thickness: 0.14em;
}
:focus-visible {
  outline: 3px solid var(--c-brand);
  outline-offset: 2px;
  border-radius: 6px;
}
img,
svg {
  max-width: 100%;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--c-surface);
  color: var(--c-ink);
  padding: 0.6rem 1rem;
  border-radius: 0.6rem;
  z-index: 10;
}
.skip:focus {
  top: 0.75rem;
}

/* header */
.top {
  border-bottom: 1px solid var(--c-line);
}
.top-in {
  max-width: 72rem;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 0.85rem) 1rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--c-ink);
  text-decoration: none;
  font: 600 1.45rem/1 var(--brand-font-display);
}
.logo svg {
  width: 30px;
  height: 30px;
}
.logo-quiet {
  font-size: 1.2rem;
}
.top-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.top-nav a:not(.btn) {
  color: var(--c-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 0.7rem;
  border-radius: 999px;
}
.top-nav a:not(.btn):hover {
  background: var(--c-panel);
}
@media (max-width: 30rem) {
  .top-nav a[href='/tools'] {
    display: none;
  }
}

/* buttons, the same pressable shape as the app's */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0 1.4rem;
  border-radius: 999px;
  background: var(--c-brand);
  color: var(--c-on-brand);
  font: 600 1.05rem/1 var(--brand-font-display);
  text-decoration: none;
  box-shadow: 0 4px 0 var(--c-brand-lip);
  transition: transform 80ms ease, box-shadow 80ms ease;
}
.btn:hover {
  text-decoration: none;
  filter: brightness(1.04);
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--c-brand-lip);
}
.btn-sm {
  min-height: 2.4rem;
  padding: 0 1rem;
  font-size: 0.95rem;
  box-shadow: 0 3px 0 var(--c-brand-lip);
  margin-left: 0.25rem;
}

/* page */
.page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}
.crumbs {
  font-size: 0.85rem;
  color: var(--c-muted);
  margin: 1.25rem 0 0;
}
.crumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.crumbs li + li::before {
  content: '›';
  margin-right: 0.35rem;
  color: var(--c-muted);
}
.crumbs a {
  color: var(--c-muted);
}
.crumbs [aria-current] {
  color: var(--c-ink);
}
/* on a phone the page's own name is the heading right below */
@media (max-width: 40rem) {
  .crumbs li:last-child {
    display: none;
  }
}

h1,
h2,
h3 {
  font-family: var(--brand-font-display);
  font-weight: 600;
  color: var(--c-ink);
  text-wrap: balance;
}
h1 {
  font-size: clamp(2.05rem, 1.35rem + 2.8vw, 3.1rem);
  line-height: 1.07;
  letter-spacing: -0.012em;
  margin: 1.1rem 0 0.75rem;
}
h2 {
  font-size: 1.55rem;
  line-height: 1.2;
  margin: 2.6rem 0 0.7rem;
}
h3 {
  font-size: 1.16rem;
  line-height: 1.3;
  margin: 1.8rem 0 0.4rem;
}
p,
ul,
ol {
  margin: 0 0 1rem;
}
li {
  margin: 0.3rem 0;
}
li > p {
  margin: 0;
}

.guide-meta {
  color: var(--c-muted);
  font-size: 0.92rem;
  margin: 0 0 1.5rem;
}
.guide-meta a {
  color: inherit;
}
.answer {
  background: var(--c-panel);
  border-radius: 1.25rem;
  padding: 1.15rem 1.35rem;
  font-size: 1.2rem;
  line-height: 1.5;
  margin: 0 0 2rem;
}

.prose ol,
.prose ul {
  padding-left: 1.4rem;
}
.prose strong {
  font-weight: 650;
}

code {
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--c-brand-soft);
  color: var(--c-ink);
  padding: 0.08em 0.38em;
  border-radius: 0.35em;
  /* a code is short and reads as one thing: never split it at its dashes */
  white-space: nowrap;
}
.name-line code,
.result code {
  white-space: normal;
  overflow-wrap: anywhere;
}
.name-line code {
  display: inline-block;
  font-size: 0.95rem;
  line-height: 1.45;
  padding: 0.55rem 0.8rem;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 0.7rem;
}

.table-scroll {
  overflow-x: auto;
  margin: 0 0 1.25rem;
  border: 1px solid var(--c-line);
  border-radius: 0.9rem;
  background: var(--c-surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.45;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--c-line);
}
th {
  font-weight: 650;
  background: var(--c-panel);
}
tr:last-child td {
  border-bottom: 0;
}
td code {
  white-space: nowrap;
}

/* the code, taken apart */
.code-anatomy {
  margin: 1.25rem 0 1.5rem;
  display: grid;
  grid-template-columns: auto auto auto auto auto;
  justify-content: start;
  align-items: start;
  column-gap: 0.45rem;
  row-gap: 0.75rem;
}
.code-part {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
  min-width: 0;
}
.code-chunk {
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 650;
  font-size: clamp(1.35rem, 1rem + 1.6vw, 2rem);
  line-height: 1.2;
  background: var(--c-brand-soft);
  border-radius: 0.8rem;
  padding: 0.35rem 0.7rem;
  margin-bottom: 0.35rem;
  width: max-content;
}
.code-part-level .code-chunk {
  background: var(--c-accent-soft);
}
.code-dash {
  font: 650 clamp(1.35rem, 1rem + 1.6vw, 2rem) / 1.2 ui-monospace, Menlo, monospace;
  padding-top: 0.35rem;
  color: var(--c-muted);
}
.code-what {
  font-weight: 650;
  font-size: 0.92rem;
  line-height: 1.3;
}
.code-how {
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--c-muted);
}
.code-anatomy figcaption {
  grid-column: 1 / -1;
  color: var(--c-muted);
  font-size: 0.9rem;
}

/* task lists */
.contains-task-list {
  list-style: none;
  padding-left: 0 !important;
}
.task-list-item input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0 0.55rem 0 0;
  vertical-align: -0.12em;
  accent-color: var(--c-brand);
}

.draft {
  background: var(--c-warn-soft);
  border-left: 4px solid var(--c-warn);
  border-radius: 0.8rem;
  padding: 0.85rem 1.1rem;
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}
.draft p,
.draft ul {
  margin: 0.25rem 0;
}
.draft-title {
  font-weight: 700;
}

.tool-card {
  display: grid;
  gap: 0.15rem;
  margin: 2.25rem 0 0;
  padding: 1.1rem 1.3rem;
  border: 1.5px solid var(--c-line);
  border-radius: 1.1rem;
  background: var(--c-surface);
  color: var(--c-ink);
  text-decoration: none;
}
.tool-card:hover {
  border-color: var(--c-brand);
}
.tool-card-kicker {
  font-size: 0.85rem;
  color: var(--c-muted);
}
.tool-card-name {
  font: 600 1.25rem/1.25 var(--brand-font-display);
  color: var(--c-brand);
}
.tool-card-note {
  color: var(--c-muted);
  font-size: 0.95rem;
}

.faq h3:first-of-type {
  margin-top: 0.75rem;
}
.sources ul {
  padding-left: 1.2rem;
  font-size: 0.95rem;
}

/* lists of links: read next, the index pages */
.link-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}
.link-list li {
  margin: 0;
  border-top: 1px solid var(--c-line);
}
.link-list li:last-child {
  border-bottom: 1px solid var(--c-line);
}
.link-list a {
  display: grid;
  gap: 0.2rem;
  padding: 0.95rem 0.1rem;
  text-decoration: none;
}
.ll-title {
  font: 600 1.15rem/1.3 var(--brand-font-display);
  color: var(--c-ink);
}
.link-list a:hover .ll-title {
  color: var(--c-brand);
}
.ll-note {
  color: var(--c-muted);
  font-size: 0.95rem;
  line-height: 1.45;
}
.badge {
  display: inline-block;
  vertical-align: 0.15em;
  margin-left: 0.4rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--c-warn-soft);
  color: var(--c-warn);
  font: 700 0.72rem/1.3 var(--brand-font-body);
}

.next {
  margin-top: 3rem;
}
.next h2 {
  margin: 0;
}

.cta {
  margin: 3rem 0 0;
  padding: 1.5rem 1.5rem 1.65rem;
  border-radius: 1.5rem;
  background: var(--c-brand-soft);
}
.cta h2 {
  margin: 0 0 0.5rem;
  font-size: 1.45rem;
}
.cta p {
  margin: 0 0 1.15rem;
}

/* index pages */
.hub-head {
  margin-bottom: 1rem;
}
.lede {
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--c-muted);
  max-width: 38rem;
}
.topic {
  margin-top: 2.5rem;
}
.topic h2 {
  margin: 0 0 0.25rem;
}
.topic-blurb {
  color: var(--c-muted);
  margin: 0;
}

/* the tools */
.tool {
  margin: 0 0 2.25rem;
  padding: 1.25rem;
  border: 1.5px solid var(--c-line);
  border-radius: 1.35rem;
  background: var(--c-surface);
  display: grid;
  gap: 1.1rem;
}
.tool-row {
  display: grid;
  gap: 1.1rem;
}
@media (min-width: 36rem) {
  .tool-row {
    grid-template-columns: 1fr 1fr;
  }
}
.field {
  display: grid;
  gap: 0.35rem;
  /* side-by-side fields line up at the top, whatever help text sits under one of them */
  align-content: start;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.field-label {
  font-weight: 650;
  font-size: 0.95rem;
  padding: 0;
}
.field small {
  color: var(--c-muted);
  font-size: 0.82rem;
}
.field input,
.field select {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--c-ink);
  background: var(--c-bg);
  border: 1.5px solid var(--c-line);
  border-radius: 0.75rem;
  padding: 0 0.8rem;
  height: 3rem;
}
.field input:focus,
.field select:focus {
  border-color: var(--c-brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--c-brand-soft);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.15rem;
}
.chip {
  position: relative;
}
.chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
}
.chip span {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border: 1.5px solid var(--c-line);
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--c-bg);
  cursor: pointer;
}
.chip input:checked + span {
  background: var(--c-brand-soft);
  border-color: var(--c-brand);
}
.chip input:focus-visible + span {
  outline: 3px solid var(--c-brand);
  outline-offset: 2px;
}
.results {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 1rem;
  background: var(--c-panel);
}
.result {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.3rem 0.6rem;
}
.result-label {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--c-muted);
}
.result code {
  display: block;
  font-size: 0.98rem;
  line-height: 1.45;
  background: var(--c-surface);
  border-radius: 0.6rem;
  padding: 0.55rem 0.75rem;
  min-width: 0;
}
.copy {
  font: 600 0.92rem/1 var(--brand-font-display);
  color: var(--c-ink);
  background: var(--c-surface);
  border: 1.5px solid var(--c-line);
  border-radius: 999px;
  min-height: 2.5rem;
  padding: 0 0.95rem;
  cursor: pointer;
}
.copy:hover {
  border-color: var(--c-brand);
}
.result-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--c-muted);
}

/* footer */
.foot {
  border-top: 1px solid var(--c-line);
  color: var(--c-muted);
  font-size: 0.9rem;
}
.foot-in {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2.25rem 1rem max(env(safe-area-inset-bottom), 2.5rem);
  display: grid;
  gap: 1.75rem;
  grid-template-columns: 1fr 1fr;
}
.foot-brand {
  grid-column: 1 / -1;
}
.foot-brand p {
  max-width: 26rem;
  margin: 0.6rem 0 0;
}
@media (min-width: 48rem) {
  .foot-in {
    grid-template-columns: 2fr 1.4fr 1fr 1fr;
  }
  .foot-brand {
    grid-column: auto;
  }
}
.foot h2 {
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
}
.foot ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.foot li {
  margin: 0.35rem 0;
}
.foot a {
  color: var(--c-muted);
  text-decoration: none;
}
.foot a:hover {
  color: var(--c-ink);
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}
