/* Public technique content.
 *
 * Loaded only on the informational pages, after style.css.
 *
 * Two conventions inherited from style.css, deliberately:
 *   - no :root custom properties (the codebase has none, and introducing a token system
 *     in a side file would create two competing conventions)
 *   - every colour rule gets an explicit html[data-theme="dark"] twin
 *
 * All selectors are tex- prefixed, with one deliberate exception: the technique articles
 * render the real gameplay board, so .grid, .cell, .cell-fixed, .cell-value and the
 * cell-hint-* role classes come from style.css and this file sizes and positions them. It
 * must not restate their colours - a second description of one board is a second board.
 */

.tex-page {
  max-width: 68ch;
  margin: 0 auto;
  padding: 8px 0 32px;
}

html:not([data-background="off"]) .tex-page {
  background: rgba(246, 247, 249, 0.96);
  box-shadow: 0 0 0 12px rgba(246, 247, 249, 0.96);
  border-radius: 12px;
}

html[data-theme="dark"]:not([data-background="off"]) .tex-page {
  background: rgba(15, 19, 24, 0.96);
  box-shadow: 0 0 0 12px rgba(15, 19, 24, 0.96);
}

/* Masthead ---------------------------------------------------------------
 *
 * The gameplay page leads with the wordmark, centred. So does an article, at the same
 * size and in the same place, so the two read as one site rather than as a product and a
 * blog bolted together.
 *
 * Nothing here sizes or colours the wordmark: it carries .logo from style.css, exactly as
 * the gameplay header does. This rule only places it and makes it a target.
 */

.tex-masthead {
  display: flex;
  justify-content: center;
  /* The gameplay header's own bottom margin, so the wordmark sits the same distance
     above an article as it does above the board. */
  margin: 0 0 26px;
}

.tex-masthead-brand {
  display: inline-flex;
  text-decoration: none;
  border-radius: 6px;
}

.tex-masthead-brand:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 4px;
}

.tex-article {
  font-size: 17px;
  line-height: 1.65;
  color: #1f2937;
}

.tex-article h1 {
  font-size: 30px;
  line-height: 1.2;
  /* No top margin: the masthead sets the distance from the chrome to the content, and
     every article starts the same distance below that rule whether or not it has a
     breadcrumb in between. */
  margin: 0 0 16px;
  overflow-wrap: break-word;
}

.tex-article h2 {
  font-size: 21px;
  line-height: 1.3;
  margin: 32px 0 10px;
  overflow-wrap: break-word;
}

.tex-article h3 {
  font-size: 18px;
  margin: 0 0 6px;
}

.tex-article p {
  margin: 0 0 14px;
}

.tex-lead {
  font-size: 18px;
  color: #374151;
}

.tex-article a {
  color: #1d4ed8;
}

.tex-breadcrumb {
  font-size: 14px;
  margin: 0 0 10px;
}

.tex-steps,
.tex-related {
  margin: 0 0 14px;
  padding-left: 22px;
}

.tex-steps li,
.tex-related li {
  margin-bottom: 8px;
}

.tex-related-note {
  display: block;
  font-size: 15px;
  color: #4b5563;
}

/* Hub ------------------------------------------------------------------- */

.tex-technique-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}

.tex-technique-card {
  border: 1px solid #d9dee6;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: #fff;
}

.tex-technique-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tex-grade {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid #c9ced6;
  border-radius: 999px;
  padding: 2px 9px;
  color: #4b5563;
}

.tex-family {
  border-top: 1px solid #d9dee6;
  padding-top: 16px;
  margin-top: 22px;
}

.tex-family-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.tex-family-list li,
.tex-technique-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tex-technique-meta {
  color: #4b5563;
  font-size: 14px;
  margin-top: -8px;
}

.tex-progression {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid #d9dee6;
  padding-top: 18px;
  margin-top: 28px;
}

.tex-progression a:last-child {
  margin-left: auto;
  text-align: right;
}

.tex-foundation {
  margin: 0 0 16px;
}

.tex-foundation dt {
  font-weight: 700;
  margin-top: 10px;
}

.tex-foundation dd {
  margin: 2px 0 0;
  color: #4b5563;
}

/* Hint ladder ----------------------------------------------------------- */

.tex-hints {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  counter-reset: tex-hint;
}

.tex-hint {
  border-left: 3px solid #c9ced6;
  padding: 2px 0 2px 14px;
  margin-bottom: 12px;
}

.tex-hint-label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: #4b5563;
}

/* Example board ---------------------------------------------------------
 *
 * The board itself is the gameplay board: `.grid`, `.cell`, `cell-fixed`, `cell-value`
 * and the `cell-hint-*` role classes all come from style.css, applied to the same markup
 * gameplay renders. Nothing below restates a gameplay colour, border or font - only the
 * sizing the article needs and the layout of the candidate toggles, neither of which
 * exists in gameplay. That is also why this section has no dark-mode twin: there is no
 * colour here to have one.
 */

.tex-figure {
  margin: 0 0 20px;
}

/* 9 cells + the 2px frame must fit inside .container's 16px gutters on a narrow phone,
   which is what the subtracted 4px pays for. */
.tex-board {
  --cell-size: clamp(24px, calc(10.5vw - 4px), 40px);
  margin: 0 0 12px;
}

.tex-board .cell-value {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Candidates sit in a fixed 3x3 of slots, one per digit, so removing one leaves a hole
   instead of re-flowing the rest and losing the reader's place. Colour and size come from
   .cell-notes; pointer-events has to be given back, because gameplay's pencil marks are
   decoration and these are controls. */
.tex-board .tex-candidates {
  inset: 1px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  white-space: normal;
  pointer-events: auto;
  z-index: 3;
  font-size: calc(var(--cell-size, 44px) * 0.26);
}

.tex-candidate {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: none;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.tex-candidate--blank {
  cursor: default;
}

/* aria-pressed="true" is the removed state: the reader has struck this candidate out. */
.tex-candidate[aria-pressed="true"] {
  text-decoration: line-through;
  opacity: 0.35;
}

.tex-candidate:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -1px;
}

/* Exercise controls ------------------------------------------------------ */

.tex-exercise {
  margin: 0 0 14px;
}

.tex-exercise-intro {
  margin: 0 0 8px;
}

.tex-exercise-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}

/* Reserves the line so a verdict appearing does not shunt the caption downwards. */
.tex-exercise-feedback {
  margin: 0;
  min-height: 1.6em;
  font-weight: 600;
}

/* Caption and key -------------------------------------------------------- */

.tex-caption {
  font-size: 15px;
  color: #374151;
}

.tex-puzzle-label {
  margin: 0 0 6px;
  font-weight: 600;
}

.tex-caption-list {
  margin: 0 0 8px;
  padding-left: 20px;
}

.tex-caption-list li {
  margin-bottom: 3px;
}

.tex-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  font-size: 14px;
  margin: 0 0 8px;
}

.tex-legend-title {
  font-weight: 700;
}

.tex-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* A one-cell gameplay board, shrunk. It carries the same cell-hint-* class as the squares
   it describes, so the key is painted by the rule that paints the board. inline-flex makes
   the inner .cell a flex item, which is what lets the gameplay width and height apply to a
   span; the frame is thinned because 2px around a 15px chip is all frame. */
.tex-legend-swatch {
  --cell-size: 15px;
  display: inline-flex;
  border-width: 1px;
  vertical-align: middle;
}

/* Practice call to action ----------------------------------------------- */

.tex-cta-block {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  border-radius: 12px;
  padding: 16px 18px;
  margin: 28px 0;
}

.tex-cta-heading {
  margin-top: 0 !important;
  font-size: 19px;
}

.tex-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 10px;
  background: #1d4ed8;
  color: #fff !important;
  font-weight: 700;
  text-decoration: none;
}

.tex-cta:hover,
.tex-cta:focus-visible {
  background: #1e40af;
}

.tex-back {
  margin-top: 28px;
  font-size: 15px;
}

/* Dark mode ------------------------------------------------------------- */

html[data-theme="dark"] .tex-masthead-brand:focus-visible {
  outline-color: #93c5fd;
}

html[data-theme="dark"] .tex-article {
  color: #e9edf3;
}

html[data-theme="dark"] .tex-lead {
  color: #cbd5e1;
}

html[data-theme="dark"] .tex-article a {
  color: #93c5fd;
}

html[data-theme="dark"] .tex-related-note,
html[data-theme="dark"] .tex-foundation dd,
html[data-theme="dark"] .tex-hint-label,
html[data-theme="dark"] .tex-technique-meta,
html[data-theme="dark"] .tex-grade {
  color: #a6b0bf;
}

html[data-theme="dark"] .tex-technique-card {
  background: #151c25;
  border-color: #334155;
}

html[data-theme="dark"] .tex-grade {
  border-color: #334155;
}

html[data-theme="dark"] .tex-family,
html[data-theme="dark"] .tex-progression {
  border-color: #334155;
}

html[data-theme="dark"] .tex-hint {
  border-left-color: #334155;
}

html[data-theme="dark"] .tex-caption {
  color: #cbd5e1;
}

html[data-theme="dark"] .tex-cta-block {
  background: #14203a;
  border-color: #1e3a8a;
}

html[data-theme="dark"] .tex-cta {
  background: #2563eb;
}

html[data-theme="dark"] .tex-cta:hover,
html[data-theme="dark"] .tex-cta:focus-visible {
  background: #1d4ed8;
}

/* Small screens --------------------------------------------------------- */

@media (max-width: 480px) {
  .tex-article {
    font-size: 16px;
  }

  .tex-article h1 {
    font-size: 25px;
  }

  .tex-article h2 {
    font-size: 19px;
  }

  .tex-cta {
    width: 100%;
    /* This stylesheet sets no global border-box, so a content-box width:100% adds the
     * button's 44px of horizontal padding on top of its container and pushes every
     * technique page into horizontal scroll below 480px. */
    box-sizing: border-box;
  }
}

/* About page: play and techniques side by side, wrapping on a phone. */
.about-ctas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 12px 0 0;
}
/* The secondary call to action: the primary's shape, outlined. */
.tex-cta.tex-cta-secondary {
  border: 1px solid #c9ced6;
  background: #fff;
  color: #1d4ed8 !important;
}
.tex-cta.tex-cta-secondary:hover,
.tex-cta.tex-cta-secondary:focus-visible {
  background: #eef1f5;
  border-color: #1d4ed8;
}
html[data-theme="dark"] .tex-cta.tex-cta-secondary {
  background: #151c25;
  border-color: #334155;
  color: #93c5fd !important;
}
html[data-theme="dark"] .tex-cta.tex-cta-secondary:hover,
html[data-theme="dark"] .tex-cta.tex-cta-secondary:focus-visible {
  background: #1b2430;
  border-color: #93c5fd;
}
