/*
 * 入門30代 promo page
 * Colors are sampled from the cover artwork. LINE Seed JP is the closest
 * match to the cover lettering, so it carries both headings and body text.
 */

:root {
  --paper: #ffffff;
  --ink: #07263c;    /* cover title */
  --road: #173d64;   /* cover road and flag pole */
  --flag: #2e7dd0;   /* cover flag */
  --spark: #3986d7;  /* cover sparkle marks */
  --link: #1f64b0;   /* flag blue, darkened to pass AA as body text */
  --muted: #56687a;
  --mist: #eef4fa;
  --rule: #c9d6e2;

  --font: "LINE Seed JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;

  /* Below the desktop layout everything shares one column as wide as the cover,
     so the road leaves the cover straight into its lane. */
  --hero-column: 560px;
  --column: 560px;

  /* Road geometry. road.js reads these, so keep them in px. */
  --u: 0.356;           /* cover scale (rendered width / 1054), set by road.js */
  --road-w: 2px;        /* matches the cover's line weight, set by road.js */
  --gutter: 16px;
  --lane: 44px;         /* room on the left for the road */
  --road-x: 12px;       /* the road's lane, measured from the gutter */
  --road-turn: 20px;    /* how far each flag sits from the lane */
  --hairpin: 68px;      /* height of the switchback above each chapter */
  --chapter-gap: 64px;  /* space between a chapter and the next switchback */
  --to-heading: 28px;   /* space between a flag's road and its heading */

  color-scheme: light;
}

@media (min-width: 960px) {
  :root {
    --hero-column: 1200px;
    --column: 1040px;
    --u: 0.55;
    --gutter: 32px;
    --lane: 104px;
    --road-x: 24px;
    --road-turn: 32px;
    --hairpin: 96px;
    --chapter-gap: 112px;
    --to-heading: 40px;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: 0.04em;
  line-break: strict;
  overflow-wrap: anywhere;
  text-spacing-trim: space-first;
  -webkit-font-smoothing: antialiased;
}

@media (min-width: 960px) {
  body {
    font-size: 17px;
  }
}

img,
svg {
  display: block;
  max-width: 100%;
}

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

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2 {
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-wrap: balance;
  word-break: auto-phrase;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

/* Keeps a Japanese phrase (a date, a place name) on one line when it wraps */
.phrase {
  display: inline-block;
}

/* Read by screen readers, but not shown */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page {
  position: relative;
  overflow-x: clip;
}

/* Hero ------------------------------------------------------------------ */

.hero {
  display: grid;
  max-width: var(--hero-column);
  margin: 0 auto;
}

/* The cover is shown without a frame so its white page becomes the site's page. */
.hero__cover img {
  width: 100%;
  height: auto;
  margin-inline: auto;
}

.hero__event {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.pill {
  padding: 2px 12px 1px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.12em;
}

.hero__heading {
  margin-top: 20px;
}

.hero__title {
  font-size: clamp(48px, 5.4vw, 76px);
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.hero__catch {
  margin-top: 14px;
  font-size: clamp(17px, 1.5vw, 20px);
  font-weight: 700;
  line-height: 1.6;
}

.hero__lead {
  max-width: 30em;
  margin-top: 16px;
  word-break: auto-phrase;
}

.hero__dates {
  display: grid;
  gap: 6px;
  margin-top: 28px;
  font-size: 14px;
  line-height: 1.7;
}

.hero__dates div {
  display: grid;
  grid-template-columns: 5.5em minmax(0, 1fr);
  gap: 8px;
}

.hero__dates dt {
  color: var(--muted);
}

@media (max-width: 959px) {
  .hero__cover {
    padding-inline: var(--gutter);
  }

  .hero__body {
    padding: 4px var(--gutter) 0 calc(var(--gutter) + var(--lane));
  }

  /* The cover right above already shows the title and catch copy. */
  .hero__heading {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

@media (min-width: 960px) {
  .hero {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: clamp(40px, 6vw, 96px);
    padding: 24px var(--gutter);
  }

  .hero__cover img {
    width: min(44vw, calc((100vh - 48px) * 0.706), 620px);
    width: min(44vw, calc((100svh - 48px) * 0.706), 620px);
  }

  .hero__lead {
    margin-top: 32px;
  }
}

/* Buttons --------------------------------------------------------------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.button--primary {
  background: var(--ink);
  color: #fff;
}

.button--primary:hover {
  background: var(--road);
}

.button--ghost {
  box-shadow: inset 0 0 0 2px var(--ink);
  color: var(--ink);
}

.button--ghost:hover {
  background: var(--mist);
}

/* Chapters -------------------------------------------------------------- */

.chapter {
  position: relative;
  max-width: var(--column);
  margin: 0 auto;
  padding: calc(var(--chapter-gap) + var(--hairpin) + var(--to-heading)) var(--gutter) 0 calc(var(--gutter) + var(--lane));
}

/* The point where the road passes the flag. road.js routes the road through it. */
.waypoint {
  position: absolute;
  top: calc(var(--chapter-gap) + var(--hairpin));
  left: calc(var(--gutter) + var(--road-x) + var(--road-turn));
  width: 0;
  height: 0;
}

/* Same proportions as the flag on the cover; the road crosses the pole near its foot. */
.flag {
  position: absolute;
  top: calc(var(--u) * -80px);
  left: calc(var(--u) * -6px);
  width: calc(var(--u) * 66px);
  max-width: none;
  height: calc(var(--u) * 100px);
  overflow: visible;
}

.flag__pole {
  fill: none;
  stroke: var(--road);
  stroke-linecap: round;
  stroke-width: 6;
}

.flag__cloth {
  fill: var(--flag);
}

.chapter__title {
  font-size: clamp(28px, 3.4vw, 40px);
}

/* 対象読者 */
.readers {
  display: grid;
  gap: 12px;
  max-width: 36em;
  margin-top: 28px;
}

.readers li {
  position: relative;
  padding-left: 1.4em;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.6;
  word-break: auto-phrase;
}

.readers li::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: 0.15em;
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--flag);
}

/* Written like the system requirements of a technical book. */
.spec {
  display: grid;
  gap: 6px;
  max-width: 36em;
  margin-top: 32px;
  padding: 16px 20px;
  border-radius: 12px;
  background: var(--mist);
  font-size: 14px;
  line-height: 1.7;
}

.spec div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.spec dt {
  color: var(--muted);
}

.spec dd {
  word-break: auto-phrase;
}

@media (min-width: 560px) {
  .spec div {
    grid-template-columns: 7.5em minmax(0, 1fr);
    gap: 12px;
  }
}

/* 目次: a card that opens the table of contents in a lightbox */
.toc-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  max-width: 36em;
  margin-top: 28px;
  padding: 18px 16px 18px 20px;
  border-radius: 16px;
  background: var(--mist);
  color: var(--ink);
  text-decoration: none;
}

/* A page of the table of contents, laid on the card like a printed sheet */
.toc-card__thumb {
  width: 52px;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgb(7 38 60 / 0.12), 0 6px 16px rgb(7 38 60 / 0.14);
  transform: rotate(-4deg);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toc-card:hover .toc-card__thumb,
.toc-card:focus-visible .toc-card__thumb {
  transform: translateY(-4px) scale(1.06);
}

.toc-card__title {
  display: block;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.5;
  word-break: auto-phrase;
}

.toc-card__meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.toc-card__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  transition: background-color 0.2s, transform 0.2s;
}

.toc-card__icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.toc-card:hover .toc-card__icon {
  background: var(--road);
  transform: translateX(2px);
}

@media (min-width: 560px) {
  .toc-card {
    gap: 20px;
    padding: 20px 24px 20px 28px;
  }

  .toc-card__thumb {
    width: 64px;
  }

  .toc-card__title {
    font-size: 19px;
  }

  .toc-card__meta {
    font-size: 14px;
  }
}

/* The table of contents fades up over the page. The dialog itself is a clear
   frame: the close button sits on the backdrop, above the scrolling panel. */
.lightbox {
  width: min(100% - 32px, 720px);
  max-width: none;
  max-height: calc(100% - 32px);
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  overflow: visible;
}

.lightbox[open] {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lightbox::backdrop {
  background: rgb(7 38 60 / 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.lightbox[open] {
  animation: lightbox-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox[open]::backdrop {
  animation: lightbox-fade 0.4s ease-out;
}

.lightbox.is-closing {
  animation: lightbox-out 0.25s ease-in forwards;
}

.lightbox.is-closing::backdrop {
  animation: lightbox-fade 0.25s ease-in reverse forwards;
}

@keyframes lightbox-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
}

@keyframes lightbox-out {
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes lightbox-fade {
  from {
    opacity: 0;
  }
}

.lightbox__close {
  display: grid;
  flex: none;
  place-items: center;
  align-self: flex-end;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.2s;
}

.lightbox__close:hover {
  background: var(--mist);
}

.lightbox__panel {
  position: relative;
  min-height: 0;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 24px 64px rgb(7 38 60 / 0.32);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lightbox__close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2.2;
}

.lightbox__image {
  width: 100%;
  height: auto;
}

/* Keep the page still behind the lightbox */
html:has(.lightbox[open]) {
  overflow: hidden;
  scrollbar-gutter: stable;
}

/* 執筆者 */
.people {
  display: grid;
  gap: 28px;
  margin-top: 32px;
}

.person {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.person__avatar {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--mist);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.person__name {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
}

.person__role {
  color: var(--muted);
  font-size: 13px;
}

.person__bio {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.8;
  word-break: auto-phrase;
}

@media (min-width: 720px) {
  .people {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
  }

  .person {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 頒布情報 */
.info {
  display: grid;
  gap: 40px;
  margin-top: 32px;
}

.venues {
  display: grid;
  gap: 28px;
}

.venue dt {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.venue dd {
  margin-top: 2px;
}

.venue__date {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.5;
}

.venue__note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

/* Laid out like the colophon (奥付) at the back of a Japanese book */
.colophon {
  padding: 20px 4px 22px;
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
}

.colophon__title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
}

.colophon__subtitle {
  margin-top: 4px;
  font-size: 13px;
}

.colophon__edition {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--ink);
  font-size: 14px;
}

.colophon__list {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.8;
}

.colophon__list div {
  display: grid;
  grid-template-columns: 4.5em minmax(0, 1fr);
  gap: 16px;
}

.colophon__list dt {
  text-align-last: justify;
}

@media (min-width: 880px) {
  .info {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 56px;
    align-items: start;
  }
}

/* The goal: the cover's own road and flag, where the page's road ends */
.goal {
  display: grid;
  gap: 24px;
  justify-items: start;
  margin-top: 80px;
}

.goal__art {
  width: calc(var(--u) * 723px); /* 1.5x the cover's scale */
  max-width: none;
  height: auto;
  overflow: visible;
}

.goal__road,
.goal__pole,
.goal__spark {
  fill: none;
  stroke-linecap: round;
  stroke-width: 4; /* 6px on the cover, divided by the 1.5x scale */
}

.goal__road,
.goal__pole {
  stroke: var(--road);
}

.goal__spark {
  stroke: var(--spark);
}

.goal__cloth {
  fill: var(--flag);
}

.goal__lead {
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 800;
  line-height: 1.4;
}

.goal__body .actions {
  margin-top: 16px;
}

@media (min-width: 720px) {
  .goal {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 48px;
  }
}

/* Footer ---------------------------------------------------------------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  max-width: var(--column);
  margin: 0 auto;
  padding: 96px var(--gutter) 40px calc(var(--gutter) + var(--lane));
  color: var(--muted);
  font-size: 13px;
}

.footer__top {
  color: var(--ink);
}

/* The road -------------------------------------------------------------- */

.road {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  max-width: none;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  fill: none;
  stroke: var(--road);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: var(--road-w);
}

/* Flags rise as the road reaches them. Without the script, everything is simply drawn. */
.road-ready .flag__pole,
.road-ready .goal__pole,
.road-ready .goal__spark,
.road-ready .goal__road {
  stroke-dasharray: 1 2;
  stroke-dashoffset: 1.05;
}

.road-ready .flag__cloth,
.road-ready .goal__cloth {
  transform: scaleX(0);
  transform-box: fill-box;
  transform-origin: 0 50%;
}

.road-ready .flag__pole {
  transition: stroke-dashoffset 0.4s ease-out;
}

.road-ready .flag__cloth {
  transition: transform 0.45s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.road-ready .goal__road {
  transition: stroke-dashoffset 1.6s cubic-bezier(0.45, 0.05, 0.3, 1);
}

.road-ready .goal__pole {
  transition: stroke-dashoffset 0.4s 1.45s ease-out;
}

.road-ready .goal__cloth {
  transition: transform 0.45s 1.75s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.road-ready .goal__spark {
  transition: stroke-dashoffset 0.3s 2.1s ease-out;
}

.road-ready .goal__spark:nth-child(5) {
  transition-delay: 2.2s;
}

.road-ready .goal__spark:nth-child(6) {
  transition-delay: 2.3s;
}

.road-ready .is-reached .flag__pole,
.road-ready .is-reached .goal__pole,
.road-ready .is-reached .goal__spark,
.road-ready .is-reached .goal__road {
  stroke-dashoffset: 0;
}

.road-ready .is-reached .flag__cloth,
.road-ready .is-reached .goal__cloth {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .road-ready *,
  .road-ready *::before,
  .road-ready *::after {
    transition: none !important;
  }

  /* The lightbox still fades, without moving */
  .lightbox[open] {
    animation-name: lightbox-fade;
  }

  .lightbox.is-closing {
    animation: lightbox-fade 0.25s ease-in reverse forwards;
  }
}
