/* Engineering CAD with SOLIDWORKS — Book 2 (Advanced) companion site.
   Accessible build: WCAG 2.1 AA contrast, visible focus, semantic landmarks. */
:root {
  --dark: #1F2A33;
  --dark2: #2C3B47;
  --accent: #D96C0B;        /* decorative only */
  --accent-text: #B25406;   /* used behind WHITE text: ~4.9:1 on white, AA */
  --accent-dark: #964704;
  --steel: #2E5266;         /* body links: ~7:1 on white */
  --muted: #4F5E68;         /* hint text: ~5.4:1 on white, AA */
  --card: #EEF2F5;
  --ok: #1F6B33;            /* AA on white */
  --bad: #A32A20;           /* AA on white */
  --body: #1E262C;
  --line: #B7C2CA;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", Calibri, Arial, sans-serif;
  color: var(--body);
  background: #fff;
  line-height: 1.55;
}
a { color: var(--steel); }
a:hover { text-decoration: underline; }

/* Visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, select:focus-visible,
input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #12507a;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link */
.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: #fff; color: #12507a; padding: 0.6rem 1rem;
  font-weight: 700; border: 2px solid #12507a; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

header.site { background: var(--dark); color: #fff; padding: 1.1rem 1.4rem; }
header.site .inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap;
}
.logo {
  background: var(--accent-text); color: #fff; font-weight: 800;
  border-radius: 10px; padding: 0.35rem 0.7rem; font-size: 1.1rem; text-decoration: none;
}
header.site h1 { font-size: 1.15rem; margin: 0; font-weight: 700; flex: 1 1 auto; }
header.site .sub { color: #D6E3FA; font-size: 0.85rem; display: block; font-weight: 400; }

nav.chapters { background: var(--dark2); }
nav.chapters ul {
  max-width: 1080px; margin: 0 auto; display: flex; flex-wrap: wrap;
  list-style: none; padding: 0;
}
nav.chapters a {
  display: block; color: #E7EEFA; text-decoration: none;
  padding: 0.55rem 0.9rem; font-size: 0.9rem; font-weight: 600;
}
nav.chapters a:hover { background: var(--accent-text); color: #fff; text-decoration: underline; }
nav.chapters a[aria-current="page"] { background: var(--accent-text); color: #fff; }

main { max-width: 1080px; margin: 0 auto; padding: 1.4rem; }

.hero {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 100%);
  color: #fff; border-radius: 14px; padding: 2rem 1.8rem; margin-bottom: 1.6rem;
}
.hero h2 { margin: 0 0 0.5rem; font-size: 1.7rem; }
.hero p { color: #E4ECF7; max-width: 46rem; margin: 0.3rem 0; }

h2.section { color: var(--steel); margin: 2rem 0 0.8rem; font-size: 1.35rem; }
h3 { color: var(--steel); }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--card); border-radius: 12px; padding: 1.1rem 1.2rem; }
.card h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.card p { margin: 0.25rem 0; font-size: 0.92rem; }
.card a.btn { margin-top: 0.6rem; }

.btn {
  display: inline-block; background: var(--accent-text); color: #fff !important;
  border: none; border-radius: 8px; padding: 0.5rem 1rem;
  font-weight: 700; font-size: 0.95rem; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent-dark); text-decoration: underline; }
.btn.ghost { background: var(--steel); }

.tool { background: var(--card); border-radius: 12px; padding: 1.2rem 1.3rem; margin: 1rem 0; }
.tool h3 { margin-top: 0; }
.tool .hint, p.hint { color: var(--muted); font-size: 0.86rem; }
.hint { color: var(--muted); }

.row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; margin: 0.6rem 0; }
.field { display: flex; flex-direction: column; gap: 0.2rem; }
.field label { font-size: 0.82rem; font-weight: 700; color: var(--steel); }
.field input[type="number"], .field select, select {
  padding: 0.45rem 0.55rem; border: 1px solid #8A97A1; border-radius: 8px;
  font-size: 0.95rem; min-width: 9rem; background: #fff; color: var(--body);
}

.result {
  background: var(--dark); color: #fff; border-radius: 10px;
  padding: 0.8rem 1rem; margin-top: 0.7rem; font-size: 1rem;
}
.result strong { color: #FFC98A; }
.result.good { background: var(--ok); }
.result.warn { background: var(--bad); }
.result .cm { font-family: Consolas, monospace; color: #FFE1C2; }

.note {
  background: #FBF1E6; border-left: 4px solid var(--accent-text); border-radius: 6px;
  padding: 0.7rem 0.9rem; margin: 0.9rem 0; font-size: 0.9rem;
}

.tag {
  display: inline-block; background: var(--steel); color: #fff; border-radius: 6px;
  padding: 0.12rem 0.55rem; font-size: 0.74rem; font-weight: 700; margin-right: 0.3rem;
}
.tag.big { background: var(--accent-text); }
.cert { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; margin: 1rem 0; }
.cert .box { background: var(--card); border-radius: 12px; padding: 1rem 1.15rem; }
.cert .box h3 { margin: 0 0 0.4rem; }
.cert .box.assoc { border-top: 5px solid var(--steel); }
.cert .box.pro { border-top: 5px solid var(--accent-text); }
@media (max-width: 640px) { .cert { grid-template-columns: 1fr; } }

/* quiz */
.quiz-q { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.2rem; margin: 0.8rem 0; }
.quiz-q legend, .quiz-q h4 { margin: 0 0 0.5rem; font-size: 0.98rem; font-weight: 700; padding: 0; }
.quiz-q fieldset { border: none; margin: 0; padding: 0; }
.quiz-q label { display: block; padding: 0.4rem 0.6rem; border-radius: 8px; cursor: pointer; font-size: 0.93rem; }
.quiz-q label:hover { background: var(--card); }
.quiz-q.correct { border-color: var(--ok); background: #EFF6F0; }
.quiz-q.incorrect { border-color: var(--bad); background: #FBF0EF; }
.quiz-q .why { display: none; margin-top: 0.5rem; font-size: 0.88rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 0.5rem; }
.quiz-q.graded .why { display: block; }
.score { font-size: 1.15rem; font-weight: 800; color: var(--steel); margin: 0.8rem 0; }

/* matcher */
.match-item { display: flex; gap: 0.8rem; align-items: center; margin: 0.45rem 0; flex-wrap: wrap; }
.match-item .name { flex: 1 1 16rem; font-size: 0.93rem; }
.match-item select { padding: 0.35rem 0.5rem; border-radius: 8px; border: 1px solid #8A97A1; }
.match-item .mark { font-weight: 800; width: 1.4rem; }
.mark.ok { color: var(--ok); } .mark.no { color: var(--bad); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* flashcards */
.fc-wrap { perspective: 1200px; max-width: 560px; margin: 1rem auto; }
.fc {
  position: relative; width: 100%; height: 300px; cursor: pointer;
  transform-style: preserve-3d; transition: transform 0.5s; border: none; padding: 0; background: none;
}
.fc.flipped { transform: rotateY(180deg); }
.fc .face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  padding: 1.6rem; text-align: center;
}
.fc .front { background: var(--dark); color: #fff; font-size: 1.5rem; font-weight: 800; }
.fc .back { background: var(--card); color: var(--body); transform: rotateY(180deg); font-size: 1.02rem; }
.fc-controls { display: flex; gap: 0.7rem; justify-content: center; margin: 1rem 0; flex-wrap: wrap; align-items: center; }
.fc-count { text-align: center; color: var(--muted); font-size: 0.9rem; }
@media (prefers-reduced-motion: reduce) { .fc { transition: none; } html { scroll-behavior: auto; } }

footer.site { background: var(--dark); color: #DCE6F5; margin-top: 3rem; padding: 1.4rem; font-size: 0.85rem; text-align: center; }
footer.site a { color: #fff; }

table.plain { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
table.plain caption { text-align: left; font-weight: 700; color: var(--steel); padding: 0.3rem 0; }
table.plain th { background: var(--steel); color: #fff; text-align: left; padding: 0.5rem 0.7rem; }
table.plain td { border-bottom: 1px solid #DCE3E8; padding: 0.45rem 0.7rem; }
table.plain tr:nth-child(even) td { background: var(--card); }
table.mini { border-collapse: collapse; width: 100%; font-size: 0.9rem; margin-top: 0.5rem; }
table.mini th, table.mini td { border: 1px solid var(--line); padding: 0.35rem 0.5rem; text-align: left; }
table.mini th { background: var(--steel); color: #fff; }

.pill { display: inline-block; background: var(--accent-text); color: #fff; border-radius: 999px; padding: 0.1rem 0.7rem; font-size: 0.78rem; font-weight: 700; }
