/* Terra Learning: layout, header, footer, and the Terra pages (home, courses, about, resources, login). */

:root {
  --ink: #121114;
  --paper: #ffffff;
  --sand: #f5f5f5;
  --line: #e4e4e4;
  --muted: #5c5c60;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Outfit, sans-serif;
}
a { color: inherit; }
button { font: inherit; }

.site-header, .site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px 6vw;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.mark {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  text-decoration: none;
}
.mark img { display: block; height: 42px; width: auto; }
.site-header nav {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.site-header nav a {
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}
.site-header nav a.active { box-shadow: inset 0 -2px 0 currentColor; }
.account-menu { position: relative; }
.account-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.account-toggle:hover,
.account-toggle[aria-expanded="true"],
.account-toggle.is-in {
  background: var(--ink);
  color: white;
}
.account-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  min-width: 196px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(18, 17, 20, 0.12);
}
.account-panel[hidden] { display: none; }
.account-panel a {
  display: block;
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
}
.account-panel a:hover { background: var(--sand); }
.account-panel a.account-logout { color: #c62828; }
.account-panel a.account-logout:hover { background: #fdecec; color: #c62828; }
.account-user {
  margin: 0;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.site-footer {
  background: var(--paper);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer p { margin: 0; }
.site-footer p:first-child {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.hero {
  position: relative;
  min-height: calc(100vh - 78px);
  min-height: calc(100dvh - 78px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 72px 6vw;
  color: white;
  background:
    linear-gradient(100deg, rgba(8, 14, 12, 0.82) 0%, rgba(8, 14, 12, 0.42) 46%, rgba(8, 14, 12, 0.12) 100%),
    var(--hero) center 40% / cover no-repeat;
}
.eyebrow {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.hero .eyebrow { color: rgba(255, 255, 255, 0.78); }
.hero h1 {
  margin: 0 0 16px;
  max-width: 12ch;
  color: white;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
}
.hero p:last-child {
  max-width: 40rem;
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.15rem;
  line-height: 1.45;
}

.catalog {
  padding: 56px 6vw 80px;
  background: var(--sand);
}
.catalog h2 {
  margin: 0 0 22px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
}
.catalog > h1 {
  margin: 0 0 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
}
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.course-card {
  display: flex;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(18, 17, 20, 0.12);
}
.card-link {
  display: flex;
  flex-direction: column;
  width: 100%;
  color: inherit;
  text-decoration: none;
}
.course-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--sand);
}
.course-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}
.course-card:hover .course-thumb img { transform: scale(1.06); }
.course-thumb .eyebrow {
  position: absolute;
  left: 14px;
  bottom: 14px;
  margin: 0;
  padding: 6px 10px;
  background: white;
  color: var(--ink);
}
.course-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  padding: 18px 18px 20px;
}
.course-card h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.course-card p { margin: 0; color: #2a2a2e; }
.course-meta {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
}
.catalog-more { margin: 28px 0 0; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 650;
  text-decoration: none;
}
.button:hover { background: #2a2a2e; color: white; }
button.button { cursor: pointer; font: inherit; }
button.button:disabled { opacity: 0.6; cursor: progress; }

.account-page {
  display: grid;
  place-items: center;
  padding: 48px 6vw 88px;
  background: var(--sand);
  min-height: calc(100vh - 160px);
}
.account-card {
  width: min(440px, 100%);
  padding: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.account-card h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.account-card p { margin: 0 0 18px; color: #2a2a2e; }
.account-card form { display: grid; gap: 14px; }
.account-card label {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.account-card input {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--sand);
  text-transform: none;
  letter-spacing: 0;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
}
.account-card .button { justify-self: start; margin-top: 4px; }
.account-card p.form-error { color: #9a3b3b; font-weight: 650; margin: 0; }
.account-card p.account-note { color: var(--muted); margin: 0; }
.account-card form + form { margin-top: 14px; }
.account-card .button.is-secondary { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
/* Honeypot field: off-screen for people, still in the form for bots */
.account-card .account-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.account-card p.account-alt { margin: 16px 0 0; color: var(--muted); font-size: 0.95rem; }
.account-card p.account-alt a { color: var(--ink); font-weight: 700; }

.about-page { background: var(--sand); }
.about-intro {
  padding: 64px 6vw 36px;
  background: var(--paper);
}
.about-intro h1, .about-lead, .about-intro p:not(.eyebrow) { max-width: 760px; }
.about-intro h1, .about-gallery h2, .about-platform h2 {
  margin: 0 0 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.about-intro h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); }
.about-lead {
  margin: 0 0 14px;
  font-size: 1.2rem;
  line-height: 1.45;
}
.about-intro .button { margin-top: 8px; }
.about-feature {
  position: relative;
  display: block;
  margin: 0 6vw;
  overflow: hidden;
  text-decoration: none;
  background: var(--paper);
}
.about-feature img {
  display: block;
  width: 100%;
  height: min(62vh, 560px);
  object-fit: cover;
  object-position: center 62%;
  transition: transform 0.5s ease;
}
.about-feature:hover img { transform: scale(1.03); }
.about-feature span {
  position: absolute;
  left: 16px;
  bottom: 16px;
  padding: 8px 12px;
  background: white;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.about-gallery { padding: 48px 6vw 20px; }
.about-gallery h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.about-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.about-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.about-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(18, 17, 20, 0.12);
}
.about-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  transition: transform 0.45s ease;
}
.about-card:hover img { transform: scale(1.06); }
.about-card div { display: flex; flex-direction: column; gap: 8px; padding: 18px 18px 20px; flex: 1; }
.about-card h3 { margin: 0; font-size: 1.15rem; letter-spacing: -0.02em; }
.about-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.about-platform {
  padding: 64px 6vw 80px;
  background: var(--paper);
}
.about-platform h2 {
  max-width: 12ch;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
}
.about-platform .about-lead,
.about-platform p { max-width: 42rem; }
.about-platform p:not(.eyebrow):not(.about-lead) {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.resources-page {
  padding: 56px 6vw 88px;
  background: var(--sand);
}
.resources-page h1 {
  margin: 0 0 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
  font-size: clamp(2rem, 4vw, 3.2rem);
}
.resources-page > p { max-width: 42rem; font-size: 1.05rem; line-height: 1.55; margin-top: 0; }
.resource-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 8px; }
.resource-jump a {
  text-decoration: none;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  background: white;
  font-weight: 650;
}
.resource-group { scroll-margin-top: 96px; margin-top: 36px; }
.resource-group h2 {
  margin: 0 0 8px;
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  letter-spacing: -0.02em;
}
.resource-group > p { margin: 0 0 14px; max-width: 40rem; color: #2a2a2e; }
.resource-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.resource-list li {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 16px 18px;
  background: white;
  border: 1px solid var(--line);
}
.resource-list a { font-weight: 700; }
.resource-list span { color: var(--muted); }

@media (max-width: 900px) {
  .catalog-grid, .about-grid { grid-template-columns: 1fr; }
  .site-header { flex-wrap: wrap; align-items: flex-start; }
  .mark img { height: 36px; }
  .site-header nav { width: 100%; gap: 14px 18px; }
  .site-footer { align-items: flex-start; flex-direction: column; }
}

/* ---- Added: shared theme pieces ---- */
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}
.skip-link:focus {
  clip: auto; width: auto; height: auto;
  left: 12px; top: 12px; z-index: 100;
  padding: 10px 14px;
  background: var(--ink); color: #fff;
}
.account-user span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}
.course-status {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff !important;
  font-size: 0.78rem;
  font-weight: 650;
}
.site-footer { flex-wrap: wrap; }
.footer-brand p { margin: 0; }
.footer-brand p:first-child {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  margin-bottom: 4px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-links a { text-decoration: none; font-weight: 600; color: var(--ink); }
.footer-links a:hover { text-decoration: underline; }
.account-card .account-forgot { font-size: 0.9rem; color: var(--muted); font-weight: 600; }

/* Compact header on phones: logos + account on one row, links on the next */
@media (max-width: 900px) {
  .site-header { padding: 12px 5vw 0; gap: 10px; }
  .mark { gap: 14px; }
  .mark img { height: 32px; }
  .site-header nav {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 10px;
    scrollbar-width: none;
  }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav a { white-space: nowrap; padding: 6px 0; }
  .account-menu { position: absolute; top: 12px; right: 5vw; }
  .account-toggle { width: 36px; height: 36px; }
}

/* ---- Course search ---- */
.course-search {
  position: relative;
  display: flex;
  gap: 10px;
  max-width: 720px;
  margin: 0 0 12px;
}
.course-search input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 18px 0 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.course-search input:focus { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.course-search-icon { position: absolute; left: 16px; top: 14px; color: var(--muted); pointer-events: none; }
.course-search .button { height: 48px; }
.course-search-status { margin: 0 0 22px; color: var(--muted); font-weight: 600; }
.course-search-status a { color: var(--ink); }
.course-card[hidden] { display: none; }
.course-search-empty { padding: 32px; background: var(--paper); border: 1px solid var(--line); }
.course-search-empty[hidden] { display: none; }
.course-search-empty h2 { margin: 0 0 8px; font-size: 1.4rem; }
.course-search-empty p { margin: 0; color: var(--muted); }
.course-search-empty a { color: var(--ink); font-weight: 700; }
@media (max-width: 600px) {
  .course-search .button { padding: 0 16px; }
  .course-search input::placeholder { font-size: 0.85rem; }
}

/* ---- Verify a certificate ---- */
.verify-page {
  display: grid;
  place-items: start center;
  padding: 56px 6vw 88px;
  background: var(--sand);
}
.verify-card {
  width: min(640px, 100%);
  padding: 32px clamp(20px, 4vw, 40px);
  background: var(--paper);
  border: 1px solid var(--line);
}
.verify-card h1 { margin: 0 0 10px; font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -0.02em; }
.verify-card > p:not(.eyebrow) { margin: 0 0 22px; color: #2a2a2e; line-height: 1.5; }
.verify-form label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.verify-row { display: flex; gap: 10px; }
.verify-row input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--sand);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
}
.verify-row input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.verify-row .button { height: 48px; }
.verify-result { margin-top: 26px; padding: 22px; border: 1px solid var(--line); }
.verify-result.is-valid { border-color: #1f7a4d; background: #f1faf5; }
.verify-result.is-invalid { border-color: #c62828; background: #fdf3f3; }
.verify-badge { margin: 0 0 14px; font-weight: 700; font-size: 1.1rem; }
.is-valid .verify-badge { color: #1f7a4d; }
.is-invalid .verify-badge { color: #c62828; }
.verify-result p { margin: 0; line-height: 1.5; }
.verify-result dl { display: grid; gap: 10px; margin: 0 0 18px; }
.verify-result dl div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; }
.verify-result dt { color: var(--muted); font-weight: 600; }
.verify-result dd { margin: 0; font-weight: 700; }
.verify-result dd a { color: var(--ink); }
.verify-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; font-weight: 600; }
@media (max-width: 600px) {
  .verify-row { flex-direction: column; }
  .verify-result dl div { grid-template-columns: 1fr; gap: 2px; }
}
