:root {
  color-scheme: light;
  --ink: #173f3b;
  --muted-ink: #526965;
  --teal: #087d73;
  --teal-dark: #08645d;
  --teal-pale: #e8f8f5;
  --orange: #c84c12;
  --paper: #fffefb;
  --canvas: #f4fbf9;
  --line: #cde8e3;
  --shadow: 0 18px 60px rgba(22, 78, 71, .12);
  --radius-lg: 24px;
  --radius-md: 14px;
  font-family: "Avenir Next", Avenir, "Nunito Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--canvas); }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(20, 184, 166, .12), transparent 28rem),
    var(--canvas);
  font-size: 1rem;
  line-height: 1.6;
}

a { color: var(--teal-dark); }

button, input { font: inherit; }

button { cursor: pointer; touch-action: manipulation; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: .75rem;
  left: .75rem;
  padding: .7rem 1rem;
  border-radius: .5rem;
  color: white;
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid #f08245;
  outline-offset: 3px;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(20rem, .9fr) minmax(26rem, 1.1fr);
  min-height: 100dvh;
}

.welcome-panel,
.signin-panel { padding: clamp(2rem, 6vw, 5.5rem); }

.welcome-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #f7fffd;
  background:
    linear-gradient(145deg, rgba(8, 125, 115, .96), rgba(7, 82, 78, .98)),
    var(--teal);
}

.talkers-brand {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

.talkers-brand span:last-child { display: grid; line-height: 1.15; }
.talkers-brand strong { font-size: 1.1rem; letter-spacing: .01em; }
.talkers-brand small { margin-top: .2rem; opacity: .76; }

.talkers-mark {
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  border: 2px solid rgba(255, 255, 255, .55);
  border-radius: .9rem;
  background: rgba(255, 255, 255, .12);
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

.welcome-copy { max-width: 35rem; margin: clamp(4rem, 13vh, 9rem) 0; }

.eyebrow {
  margin: 0 0 .65rem;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.welcome-copy .eyebrow { color: #bff5eb; }

.welcome-copy h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 4.8rem);
  line-height: 1.03;
  letter-spacing: -.045em;
  text-wrap: balance;
}

.welcome-copy > p:last-child {
  max-width: 37rem;
  margin: 1.6rem 0 0;
  color: rgba(247, 255, 253, .8);
  font-size: 1.08rem;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: .9rem;
  color: rgba(247, 255, 253, .78);
}

.privacy-note svg { width: 1.25rem; flex: 0 0 auto; }

.signin-panel {
  display: grid;
  place-items: center;
  background: var(--paper);
}

.signin-card { width: min(100%, 29rem); }
.signin-card .eyebrow { color: var(--teal); }

.signin-card h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.signin-intro { margin: .85rem 0 2.25rem; color: var(--muted-ink); }

form { display: grid; }

label { margin: 0 0 .45rem; font-weight: 700; }

input {
  width: 100%;
  min-height: 3.25rem;
  padding: .75rem .9rem;
  border: 1.5px solid #a8c9c3;
  border-radius: .75rem;
  color: var(--ink);
  background: white;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:hover { border-color: var(--teal); }
input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(8, 125, 115, .12); outline: none; }

.password-label { margin-top: 1.15rem; }

.password-field { position: relative; }
.password-field input { padding-right: 4.5rem; }

.text-button {
  position: absolute;
  top: 50%;
  right: .45rem;
  min-width: 3.5rem;
  min-height: 2.4rem;
  border: 0;
  border-radius: .5rem;
  color: var(--teal-dark);
  background: transparent;
  font-weight: 750;
}

.text-button:hover { background: var(--teal-pale); }

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 3.35rem;
  margin-top: 1.5rem;
  padding: .8rem 1rem;
  border: 0;
  border-radius: .8rem;
  color: white;
  background: var(--teal);
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(8, 125, 115, .2);
  transition: background 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-button svg { width: 1.2rem; }
.primary-button:hover { background: var(--teal-dark); box-shadow: 0 8px 22px rgba(8, 125, 115, .27); }
.primary-button:disabled { cursor: wait; opacity: .62; }

.form-error {
  margin: 0 0 1rem;
  padding: .8rem .9rem;
  border-left: 4px solid #b42318;
  border-radius: .45rem;
  color: #7a271a;
  background: #fff1ef;
}

.help-text { margin: 1.5rem 0 0; color: var(--muted-ink); font-size: .9rem; }

/* Authenticated student pages */
.student-shell { min-height: 100dvh; }

.student-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 251, .94);
}

.student-header-inner,
.student-main {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
}

.student-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.75rem;
  gap: 1rem;
}

.student-header .talkers-brand { color: var(--ink); }

.logout-button {
  min-height: 2.75rem;
  padding: .55rem .9rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  color: var(--ink);
  background: white;
  font-weight: 700;
}

.logout-button:hover { border-color: var(--teal); background: var(--teal-pale); }

.student-main { padding-block: clamp(2rem, 6vw, 4.5rem); }

.student-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, white 55%, var(--teal-pale));
  box-shadow: var(--shadow);
}

.student-hero h1,
.lesson-content h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4rem);
  line-height: 1.06;
  letter-spacing: -.04em;
}

.student-hero p { max-width: 55ch; margin: .9rem 0 0; color: var(--muted-ink); }

.lesson-count {
  display: grid;
  place-items: center;
  min-width: 6.5rem;
  min-height: 6.5rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  text-align: center;
}

.lesson-count strong { display: block; font-size: 1.7rem; line-height: 1; }
.lesson-count span { font-size: .75rem; color: var(--muted-ink); text-transform: uppercase; letter-spacing: .08em; }

.lesson-list { margin-top: 2rem; }
.lesson-list h2 { margin-bottom: 1rem; }

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
}

.lesson-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 6.5rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink);
  background: white;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(22, 78, 71, .06);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.lesson-card:hover { border-color: var(--teal); box-shadow: 0 8px 22px rgba(22, 78, 71, .1); }
.lesson-card small { display: block; color: var(--muted-ink); }
.lesson-card svg { width: 1.25rem; flex: 0 0 auto; }

.lesson-layout {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
}

.lesson-nav { align-self: start; position: sticky; top: 1.5rem; }
.lesson-nav strong { display: block; margin-bottom: .7rem; }
.lesson-nav a { display: block; padding: .5rem .65rem; border-radius: .5rem; color: var(--muted-ink); text-decoration: none; }
.lesson-nav a:hover, .lesson-nav a[aria-current="page"] { color: var(--teal-dark); background: var(--teal-pale); }

.lesson-content {
  min-width: 0;
  max-width: 48rem;
  overflow-wrap: anywhere;
}

.lesson-content h2 { margin-top: 2.5rem; font-size: 1.7rem; line-height: 1.2; }
.lesson-content h3 { margin-top: 2rem; }
.lesson-content p, .lesson-content li { max-width: 72ch; }
.lesson-content table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.lesson-content th, .lesson-content td { padding: .65rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.lesson-content th { background: var(--teal-pale); }
.table-wrap { max-width: 100%; overflow-x: auto; }

.callout {
  margin: 1.5rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: .75rem;
  background: var(--teal-pale);
}

.callout.comment { border-left-color: var(--orange); background: #fff6ed; }
.callout p { margin: .35rem 0 0; }

.attachment-list { display: grid; gap: .7rem; padding: 0; list-style: none; }
.attachment-list a { display: inline-flex; align-items: center; min-height: 2.75rem; }

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .welcome-panel { min-height: auto; padding-bottom: 2.5rem; }
  .welcome-copy { margin: 4rem 0 2.5rem; }
  .welcome-copy h1 { font-size: clamp(2.4rem, 12vw, 3.6rem); }
  .signin-panel { padding-block: 3.5rem; }
  .student-hero { grid-template-columns: 1fr; align-items: start; }
  .lesson-count { min-width: 5.6rem; min-height: 5.6rem; }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-nav { position: static; border-bottom: 1px solid var(--line); padding-bottom: 1rem; }
  .lesson-nav div { display: flex; gap: .35rem; overflow-x: auto; }
  .lesson-nav a { white-space: nowrap; }
}

@media (max-width: 420px) {
  .welcome-panel, .signin-panel { padding-inline: 1.25rem; }
  .student-header-inner, .student-main { width: min(100% - 1.25rem, 72rem); }
  .student-header .talkers-brand small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
