/* Techy Teacher
   One idea runs through the whole design: every post is filed in a colored
   folder, and the folder tab says which topic it belongs to. The graph-paper
   panel is saved for the newest post on the home page. */

:root {
  --paper: #f5f7fa;
  --surface: #ffffff;
  --ink: #18223a;
  --muted: #586377;
  --line: #d8dfea;
  --blue: #1e4fd0;
  --blue-dark: #163c9f;
  --yellow: #ffc62b;
  --grid: rgba(30, 79, 208, 0.075);

  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --read: "Literata", Georgia, "Times New Roman", serif;

  --wrap: 1180px;
  --narrow: 720px;
  --gutter: clamp(16px, 4vw, 32px);
  --radius: 8px;
}

/* Topic colors: --c is the folder color, --t the pale tint behind page headers. */
.tab--articles, .card--articles, .topic--articles, .pagehead--articles { --c: #1e4fd0; --t: #e6ecfc; }
.tab--chatgpt,  .card--chatgpt,  .topic--chatgpt,  .pagehead--chatgpt  { --c: #0a7366; --t: #ddf1ed; }
.tab--lists,    .card--lists,    .topic--lists,    .pagehead--lists    { --c: #a3460f; --t: #fbe9dd; }
.tab--quotes,   .card--quotes,   .topic--quotes,   .pagehead--quotes   { --c: #7337a0; --t: #f0e6f7; }
.tab--students, .card--students, .topic--students, .pagehead--students { --c: #356a1c; --t: #e4f0db; }

/* ------------------------------------------------------------ base -- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--read);
  font-size: 1.0625rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--blue); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--blue-dark); text-decoration-thickness: 2px; }

h1, h2, h3, h4 {
  font-family: var(--display);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px;
  font-family: var(--display); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; color: #fff; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

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

.section { padding-block: clamp(40px, 6vw, 72px) 0; }
.section:last-child { padding-bottom: clamp(48px, 7vw, 88px); }

.section__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: 8px;
}
.section__head h2 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); font-weight: 800; margin: 0; }
.section__head a { font-family: var(--display); font-weight: 600; font-size: 0.95rem; }

.meta {
  font-family: var(--display);
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
}

.button {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 1rem;
  padding: 0.8em 1.35em; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--blue); color: #fff; text-decoration: none;
}
.button:hover { background: var(--blue-dark); color: #fff; }
.button--dark { background: var(--ink); }
.button--dark:hover { background: #000; }

/* ------------------------------------------------------- masthead -- */

.masthead { background: var(--surface); border-bottom: 1px solid var(--line); }

.masthead__row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand:hover { color: var(--ink); }
.brand img { width: 48px; height: 48px; flex: none; }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__name { font-family: var(--display); font-weight: 800; font-size: 1.55rem; letter-spacing: -0.03em; line-height: 1; white-space: nowrap; }
.brand__tag { font-family: var(--display); font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

.masthead__tools { display: flex; gap: 8px; flex: none; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--display); font-weight: 600; font-size: 0.92rem;
  padding: 0.5em 1em; border-radius: 999px; text-decoration: none;
  color: var(--ink); border: 1px solid var(--line); background: var(--surface);
}
.pill:hover { color: var(--ink); border-color: var(--ink); }
.pill--solid { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill--solid:hover { background: #000; color: #fff; }

.topics { border-top: 1px solid var(--line); }
.topics ul {
  list-style: none; margin: 0 auto; display: flex; gap: 4px 28px;
  overflow-x: auto; scrollbar-width: none;
}
.topics ul::-webkit-scrollbar { display: none; }
.topics a {
  display: block; white-space: nowrap; padding: 12px 0 10px;
  font-family: var(--display); font-weight: 600; font-size: 0.97rem;
  color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent;
}
.topics a:hover { color: var(--ink); }
.topics a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

/* --------------------------------------------------------- folder tabs -- */

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.tab {
  display: inline-block;
  font-family: var(--display); font-weight: 700; font-size: 0.8rem; line-height: 1;
  padding: 0.55em 0.95em 0.5em;
  background: var(--c); color: #fff; border-radius: 6px;
  text-decoration: none;
}
a.tab:hover { color: #fff; filter: brightness(0.9); }

/* ----------------------------------------------------------- cards -- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 56px 28px;
  margin-top: 44px;
}

.card {
  position: relative;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--c);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
}

/* The folder tab sits on top of the card's colored top edge. */
.card > .tab {
  position: absolute; left: -1px; bottom: 100%;
  border-radius: 7px 7px 0 0;
  padding: 0.6em 1em 0.5em;
}

.card__link { display: flex; flex-direction: column; width: 100%; color: inherit; text-decoration: none; }
.card__link:hover { color: inherit; }
.card__link:hover .card__title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.15em; }

.card__media { aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--paper); }
.card__media img { width: 100%; height: 100%; object-fit: cover; }

.card__body { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 20px; flex: 1; }
.card__title { font-size: 1.28rem; font-weight: 700; margin: 0; }
.card__excerpt { margin: 0; color: var(--muted); font-size: 0.98rem; line-height: 1.55; }
.card__quote { margin: 0; font-style: italic; font-size: 1.12rem; line-height: 1.45; }
.card__by { margin: 0; font-family: var(--display); font-weight: 600; color: var(--c); }
.card .meta { margin-top: auto; padding-top: 4px; }

/* ------------------------------------------------------- newest post -- */

.lead {
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
  border-bottom: 1px solid var(--line);
}

.lead__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(28px, 5vw, 64px); align-items: center;
  padding-block: clamp(36px, 6vw, 80px);
}
.lead__grid--noimg { grid-template-columns: minmax(0, 760px); }

.lead__label {
  display: inline-block; margin: 0 0 18px;
  font-family: var(--display); font-weight: 700; font-size: 0.9rem;
  background: var(--yellow); color: var(--ink); padding: 0.3em 0.75em; border-radius: 4px;
}

.lead__title {
  font-size: clamp(2.1rem, 4.6vw, 3.5rem);
  font-weight: 800; line-height: 1.04; letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.lead__title a { color: var(--ink); text-decoration: none; }
.lead__title a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 0.12em; }

.lead__excerpt { font-size: 1.15rem; line-height: 1.6; margin: 0 0 16px; max-width: 38em; }
.lead .meta { margin-bottom: 26px; }

.lead__media {
  display: block; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
}
.lead__media img { width: 100%; }

/* ---------------------------------------------------------- topics -- */

.topics-grid {
  list-style: none; margin: 24px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 16px;
}

.topic {
  display: flex; flex-direction: column; gap: 8px; height: 100%;
  padding: 20px; border-radius: var(--radius); text-decoration: none;
  background: var(--t); color: var(--ink); border-left: 6px solid var(--c);
}
.topic:hover { color: var(--ink); background: color-mix(in srgb, var(--t) 70%, var(--c) 12%); }
.topic__name { font-family: var(--display); font-weight: 800; font-size: 1.2rem; color: var(--c); }
.topic__desc { font-size: 0.95rem; line-height: 1.5; }
.topic__count { margin-top: auto; font-family: var(--display); font-size: 0.85rem; color: var(--muted); }

/* ------------------------------------------------------ quote band -- */

.quoteband { background: var(--ink); color: #fff; margin-top: clamp(48px, 7vw, 88px); }
.quoteband figure { margin: 0; padding-block: clamp(48px, 7vw, 88px); max-width: 860px; }
.quoteband blockquote { margin: 0; }
.quoteband blockquote p {
  margin: 0; font-style: italic; font-weight: 500;
  font-size: clamp(1.6rem, 3.4vw, 2.5rem); line-height: 1.3; text-wrap: balance;
}
.quoteband figcaption { margin-top: 22px; font-family: var(--display); font-weight: 600; font-size: 1rem; color: #c9d1e0; }
.quoteband a { color: var(--yellow); }
.quoteband a:hover { color: #fff; }

/* ---------------------------------------------------------- signup -- */

.signup {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  background: var(--yellow); border-radius: var(--radius); padding: clamp(24px, 4vw, 40px);
}
.signup h2 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); font-weight: 800; margin-bottom: 6px; }
.signup p { margin: 0; }

/* ------------------------------------------------------- page heads -- */

.pagehead {
  background-color: var(--t, var(--surface));
  border-bottom: 1px solid var(--line);
  padding-block: clamp(36px, 6vw, 64px);
}
.pagehead:not([class*="pagehead--"]) {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -1px -1px;
}
.pagehead h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 10px; color: var(--c, var(--ink)); }
.pagehead p { margin: 0 0 8px; max-width: 40em; font-size: 1.12rem; }
.pagehead .button { margin-top: 12px; }

/* --------------------------------------------------------- article -- */

.article { background: var(--surface); border-bottom: 1px solid var(--line); padding-bottom: clamp(40px, 6vw, 72px); }

.article__head { padding-top: clamp(36px, 6vw, 64px); }
.article__head h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); font-weight: 800; line-height: 1.08; letter-spacing: -0.025em; margin-bottom: 14px; }

.article__hero { margin: 32px 0 0; }
.article__hero img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.article__hero--small img { width: auto; max-width: 100%; }

.article__quote { margin: 32px 0 0; padding: 28px 32px; background: var(--ink); color: #fff; border-radius: var(--radius); }
.article__quote blockquote { margin: 0; }
.article__quote p { margin: 0; font-style: italic; font-size: clamp(1.35rem, 3vw, 1.75rem); line-height: 1.35; }
.article__quote figcaption { margin-top: 14px; font-family: var(--display); font-weight: 600; color: var(--yellow); }

.prose { font-size: 1.14rem; line-height: 1.75; padding-top: 32px; }
.prose > * + * { margin-top: 1.1em; }
.prose p, .prose ul, .prose ol, .prose figure, .prose blockquote, .prose table { margin-bottom: 0; }
.prose h2 { font-size: 1.7rem; font-weight: 800; margin-top: 1.9em; margin-bottom: 0; }
.prose h3 { font-size: 1.32rem; font-weight: 700; margin-top: 1.6em; margin-bottom: 0; }
.prose h4 { font-size: 1.1rem; font-weight: 700; margin-top: 1.4em; margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.45em; }
.prose li::marker { color: var(--blue); font-weight: 700; }
.prose img { border-radius: 6px; }
.prose figure { margin-inline: 0; }
.prose figcaption { font-family: var(--display); font-size: 0.9rem; color: var(--muted); margin-top: 8px; }
.prose blockquote { margin-inline: 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--yellow); font-style: italic; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.2em; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.98rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { font-family: var(--display); background: var(--paper); }
.prose iframe { max-width: 100%; border: 0; border-radius: 6px; }
.prose .video { aspect-ratio: 16 / 9; }
.prose .video iframe { width: 100%; height: 100%; }
.prose code { font-size: 0.9em; background: var(--paper); padding: 0.1em 0.35em; border-radius: 4px; }

/* ----------------------------------------------------------- pager -- */

.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  padding-top: clamp(32px, 5vw, 48px);
}
.pager a {
  display: flex; flex-direction: column; gap: 6px; padding: 18px 20px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  font-family: var(--display); font-weight: 700; font-size: 1.08rem; line-height: 1.3;
  color: var(--ink); text-decoration: none;
}
.pager a:hover { border-color: var(--ink); color: var(--ink); }
.pager span { font-weight: 500; font-size: 0.85rem; color: var(--muted); }
.pager__newer { text-align: right; }

/* ---------------------------------------------------- search & form -- */

.searchbox { display: flex; align-items: center; gap: 10px; margin-top: 22px; max-width: 640px; }
.searchbox input { flex: 1; min-width: 0; }

input[type="text"], input[type="email"], input[type="search"], textarea {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--ink);
  padding: 0.75em 0.9em; background: var(--surface);
  border: 1px solid #b9c3d3; border-radius: 6px;
}
input:focus, textarea:focus { outline: 3px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
textarea { resize: vertical; min-height: 9em; }

.search-status { font-family: var(--display); font-weight: 600; color: var(--muted); margin: 0; }
.search-status:empty { display: none; }

.form { display: flex; flex-direction: column; gap: 22px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-family: var(--display); font-weight: 700; }
.req { font-weight: 500; color: var(--muted); }
.field--check { flex-direction: row; align-items: center; gap: 12px; }
.field--check input { width: 22px; height: 22px; accent-color: var(--blue); }
.field--check label { font-weight: 600; }
.form .button { align-self: flex-start; }
.form__note { margin: 0; font-size: 0.95rem; color: var(--muted); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.notice {
  padding: 16px 20px; border-radius: var(--radius); margin-bottom: 28px;
  background: #fdecec; border-left: 6px solid #b42318; color: #5c130d;
  font-family: var(--display); font-weight: 600;
}

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

.footer { background: var(--surface); border-top: 1px solid var(--line); padding-block: 36px 28px; font-size: 0.98rem; }
.footer__row { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer__row p { margin: 0; color: var(--muted); }
.footer__name { font-family: var(--display); font-weight: 800; font-size: 1.2rem; color: var(--ink) !important; margin-bottom: 4px !important; }
.footer__links { list-style: none; margin: 0; padding: 0; display: flex; gap: 22px; flex-wrap: wrap; font-family: var(--display); font-weight: 600; }
.footer__links a { color: var(--ink); }
.footer__copy { margin: 24px 0 0; font-family: var(--display); font-size: 0.85rem; color: var(--muted); }

/* --------------------------------------------------------- smaller -- */

@media (max-width: 820px) {
  .lead__grid { grid-template-columns: 1fr; }
  .lead__media { order: -1; }
}

@media (max-width: 600px) {
  .brand__tag { display: none; }
  .brand img { width: 40px; height: 40px; }
  .brand__name { font-size: 1.3rem; }
  .pill { padding: 0.45em 0.8em; font-size: 0.88rem; }
  .pill__text { display: none; }
  .pill { padding: 0.5em 0.65em; }
  .pill--solid { padding: 0.45em 0.9em; }
  .pager { grid-template-columns: 1fr; }
  .pager__newer { text-align: left; }
  .searchbox { flex-direction: column; }
  .searchbox .button { align-self: flex-start; }
  .prose { font-size: 1.08rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .pill, .button, .topic, .pager a, .topics a { transition: background-color 0.15s, border-color 0.15s, color 0.15s; }
}

@media print {
  .masthead__tools, .topics, .pager, .footer, .signup, .section:not(.article) { display: none; }
  .article { border: 0; }
}
