/* Landing page and the story grids. Colours and fonts come from theme.css,
   which every page loads first. */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(62deg, rgba(28, 25, 21, 0.014) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(-62deg, rgba(28, 25, 21, 0.012) 0 1px, transparent 1px 13px);
  font-family: var(--serif);
  color: var(--ink);
}

/* ---------- the sheet ---------- */

.landing,
.story-section {
  width: min(920px, calc(100% - 48px));
  margin: 36px auto;
  padding: 52px 52px 44px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--cinnabar);
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: 0 1px 0 var(--line-soft), 0 18px 40px -32px rgba(28, 25, 21, 0.5);
}

.story-section {
  margin: 18px auto 40px;
  padding: 30px 34px 34px;
}

/* ---------- the seal and the title ---------- */

.eyebrow {
  display: inline-block;
  margin-bottom: 22px;
  padding: 7px 13px;
  border-radius: var(--radius);
  background: var(--cinnabar);
  color: var(--paper-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 6.4vw, 64px);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 16px 0 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 3px 0 -2px var(--line);
  font-size: clamp(20px, 2.8vw, 27px);
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink-2);
}

.intro {
  max-width: 680px;
  margin: 30px 0 0;
  font-size: 18px;
  line-height: 1.75;
  color: var(--ink-2);
}

/* ---------- the two sections ---------- */

.section-grid {
  display: grid;
  /* three sections now, and auto-fit folds them to two or one rather than
     squeezing three into a phone */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 38px;
}

.section-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.6), transparent 60%);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.section-card:hover {
  border-color: var(--cinnabar);
  box-shadow: inset 0 0 0 1px var(--cinnabar-l);
}

.section-card .section-icon {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  background: var(--cinnabar);
  color: var(--paper-2);
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
}

.section-card h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0;
}

.section-card p {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-2);
}

.section-card .section-meta {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.section-card .story-link {
  margin-top: auto;
}

/* ---------- the two notes below ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 36px;
}

/* The forum is not a fourth way to study, so it does not join the three
   section cards. It is a different kind of thing — a place rather than a
   course — and gets the celadon accent the secondary panels use. */
.forum-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 6px 20px;
  margin-top: 36px;
  padding: 24px 26px 22px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--celadon);
  border-radius: var(--radius);
  background: var(--paper-2);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.forum-panel:hover {
  border-color: var(--celadon);
  box-shadow: inset 0 0 0 1px var(--celadon-l);
}

.forum-panel .forum-icon {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: var(--radius);
  background: var(--celadon);
  color: var(--paper-2);
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
}

.forum-panel h2 {
  margin: 0 0 8px;
  font-size: 25px;
  font-weight: 600;
}

.forum-panel p {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-2);
}

.forum-panel .story-link {
  grid-column: 2;
  margin-top: 14px;
  /* The panel is a grid, where the section cards' align-self: flex-start only
     governs the block axis — without this the button stretches the full
     column and stops looking like the one on the cards. */
  justify-self: start;
}

@media (max-width: 600px) {
  .forum-panel { grid-template-columns: 1fr; gap: 14px; padding: 20px 18px; }
  .forum-panel .story-link { grid-column: 1; margin-top: 4px; }
}

.card {
  padding: 20px 22px 18px;
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--celadon);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.45);
}

.card h2 {
  margin: 0 0 9px;
  font-size: 17px;
  font-weight: 600;
}

.card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-2);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 36px;
}

/* ---------- story grids ---------- */

.story-section h2 {
  margin: 0;
  font-size: clamp(26px, 3.6vw, 38px);
  font-weight: 600;
  letter-spacing: 0;
}

.story-section-hanzi {
  margin: 7px 0 0;
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0.1em;
  color: var(--cinnabar);
}

.story-section-meta {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.story-section .story-intro {
  max-width: 760px;
  margin: 12px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-2);
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.story-section--compact .story-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.story-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  color: inherit;
  min-height: 100%;
  transition: border-color 0.15s, background 0.15s;
}

.story-card:hover {
  border-color: var(--cinnabar);
  background: var(--paper-2);
}

.story-card .story-number {
  display: inline-flex;
  align-self: flex-start;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cinnabar);
}

.story-card h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
}

.story-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-2);
}

.story-card .story-hanzi {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink-2);
  letter-spacing: 0.06em;
}

.story-section--compact .story-card {
  padding: 15px 15px 13px;
  gap: 7px;
}

.story-section--compact .story-card h3 {
  font-size: 16px;
}

.story-section--compact .story-card p {
  font-size: 13px;
  line-height: 1.5;
}

.story-section--compact .story-card .story-link {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

/* ---------- buttons and links ---------- */

.story-card .story-link,
.section-card .story-link,
.forum-panel .story-link {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.story-card:hover .story-link,
.section-card:hover .story-link {
  border-color: var(--cinnabar);
  background: var(--cinnabar);
  color: var(--paper-2);
}

/* The forum keeps the celadon it is introduced with rather than borrowing
   the cinnabar the three study cards use. */
.forum-panel:hover .story-link {
  border-color: var(--celadon);
  background: var(--celadon);
  color: var(--paper-2);
}

.button,
.text-link {
  color: var(--ink);
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper-2);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  font-size: 16px;
}

.text-link:hover {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
}

.text-link.contact-link {
  border-color: var(--cinnabar);
  color: var(--cinnabar);
}

.text-link.contact-link:hover {
  background: var(--cinnabar);
  color: var(--paper-2);
}

.loading-note {
  margin-top: 24px;
  font-size: 16px;
  color: var(--ink-3);
}

/* ---------- narrow screens ---------- */

@media (max-width: 760px) {
  .landing {
    width: min(100% - 24px, 920px);
    margin: 12px auto;
    padding: 30px 22px 26px;
  }

  .story-section {
    width: min(100% - 24px, 920px);
    margin: 12px auto 28px;
    padding: 24px 20px 22px;
  }

  .grid,
  .story-grid,
  .section-grid,
  .story-section--compact .story-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 761px) and (max-width: 1120px) {
  .story-section--compact .story-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
