/* ========================================
   learn's own typography.
   This file re-dresses style.css, which is still a verbatim copy of web_pablo:
   nothing is touched there; here the two families are swapped and the sizes
   that were tuned to the pixel fonts are recomputed.

   Why they have to be recomputed: Press Start 2P and VT323 draw glyphs that
   fill almost the whole em, so 0.5rem was legible. With a normal sans that same
   value would be illegible. The sizes below are the same elements, converted to
   the proportions of a sans.
   ======================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-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;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('../fonts/space-grotesk-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;
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('../fonts/space-grotesk-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-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Space Grotesk', system-ui, sans-serif;
  --max-width: 980px;
}

/* On desktop we make better use of the available width. The breakpoint keeps
   the current behaviour on mobile and tablet, where the content already fills
   almost the whole viewport. */
@media (min-width: 1100px) {
  :root {
    --max-width: 1180px;
  }
}

/* 21px existed because VT323 draws small inside its em. Space Grotesk does not. */
html {
  font-size: 17px;
}

@media (min-width: 1100px) {
  html {
    font-size: 18px;
  }
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings carry a touch of negative tracking: at a large size, a grotesque
   breathes better that way. */
h1,
h2,
h3 {
  letter-spacing: -0.015em;
}

/* The page heading is the first thing read and rules the hierarchy, so it goes
   large and with air around it. The tracking drops one notch more than the
   rest: the larger the size, the wider the gap between letters opens. */
h1 {
  font-size: 3.1rem;
  line-height: 1.06;
  letter-spacing: -0.035em;
  margin-bottom: 1.9rem;
}

/* The home page recovers the visual voice of pablomagarinos.es without moving
   the pixel typography into the rest of the interface. The fixed slot keeps the
   content from jumping while the title appears. */
.home-title {
  display: flex;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(1.85rem, 8vw, 3.2rem);
  letter-spacing: 0;
  text-align: center;
}

.home-title::after {
  content: none;
}

.home-title__slot {
  display: inline-flex;
  justify-content: flex-start;
}

.home-title__typing {
  display: inline-block;
  white-space: nowrap;
  text-shadow: 0 0 28px color-mix(in srgb, var(--color-header-accent) 35%, transparent);
}

.home-title__dot {
  color: var(--color-header-accent);
}

/* The warm glow behind the brand, the one of the maintenance page. It hangs
   from the heading and not from the page so it scrolls away with it. */
.home-title {
  position: relative;
  isolation: isolate;
}

.home-title::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  width: min(92vw, 42rem);
  aspect-ratio: 1.6;
  translate: -50% -50%;
  background: radial-gradient(
    ellipse at center,
    color-mix(in srgb, var(--color-header-accent) 20%, transparent),
    color-mix(in srgb, var(--color-header-accent) 6%, transparent) 45%,
    transparent 70%
  );
  filter: blur(10px);
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .home-title::before {
    animation: home-title-breathe 7s ease-in-out infinite;
  }

  @keyframes home-title-breathe {
    50% { scale: 1.12; opacity: 0.7; }
  }
}

/* With one or two subjects the grid would leave them stuck to the left: the
   columns take a bounded width and the row centres. */
.home-subjects {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 22rem));
  justify-content: center;
}

.home-intro {
  margin: -0.65rem 0 2.75rem;
  color: var(--color-muted);
  font-size: 1.08rem;
  letter-spacing: 0.035em;
  text-align: center;
}

.home-section-title {
  text-align: center;
  font-size: 2.3rem;
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.035em;
  color: var(--color-header-accent);
  margin-top: 3.25rem;
  margin-bottom: 1.4rem;
}

.home-divider {
  border: none;
  border-top: 2px dashed var(--color-header-accent);
  width: 100%;
  max-width: 20rem;
  margin: 3.5rem auto 3rem;
  opacity: 0.75;
}

.home-about {
  margin-top: 2rem;
}

.home-about__lead {
  text-align: center;
  font-size: 1.08rem;
  color: var(--color-muted);
  max-width: 38rem;
  margin: -0.25rem auto 1.75rem;
  line-height: 1.6;
}

/* "¿Qué es esta web?": three principles as open columns, not cards —the
   cards are «Funcionalidades», right below—. On a phone each is a row with
   its number on the left, between hairlines; on a wide screen, three
   columns split by a gold hairline that fades at both ends. The number is
   the brand's pixel face in outline, and fills in on hover; it, its rule
   and the title take the pillar's accent (`.home-accent--*`, in
   `quiz.css`), the gold when it names none. */
.home-pillars {
  display: grid;
  grid-template-columns: 1fr;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.home-pillar {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  /* The columns stretch to the tallest; without this the spare height
     would go into each one's rows and the numbers would not line up. */
  align-content: start;
  gap: 0 1rem;
  margin: 0;
  padding: 1.35rem 0;
  border-top: 1px solid var(--color-line);
}

.home-pillar:last-child {
  border-bottom: 1px solid var(--color-line);
}

.home-pillar__number {
  padding-top: 0.15rem;
  font-family: 'Press Start 2P', monospace;
  font-size: 1.35rem;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--home-accent, var(--color-header-accent));
  transition: color 0.3s ease;
}

.home-pillar:hover .home-pillar__number {
  color: var(--home-accent, var(--color-header-accent));
}

.home-pillar__title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--home-accent, var(--color-header-accent));
  margin: 0 0 0.45rem;
}

.home-pillar__text {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.6;
  color: var(--color-muted);
  text-wrap: pretty;
}

.home-pillar__text strong {
  color: var(--color-text);
  font-weight: 600;
}

@media (min-width: 760px) {
  .home-pillars {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 2.4rem;
  }

  .home-pillar,
  .home-pillar:last-child {
    grid-template-columns: 1fr;
    padding: 0.3rem 2rem 0.5rem;
    border: none;
  }

  .home-pillar:first-child {
    padding-left: 0.4rem;
  }

  .home-pillar:last-child {
    padding-right: 0.4rem;
  }

  .home-pillar + .home-pillar {
    border-left: 1px solid;
    border-image: linear-gradient(to bottom, transparent, var(--color-line-hover) 20%, var(--color-line-hover) 80%, transparent) 1;
  }

  /* The number over a short gold rule, which marks where each column
     starts. */
  .home-pillar__number {
    font-size: 1.9rem;
    margin-bottom: 1.1rem;
    padding-bottom: 1rem;
    background: linear-gradient(90deg, var(--home-accent, var(--color-header-accent)), transparent) bottom left / 2.6rem 2px no-repeat;
  }
}

/* The cards of «Funcionalidades». */
.home-feature-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  padding: 1.3rem 1.35rem 1.4rem;
  border: 1px solid color-mix(in srgb, var(--home-accent, var(--color-header-accent)) 30%, var(--color-line));
  border-radius: var(--radius-card);
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--home-accent, var(--color-header-accent)) 7%, transparent), transparent 60%),
    var(--color-surface);
  /* A stripe of the accent along the top, as the roadmap's cards carry one
     down their side. */
  box-shadow: inset 0 3px 0 var(--home-accent, var(--color-header-accent));
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-feature-card:hover {
  border-color: color-mix(in srgb, var(--home-accent, var(--color-header-accent)) 65%, transparent);
  box-shadow: inset 0 3px 0 var(--home-accent, var(--color-header-accent)), var(--shadow-lift);
}

.home-feature-card__title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--home-accent, var(--color-header-accent));
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.home-feature-card__text {
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--color-muted);
  margin-bottom: 0;
}

@media (prefers-reduced-motion: no-preference) {
  /* The caret is a border, so it takes room on the right of the letters and
     would push the centred brand a hair to the left. The negative margin
     gives that room back: the letters centre on their own and the caret hangs
     outside the box. */
  .home-title__typing {
    border-right: 0.12em solid var(--color-header-accent);
    margin-right: -0.12em;
    animation:
      home-title-typing 0.62s steps(9, end) 0.1s forwards,
      home-title-caret 0.65s step-end 0.1s infinite;
  }

  @keyframes home-title-typing {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0); }
  }

  @keyframes home-title-caret {
    50% { border-color: transparent; }
  }
}

/* main leaves 2rem on top and .content another 1rem to the first child. With
   the heading at this size it still looks glued to the header, so more space is
   added —also when what opens the page is the breadcrumbs—. */
.content > h1:first-child,
.breadcrumb + h1 {
  margin-top: 1.8rem;
}

/* The paragraph right under the heading is the page's standfirst.
   `:not([class])` tells it apart from the paragraphs with a role of their own
   —the score in `summary.html`, the button row in `error.html`— which bring
   their own style and must not grow. */
.content > h1 + p:not([class]) {
  font-size: 1.12rem;
  line-height: 1.65;
  color: var(--color-muted);
  margin-bottom: 1.4rem;
  max-width: 54ch;
}

/* Section headings grow along with it, and separate from what came before: the
   jump in size only reads as hierarchy if there is space to go with it. */
h2 {
  font-size: 1.85rem;
  line-height: 1.2;
  margin-top: 2.8rem;
  margin-bottom: 1.15rem;
}

h3 {
  font-size: 1.32rem;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.8rem;
}

/* A heading does not drag that margin if it is the first thing on the page or
   if it comes right after the one above: there the space is set by what
   precedes it. */
.content > h2:first-child,
.content > h3:first-child,
h1 + h2,
h2 + h3 {
  margin-top: 0;
}

/* The "Preguntas" of the scope pages carries a subtitle line right below, and
   `.question-list-title` keeps it at 0.35rem on purpose: title and subtitle are
   one unit, and the real separation is set by the subtitle. That pair was
   measured for a 1.35rem h2; with the current one it has to be opened in the
   same proportion, or the subtitle rides over it. */
.question-list-title {
  margin-bottom: 0.5rem;
}

.question-list-intro {
  margin-bottom: 1.6rem;
}

.site-brand {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0;
}

/* --- Away with the capitals ---
   They were uppercased because the pixel font barely distinguished lower case.
   With a modern sans, uppercase reads worse and sounds dated. */
.site-nav__link,
.essay-tag,
.btn,
.quiz-progress,
.question__ref,
.choice__mark,
.feedback__verdict,
.question-card__ref,
.summary-list__ref {
  text-transform: none;
  letter-spacing: 0;
}

.site-nav__link {
  font-size: 0.88rem;
  font-weight: 500;
}

.essay-tag {
  font-size: 0.75rem;
}

/* --- Questionnaires --- */

.btn {
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 0.85rem;
}

.quiz-progress {
  font-size: 0.82rem;
  font-weight: 500;
}

.question__ref,
.question-card__ref,
.question-card__state,
.summary-list__ref,
.summary-list__mark {
  font-size: 0.78rem;
}

.question__name {
  font-size: 1.65rem;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-bottom: 0.9rem;
}

.choice__mark {
  font-size: 0.8rem;
}

.feedback__verdict {
  font-size: 1.05rem;
  line-height: 1.4;
}

/* The card titles grow with the rest: they are the h3 of that screen. */
.scope-list__title {
  font-size: 1.3rem;
  line-height: 1.3;
}

.scope-list__item--all .scope-list__title {
  font-size: 1.6rem;
}

.summary-score {
  font-size: 2.6rem;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  /* In a narrow column the same size breaks the headings over too many lines,
     so it drops; the air around it does not. */
  h1 {
    font-size: 2.35rem;
    margin-bottom: 1.4rem;
  }

  .content > h1:first-child,
  .breadcrumb + h1 {
    margin-top: 1rem;
  }

  .content > h1 + p:not([class]) {
    font-size: 1.05rem;
  }

  h2 {
    font-size: 1.5rem;
    margin-top: 2.2rem;
    margin-bottom: 1rem;
  }

  h3 {
    font-size: 1.2rem;
    margin-top: 1.6rem;
  }

  .site-brand {
    font-size: 0.8rem;
  }

  .site-nav__link {
    font-size: 0.82rem;
  }

  .site-nav__link {
    padding: 0.3rem 0.45rem;
  }

  .question__name {
    font-size: 1.4rem;
  }

  .scope-list__title {
    font-size: 1.18rem;
  }

  .scope-list__item--all .scope-list__title {
    font-size: 1.38rem;
  }

  .summary-score {
    font-size: 2.1rem;
  }
}

