/* ==========================================================================
   Tryworks site
   Structure only. Every colour, face and size is read from tokens.css;
   scripts/check.mjs fails the build if a literal colour or family lands here.
   Mobile first: base rules are the phone layout, min-width queries add.
   ========================================================================== */

/* Reset ------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, h1, h2, h3, p, dl, dd, figure, blockquote, ul, ol { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
input, button { font: inherit; color: inherit; }
h1, h2, h3 { font-size: inherit; font-weight: inherit; }

/* Base -------------------------------------------------------------------- */

body {
  background: var(--ground);
  color: var(--text);
  font-family: var(--face-house);
  font-size: var(--body-size);
  line-height: var(--body-lh);
  overflow-wrap: break-word;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: inherit; text-decoration-thickness: var(--hairline); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: var(--focus-width); }

:focus-visible {
  outline: var(--focus-width) solid var(--focus-colour);
  outline-offset: var(--focus-offset);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: calc(-1 * var(--space-10));
  background: var(--text);
  color: var(--ground);
  padding: var(--space-2) var(--space-3);
}
.skip-link:focus { top: var(--space-2); }

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

/* Type styles: the nine house styles as classes --------------------------- */

.t-display { font-family: var(--door-face); font-size: var(--display-size); line-height: var(--display-lh); font-weight: var(--door-face-weight); }
.t-title   { font-family: var(--door-face); font-size: var(--title-size);   line-height: var(--title-lh);   font-weight: var(--door-face-weight); }
.t-heading { font-family: var(--door-face); font-size: var(--heading-size); line-height: var(--heading-lh); font-weight: var(--door-face-weight); }
.t-lede    { font-size: var(--lede-size);   line-height: var(--lede-lh); }
.t-body    { font-size: var(--body-size);   line-height: var(--body-lh); }
.t-italic  { font-size: var(--italic-size); line-height: var(--italic-lh); font-style: italic; }
.t-small   { font-size: var(--small-size);  line-height: var(--small-lh); }
.t-label   {
  font-size: var(--label-size);
  line-height: var(--label-lh);
  text-transform: uppercase;
  letter-spacing: var(--label-tracking);
}
.t-data    { font-size: var(--data-size); line-height: var(--data-lh); font-variant-numeric: var(--data-numerals); }
.t-muted   { color: var(--text-muted); }

/* A title set in the line's cut: door face, line weight and style */
.t-cut { font-weight: var(--cut-weight); font-style: var(--cut-style); }

/* Layout ------------------------------------------------------------------ */

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.measure { max-width: var(--measure); }

.section { padding-block: var(--section-gap); }
.section + .section { border-top: var(--hairline) solid var(--rule-colour); }

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

.inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
}

/* Masthead ---------------------------------------------------------------- */

.masthead { border-bottom: var(--hairline) solid var(--rule-colour); }

.masthead__top {
  display: flex;
  justify-content: flex-end;
  padding-block: var(--space-2);
  color: var(--text-muted);
}
.masthead__top a { text-decoration: none; }
.masthead__top a:hover, .masthead__top a[aria-current] { color: var(--text); text-decoration: underline; }

.masthead__main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  padding-block: var(--space-4);
}

.masthead__nav { font-family: var(--face-house); }
.masthead__nav a { text-decoration: none; }
.masthead__nav a:hover, .masthead__nav a[aria-current] { text-decoration: underline; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.mark {
  display: block;
  height: var(--mark-height);
  aspect-ratio: var(--mark-ratio);
  background: var(--door-mark) center / contain no-repeat;
}
.mark--house { background-image: var(--house-mark); }

.wordmark {
  font-family: var(--wordmark-face);
  font-size: var(--wordmark-size);
  font-weight: var(--door-face-weight);
  letter-spacing: var(--wordmark-tracking);
  text-transform: uppercase;
  line-height: 1;
}

/* The house signature keeps the house face on every door */
.wordmark--house { font-family: var(--face-house); font-weight: var(--wordmark-house-weight); }

/* Stay variant: STAY, then a Tryworks imprint */
.masthead--stay .brand { flex-direction: column; align-items: flex-start; gap: var(--space-1); }
.masthead--stay .wordmark { font-size: var(--heading-size); }
.wordmark--title { font-size: var(--title-size); }
.stay-heading > * + * { margin-top: var(--space-1); } /* same spacing as the Stay masthead */
.imprint-line { font-family: var(--face-house); font-style: italic; font-size: var(--small-size); color: var(--text-muted); }

/* Line chip and line band -------------------------------------------------- */

.line-chip {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius);
  text-decoration: none;
}

.line-band {
  border-top: var(--space-1) solid var(--accent);
  padding-block: var(--space-6);
}
.line-band__name { color: var(--accent); }

/* Book entry -------------------------------------------------------------- */

.book-entry {
  display: grid;
  gap: var(--space-5);
  align-items: start;
}

.book-entry__cover {
  width: 100%;
  max-width: var(--cover-max);
  aspect-ratio: var(--cover-ratio);
  object-fit: cover;
  border: var(--hairline) solid var(--rule-colour);
}

.book-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }

/* Title and subtitle: the subtitle sits one type step below the title, in the door face,
   without the line's cut */
.book-entry__heading > * + *, .book-page__heading > * + * { margin-top: var(--space-2); }

.book-entry__title a { text-decoration: none; }
.book-entry__title a:hover { text-decoration: underline; }

.book-entry--large .book-entry__title { font-size: var(--display-size); line-height: var(--display-lh); }

/* Compact entries in a list */
.book-list { display: grid; gap: var(--space-7); }
.book-entry--compact { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-4); }
.book-entry--compact .book-entry__title { font-size: var(--heading-size); line-height: var(--heading-lh); }
.book-entry--compact .book-entry__subtitle { font-family: var(--face-house); font-size: var(--lede-size); line-height: var(--lede-lh); }

@media (min-width: 48rem) {
  .book-entry--large { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--grid-gap); align-items: end; }
  .book-entry--compact { grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: var(--grid-gap); }
}

/* The list by line */
.line-list > * + * { margin-top: var(--space-8); }
.line-group > * + * { margin-top: var(--space-5); }
.line-group__name { color: var(--accent); border-top: var(--space-1) solid var(--accent); padding-top: var(--space-3); }
.line-group__name a { text-decoration: none; }
.line-group__name a:hover { text-decoration: underline; }

/* Links out --------------------------------------------------------------- */

.links-out { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }

/* Book page --------------------------------------------------------------- */

.book-page { display: grid; gap: var(--space-6); }

@media (min-width: 48rem) {
  .book-page { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--grid-gap); align-items: start; }
  .book-page__cover { position: sticky; top: var(--space-5); }
}

.jacket > * + * { margin-top: var(--space-4); }

/* Trade data block -------------------------------------------------------- */

.trade-data {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-2) var(--space-5);
  border-top: var(--hairline) solid var(--rule-colour);
  padding-top: var(--space-4);
}
.trade-data dt { color: var(--text-muted); }

/* List signup: after the book, quieter than it ----------------------------- */

.signup { max-width: var(--measure); }

.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.signup__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.signup__input {
  flex: 1 1 14rem;
  min-width: 0;
  background: transparent;
  border: var(--hairline) solid var(--field-border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
}

.signup__button {
  background: transparent;
  border: var(--hairline) solid var(--field-border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
}
.signup__button:hover { background: var(--text); color: var(--ground); }

/* Stay band (home, off by default) ---------------------------------------- */

.stay-band {
  background: var(--ground);
  color: var(--text);
  padding-block: var(--space-7);
}

/* Prose (text template) --------------------------------------------------- */

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: var(--space-4); }
.prose h2 { font-family: var(--door-face); font-size: var(--heading-size); line-height: var(--heading-lh); font-weight: var(--door-face-weight); margin-top: var(--space-7); }
.prose ul { padding-left: var(--space-5); }

/* Colophon footer --------------------------------------------------------- */

.colophon {
  border-top: var(--hairline) solid var(--rule-colour);
  padding-block: var(--space-8) var(--space-7);
}

.colophon__grid { display: grid; gap: var(--space-6); }

@media (min-width: 48rem) {
  .colophon__grid { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--grid-gap); }
}

.colophon__sign { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-2); }

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