/* Mechamath — classroom worksheet, not a dashboard clone. */
:root {
  --paper: #f3eee3;
  --sheet: #fffdf7;
  --rule: #d9d0be;
  --ink: #1b2433;
  --ink-soft: #3e4b5c;
  --muted: #5c6a7a;
  --forest: #1b5746;
  --forest-deep: #123d32;
  --leaf: #2a735c;
  --chalk: #e4efe9;
  --brick: #8f3d1c;
  --amber: #c9842a;
  --warn-bg: #f7ebe3;
  --ok-bg: #e7f2ec;
  --focus: #1b5746;
  --shadow: 0 1px 0 rgba(27, 36, 51, 0.06), 0 12px 28px rgba(27, 36, 51, 0.06);
  --serif: Cambria, "Palatino Linotype", Palatino, "Iowan Old Style", Georgia, serif;
  --sans: "Segoe UI", Calibri, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
  --measure: 68ch;
  --radius: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(27, 87, 70, 0.04), transparent 180px),
    var(--paper);
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--forest);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--forest-deep);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  background: var(--forest);
  color: #fff;
  padding: 0.4rem 0.7rem;
  z-index: 20;
}

.skip:focus {
  top: 0.75rem;
}

.wrap {
  width: min(1080px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  background: var(--sheet);
  border-bottom: 1px solid var(--rule);
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0 0.7rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--forest-deep);
}

.brand-mark span {
  color: var(--brick);
}

.brand-tag {
  font-size: 0.82rem;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
}

.nav a {
  text-decoration: none;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0.25rem 0;
}

.nav a[aria-current="page"] {
  color: var(--forest-deep);
  box-shadow: inset 0 -2px 0 var(--leaf);
}

.hero,
.page-head {
  padding: 1.8rem 0 0.4rem;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  line-height: 1.25;
  margin: 0 0 0.6rem;
}

h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.45rem);
  max-width: 22ch;
}

h2 {
  font-size: 1.45rem;
  margin-top: 2rem;
}

h3 {
  font-size: 1.15rem;
  margin-top: 1.25rem;
}

.lead,
.prose p,
.faq p,
.lesson p {
  max-width: var(--measure);
}

.lead {
  font-size: 1.12rem;
  color: var(--ink-soft);
}

.kicker {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brick);
  font-weight: 700;
  margin: 0 0 0.4rem;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.card,
.tool-card,
.pillar {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.pillar,
.tool-card {
  padding: 1.1rem 1.15rem 1.2rem;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.pillar h2,
.tool-card h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.pillar p,
.tool-card p {
  margin: 0 0 0.9rem;
  color: var(--ink-soft);
  flex: 1;
}

.grid-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.btn,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn {
  background: var(--forest);
  color: #fff;
}

.btn:hover {
  background: var(--forest-deep);
  color: #fff;
}

.btn-secondary {
  background: var(--chalk);
  color: var(--forest-deep);
  border-color: #b7d0c5;
}

.worksheet {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.25rem;
  margin: 1.25rem 0 2rem;
}

.panel {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.25rem;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin-top: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.field span,
.field label {
  font-weight: 650;
  font-size: 0.95rem;
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  min-height: 2.6rem;
  border: 1px solid #c9c0ae;
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.85rem 0 0;
}

.examples-label {
  flex: 1 0 100%;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ink-soft);
}

.chip {
  border: 1px solid #c4d7cd;
  background: var(--chalk);
  color: var(--forest-deep);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
}

.chip:hover {
  background: #d5e8df;
}

.steps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.steps-head h3 {
  margin: 0;
}

.btn-quiet {
  background: transparent;
  border: 1px solid #c4d7cd;
  color: var(--forest-deep);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
}

.result {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 8px;
  background: var(--ok-bg);
  border: 1px solid #b7d0c5;
}

.result[hidden],
.steps[hidden],
.error[hidden] {
  display: none;
}

.error {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 8px;
  background: var(--warn-bg);
  border: 1px solid #e0c3b2;
  color: var(--brick);
}

.steps {
  margin-top: 1rem;
}

.steps ol {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.steps li {
  margin: 0.45rem 0;
}

.math {
  font-family: var(--serif);
  font-size: 1.06em;
}

.formula {
  display: block;
  margin: 0.7rem 0;
  padding: 0.7rem 0.85rem;
  background: var(--chalk);
  border-left: 4px solid var(--leaf);
  font-family: var(--serif);
  overflow-wrap: anywhere;
}

.lesson,
.practice,
.faq,
.prose {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.4rem;
  margin: 1.25rem 0;
}

.lesson {
  background:
    repeating-linear-gradient(
      to bottom,
      transparent,
      transparent 1.7rem,
      rgba(217, 208, 190, 0.35) 1.7rem,
      rgba(217, 208, 190, 0.35) calc(1.7rem + 1px)
    ),
    var(--sheet);
}

.answers {
  margin-top: 0.6rem;
}

details.answers {
  border-top: 1px dashed var(--rule);
  padding-top: 0.6rem;
}

details.answers summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--forest-deep);
}

.site-footer {
  margin-top: 2.5rem;
  padding: 1.4rem 0 2rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer p {
  max-width: var(--measure);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
  margin-bottom: 0.7rem;
}

.note {
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.diagram {
  width: 100%;
  height: auto;
  display: block;
}

.two-col-text {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.how {
  margin: 1.5rem 0 2rem;
}

@media (max-width: 860px) {
  .pillars,
  .worksheet,
  .grid-tools,
  .two-col-text {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .field-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: none;
  }

  .wrap {
    width: min(1080px, calc(100% - 1.25rem));
  }
}

@media print {
  .skip,
  .site-header,
  .nav,
  .examples,
  .actions,
  .chip,
  .btn,
  .btn-secondary,
  .btn-quiet,
  .footer-nav {
    display: none !important;
  }

  body {
    background: #fff;
    font-size: 11pt;
  }

  .worksheet {
    grid-template-columns: 1fr;
    box-shadow: none;
  }

  .panel,
  .lesson,
  .practice,
  .result,
  .steps {
    box-shadow: none;
    break-inside: avoid;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}
