/* education.libre.computer: this site's own rules.
 *
 * The page frame is the hardware.libre.computer shell: css/lc-kit.css (VENDORED
 * from the monorepo's tools/lc-ui-kit by its sync.py; never edit it here)
 * supplies the tokens for both themes, the top bar, the controls, the theme
 * button and the footer. This file styles only what the tool sites do not
 * have: long-form course pages. Colours come from the kit's tokens (--bg,
 * --bg-raised, --bg-sunken, --border, --text, --text-dim, --accent), so the
 * light, dark and auto themes follow the kit with no second palette.
 */

/* ---- frame ---------------------------------------------------------------- */

.edu-skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 20;
  padding: 6px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
}
.edu-skip:focus { left: 8px; top: 8px; }

/* The section nav sits under the top bar the way the pinout's legend bar does:
   a quieter second row, so the brand row stays the same on every site. */
.edu-nav {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  padding: 7px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  /* The section label is smaller and in capitals; centring its box would set
     it off the links' text line, so everything sits on one baseline. */
  align-items: baseline;
}
.edu-nav a { color: var(--text-dim); white-space: nowrap; }
.edu-nav a:hover { color: var(--accent); text-decoration: none; }
.edu-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

/* The section's name leads the bar; the doors to the other two sections sit at
   the far end, quiet, so a reader stays in their own section unless they mean
   to leave it. */
.edu-nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}
.edu-nav-doors {
  display: flex;
  align-items: baseline;
  gap: 4px 18px;
  margin-left: auto;
}
.edu-nav-doors a::after { content: " →"; }

.edu-main {
  flex: 1 0 auto;
  width: 100%;
  font-size: 16px;
  line-height: 1.6;
}

.edu-main > *,
.edu-main > .platform-only > * {
  max-width: 72rem;
  margin-left: auto;
  margin-right: auto;
}

.lc-footer { line-height: 1.7; }

/* ---- hidden pages ----------------------------------------------------------
 * A hidden page (funding) loads when its address is typed but is linked from
 * nowhere unless the visitor opens the site with ?hidden=1, the same switch the
 * hardware sites use for unreleased boards. Without JavaScript it stays
 * hidden. */

.hidden-only { display: none; }
html.show-hidden .hidden-only { display: revert; }

/* ---- platform switch -------------------------------------------------------
 * The course runs on Das Frite or Solitude. The picker is a kit segmented
 * control in the top bar's controls slot. A section tagged with a platform
 * shows only while that platform is picked; with no pick (no JavaScript) every
 * platform's sections show, each labelled with its board. */

.edu-platform-label { color: var(--text-dim); font-size: 13px; }
.edu-platform { min-width: 13rem; }
.edu-platform button { white-space: nowrap; }   /* "Das Frite" broke onto two lines on a phone */
@media (max-width: 560px) {
  .edu-platform-label { display: none; }        /* the buttons name the boards; the label is the first thing to give way */
  .edu-platform { min-width: 0; }
}

/* Below the desktop width the kit gives the controls a row of their own; the
   switch fills it on a phone, so the two boards read as one control the width
   of the content, and the section nav becomes one sideways-scrolling row
   instead of wrapping a link or the two doors onto lines of their own. The
   breakpoint is the kit's narrow-bar one. */
@media (max-width: 819.98px) {
  .edu-platform button { min-height: 40px; }
  .edu-nav {
    flex-wrap: nowrap;
    padding-top: 0;
    padding-bottom: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .edu-nav::-webkit-scrollbar { display: none; }
  .edu-nav a { display: inline-block; padding: 10px 0; line-height: 20px; }
  .edu-nav-label,
  .edu-nav-doors,
  .edu-nav .lc-flag { flex: none; }
}
@media (max-width: 560px) {
  .edu-platform { flex: 1 1 auto; }
}

html[data-platform="das-frite"] .platform-only:not([data-platform="das-frite"]),
html[data-platform="solitude"] .platform-only:not([data-platform="solitude"]) {
  display: none;
}

html:not([data-platform]) .platform-only::before {
  content: attr(data-platform-name);
  display: block;
  max-width: 72rem;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---- sections and text ---------------------------------------------------- */

.hero,
.section {
  padding: 1.75rem 1.5rem;
}

.hero {
  display: grid;
  gap: 2rem;
  align-items: center;
  padding-top: 2.5rem;
}
@media (min-width: 900px) {
  .hero:not(.hero-plain) { grid-template-columns: 1.4fr 1fr; }
}
.hero img {
  width: 100%;
  max-width: 24rem;
  height: auto;
  justify-self: center;
}
.hero-art { justify-self: center; width: 100%; max-width: 30rem; }
.hero-art img,
.hero-art .edu-dg { display: block; max-width: 100%; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
html[data-platform] .hero-art .edu-dg.platform-only::before,
.hero-art .edu-dg.platform-only::before { content: none; }

/* ---- embedded diagrams -----------------------------------------------------
 * tools/gen_diagrams.py draws every diagram and board picture in one dark
 * palette, and tools/build_site.py embeds the SVG in the page. These rules map
 * that palette onto the theme's tokens, so a diagram's ground, text and lines
 * follow light, dark and auto with the rest of the page. CSS beats an SVG
 * presentation attribute, which is what lets a selector on the attribute
 * value recolour it. The board itself -- solder mask, copper, pads, parts --
 * keeps its physical colours in either theme. Keep these values in step with
 * the colour constants in gen_diagrams.py. */
.edu-dg svg { display: block; width: 100%; height: auto; }

.edu-dg rect[fill="#14161a"] { fill: var(--bg-raised); }             /* ground */
.edu-dg text[fill="#14161a"] { fill: var(--bg); }                    /* number on a badge */
.edu-dg [stroke="#14161a"] { stroke: var(--bg-raised); }             /* badge ring */
.edu-dg [fill="#1d2026"] { fill: var(--bg); }                        /* box */
.edu-dg [stroke="#33383f"] { stroke: var(--border); }
.edu-dg rect[fill="#33383f"] { fill: var(--border); }
.edu-dg [fill="#e8eaed"] { fill: var(--text); }                      /* label */
.edu-dg [fill="#9aa0a6"] { fill: var(--text-dim); }                  /* note, arrowhead */
.edu-dg [stroke="#9aa0a6"] { stroke: var(--text-dim); }              /* arrow */
.edu-dg [stroke="#4da3ff"] { stroke: var(--accent); }                /* highlight */
.edu-dg circle[fill="#4da3ff"] { fill: var(--accent); }              /* badge */
.edu-dg [fill="#0b3554"] { fill: color-mix(in srgb, var(--accent) 20%, var(--bg)); }
.edu-dg [stroke="#f3f5f7"] { stroke: var(--text); }                  /* TX wire */
.edu-dg [fill="#f3f5f7"] { fill: var(--text); }
.edu-dg [stroke="#5a6570"],
.edu-dg [stroke="#56606b"] { stroke: var(--text-dim); }
.edu-dg [stroke="#c9ccd1"] { stroke: var(--text); }                  /* circuit wire, ground */
.edu-dg [stroke="#2a2e35"] { stroke: var(--border); }                 /* panel frame */

.edu-figure { margin: 1rem 0 0; }
.edu-figure .edu-dg,
.edu-figure img {
  display: block;
  width: 100%;
  max-width: 64rem;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.edu-figure figcaption {
  margin-top: .5rem;
  max-width: 48rem;
  font-size: 14px;
  color: var(--text-dim);
}

.eyebrow,
.card-label {
  margin: 0 0 .4rem;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0 0 .75rem;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.2;
}

h2 {
  margin: 0 0 .75rem;
  font-size: 1.45rem;
  line-height: 1.3;
}

h3 {
  margin: 0 0 .4rem;
  font-size: 1.05rem;
}

.hero-copy,
.edu-prose {
  max-width: 48rem;
}

.hero-copy p,
.edu-prose p,
.edu-prose li {
  color: var(--text-dim);
}
.edu-prose strong,
.hero-copy strong { color: var(--text); }
.edu-prose ul,
.edu-prose ol { padding-left: 1.25rem; }
.edu-prose li { margin: .4rem 0; }

.section-lead {
  max-width: 48rem;
  color: var(--text-dim);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
  padding: .05em .3em;
  border-radius: 4px;
  background: var(--bg-sunken);
}

/* ---- hero actions and chips ----------------------------------------------- */

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: 1.25rem;
}

.btn {
  display: inline-block;
  padding: .5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  font-size: 14px;
  font-weight: 600;
}
.btn:hover { text-decoration: none; }
.btn-blue { background: var(--accent); color: #fff; }
.btn-blue:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }

.proof-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}
.proof-bar li {
  padding: .2rem .65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-raised);
  font-size: 13px;
  color: var(--text-dim);
}

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

.feature-grid,
.path-grid,
.board-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}
.feature-grid { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.path-grid { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.board-grid { grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); }

.feature-card,
.path-card,
.board-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raised);
  box-shadow: var(--shadow);
}

.feature-card,
.path-card { padding: 1rem 1.1rem; }

.feature-card p,
.path-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 15px;
}

.path-card {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  color: var(--text);
}
.path-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.path-cta {
  margin-top: auto;
  padding-top: .5rem;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.board-card { overflow: hidden; }
.board-card img,
.board-card .edu-dg {
  display: block;
  width: 100%;
  border-bottom: 1px solid var(--border);
}
.board-card img { height: 16rem; object-fit: contain; }
.board-card .body { padding: 1rem 1.1rem; }
.board-card ul { margin: .5rem 0; padding-left: 1.1rem; color: var(--text-dim); font-size: 15px; }
.card-sku { font-size: 13px; font-weight: 500; color: var(--text-dim); }
.board-links { margin: .5rem 0 0; font-size: 14px; }

/* ---- tables --------------------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
  margin: .75rem 0;
}

.edu-table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  font-size: 15px;
}
.edu-table caption { text-align: left; color: var(--text-dim); padding-bottom: .4rem; }
.edu-table th,
.edu-table td {
  padding: .55rem .7rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.edu-table thead th {
  background: var(--bg-raised);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.edu-table tbody th { font-weight: 600; min-width: 5rem; }
.edu-table td { color: var(--text-dim); }

/* A narrow screen stacks each row as a card; data-label carries the column name
   into each cell so a value still says what it is. */
@media (max-width: 640px) {
  .edu-table { min-width: 0; }
  .edu-table thead { display: none; }
  .edu-table tr {
    display: block;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
  }
  .edu-table th,
  .edu-table td {
    display: block;
    padding: .2rem 0;
    border: 0;
  }
  .edu-table td::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--text);
  }
}

/* ---- FAQ and contact ------------------------------------------------------ */

.faq-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: .5rem 0;
  background: var(--bg-raised);
}
.faq-item summary {
  cursor: pointer;
  padding: .7rem 1rem;
  font-weight: 600;
}
.faq-item .prose { padding: 0 1rem .4rem; }
.faq-item .prose p { color: var(--text-dim); }

.contact-band {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-raised);
}

@media (max-width: 640px) {
  .hero,
  .section { padding-left: 1rem; padding-right: 1rem; }
  .edu-platform { min-width: 0; }
}
