/* ===========================================================================
   EE 194 / 290C course site, after the CS 285 course page: white, near
   monochrome, light Raleway headings over Work Sans.

   Berkeley blue and gold appear only here, and the restraint is the look:

     California gold     rule at the top of the page, current calendar week,
                         link hover underlines, note callout
     Founders Rock blue  prose links, focus ring
     Berkeley blue       link hover, skip link
   =========================================================================== */

/* --- Tokens ------------------------------------------------------------- */

:root {
  --heading: #3a3a3a;
  --ink: #444444;
  --muted: #8c8c8c;
  --faint: #aeaeae;

  --page: #ffffff;
  --panel: #f4f4f4;
  --rule: #dcdcdc;
  --rule-strong: #bdbdbd;

  /* The sparse accents. */
  --berkeley-blue: #003262;
  --founders-rock: #3b7ea1;
  --california-gold: #fdb515;

  /* Inline prose links only. */
  --link: var(--founders-rock);
  --link-hover: var(--berkeley-blue);

  /* List links: dark text, quiet underline that warms to gold on hover. */
  --list-link: #333333;
  --list-rule: #c4c4c4;

  --note-bg: #fdf8ec;
  --note-rule: var(--california-gold);

  --wrap: 1080px;
  --gutter: 28px;

  --sans: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
    Arial, sans-serif;
  --display: "Raleway", var(--sans);
}

/* --- Reset -------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* The only accent visible without interacting. Delete for full monochrome. */
body::before {
  content: "";
  display: block;
  height: 3px;
  background: var(--california-gold);
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

a:hover,
a:focus {
  color: var(--link-hover);
}

:focus-visible {
  outline: 2px solid var(--founders-rock);
  outline-offset: 3px;
}

h1,
h2,
h3,
h4 {
  color: var(--heading);
  font-family: var(--display);
  font-weight: 300;
  line-height: 1.18;
  margin: 0 0 0.5em;
}

p {
  margin: 0 0 1em;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

code,
pre,
kbd {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
}

code {
  background: var(--panel);
  border-radius: 2px;
  padding: 0.1em 0.35em;
}

pre {
  background: var(--panel);
  border-radius: 2px;
  overflow-x: auto;
  padding: 1rem 1.2rem;
}

pre code {
  background: none;
  padding: 0;
}

.sr-only-inline {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-to-main {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--berkeley-blue);
  color: #fff;
  padding: 0.7rem 1.2rem;
}

.skip-to-main:focus {
  left: 0;
  color: #fff;
}

/* --- Section scaffolding ------------------------------------------------ */

.wrap-container {
  width: 100%;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
}

/* --- Header ------------------------------------------------------------- */

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 1.7rem;
  padding-bottom: 1.7rem;
}

.header-title {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  margin: 0;
  white-space: nowrap;
}

.header-title a {
  color: var(--heading);
}

.header-title a:hover {
  color: #000;
}

.header-title .term {
  color: var(--faint);
  font-size: 0.62em;
  letter-spacing: 0.04em;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  color: var(--heading);
  font-size: 0.83rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.site-nav a:hover,
.site-nav a:focus {
  color: #000;
}

/* --- Hero --------------------------------------------------------------- */

.page-head .wrap {
  padding-top: 4rem;
  padding-bottom: 2.5rem;
}

.head-subtitle {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.head-title {
  font-size: clamp(2.4rem, 5.5vw, 3.5rem);
  letter-spacing: -0.005em;
  margin-bottom: 0.5rem;
}

.head-tagline {
  color: var(--ink);
  font-size: 1.08rem;
  max-width: 48rem;
  margin-bottom: 0.4rem;
}

.head-meta {
  color: var(--ink);
  font-size: 1.02rem;
  margin-bottom: 0.3rem;
}

.head-meta strong {
  font-weight: 600;
}

/* Announcements are plain paragraphs, as on the reference site. */
.announcements {
  margin-top: 1.6rem;
}

.announcement {
  margin-bottom: 0.55rem;
}

.announcement:last-child {
  margin-bottom: 0;
}

/* Optional tinted callout, for things like a compute-sponsor credit. */
.note {
  background: var(--note-bg);
  border-left: 3px solid var(--note-rule);
  padding: 0.85rem 1.2rem;
  margin: 1.4rem 0;
  font-size: 0.97rem;
}

.note p:last-child {
  margin-bottom: 0;
}

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

.head-people {
  margin-top: 3rem;
}

.people-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.6rem 3rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.person {
  display: flex;
  align-items: flex-start;
  gap: 1.3rem;
}

/* Start a new row per role group, so instructors and GSIs never share one. */
.people-grid .starts-group {
  grid-column: 1;
}

.person-avatar {
  flex: 0 0 104px;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel);
}

.person-image {
  display: block;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.person-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--panel);
  color: var(--faint);
  font-family: var(--display);
  font-size: 2.4rem;
  font-weight: 300;
}

.person-text {
  min-width: 0;
  padding-top: 0.1rem;
}

.person-name {
  font-size: 1.42rem;
  margin: 0 0 0.35rem;
}

.person-role {
  color: var(--muted);
}

.person-name a {
  color: var(--heading);
  border-bottom: 1px solid var(--list-rule);
}

.person-name a:hover {
  color: #000;
  border-bottom-color: var(--california-gold);
}

.person-text p {
  font-size: 0.98rem;
  color: var(--muted);
  margin: 0 0 0.1rem;
  overflow-wrap: anywhere;
}

.person-text p a {
  color: var(--muted);
}

.person-text p a:hover {
  color: var(--heading);
}

.person-text .person-bio {
  margin-top: 0.4rem;
  font-size: 0.92rem;
  color: var(--faint);
}

/* --- Semester calendar -------------------------------------------------- */

.calendar {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.6rem;
  font-size: 0.97rem;
}

.calendar thead th {
  border-bottom: 1px solid var(--rule-strong);
  padding: 0 0.9rem 0.6rem 0;
  text-align: left;
  vertical-align: bottom;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.calendar tbody th,
.calendar tbody td {
  border-bottom: 1px solid var(--rule);
  padding: 0.95rem 0.9rem 0.95rem 0;
  text-align: left;
  vertical-align: top;
  font-weight: 400;
}

.calendar tbody tr:last-child th,
.calendar tbody tr:last-child td {
  border-bottom: 1px solid var(--rule-strong);
}

/* Short fixed-shape strings; never let "Week 18" or "Aug 28" wrap.
   The week column is also sized for the "This week" badge. */
.calendar .col-week {
  width: 6.5rem;
  padding-left: 0.9rem;
  color: var(--heading);
  font-weight: 500;
  white-space: nowrap;
}

.calendar .col-date {
  width: 4.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.calendar .col-topic {
  width: 28%;
  color: var(--heading);
}

.topic-slides {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.87rem;
}

.calendar .col-notes {
  width: 18%;
  color: var(--muted);
  font-size: 0.9rem;
}

.calendar .lists {
  margin: 0;
}

.calendar .lists li {
  padding: 0.1rem 0;
  font-size: 0.95rem;
}

.calendar .none {
  color: var(--faint);
}

/* The week covering today, marked by the script. */
.calendar tr.is-current th,
.calendar tr.is-current td {
  background: #fbfbfb;
}

.calendar tr.is-current .col-week {
  box-shadow: inset 3px 0 0 var(--california-gold);
}

.week-now {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.05em 0.45em;
  border: 1px solid var(--california-gold);
  border-radius: 2px;
  color: #8a6100;
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --- Standard link sections --------------------------------------------- */

.standard-text .wrap {
  padding-top: 2.6rem;
  padding-bottom: 1rem;
}

main > .standard-text:last-child .wrap {
  padding-bottom: 7rem;
}

.standard-title {
  font-size: clamp(1.9rem, 3.6vw, 2.5rem);
  margin-bottom: 0.35rem;
}

.standard-text h3 {
  font-size: 1.42rem;
  color: var(--heading);
  margin-top: 1.8rem;
  margin-bottom: 0.4rem;
}

.section-intro {
  color: var(--ink);
  max-width: 48rem;
  margin-bottom: 0.4rem;
}

/* --- Link lists --------------------------------------------------------- */

.lists {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.lists li {
  padding: 0.28rem 0;
  font-size: 1rem;
  break-inside: avoid;
}

/* Dark text with a quiet underline, not blue. */
.lists a {
  color: var(--list-link);
  border-bottom: 1px solid var(--list-rule);
}

.lists a:hover {
  color: #000;
  border-bottom-color: var(--california-gold);
}

.lists .pending {
  color: var(--faint);
}

.lists .pending::after {
  content: "TBD";
  display: inline-block;
  margin-left: 0.55rem;
  padding: 0.05em 0.4em;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--faint);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.lists.two-col {
  columns: 2;
  column-gap: 3rem;
}

/* --- Embedded course outline -------------------------------------------- */

.outline-embed {
  width: 100%;
  min-height: 900px;
  border: 1px solid var(--rule);
  margin-top: 1.2rem;
  background: #fff;
}

.embed-placeholder {
  margin-top: 1.2rem;
  border: 1px dashed var(--rule);
  background: var(--panel);
  color: var(--muted);
  padding: 2.5rem;
  text-align: center;
  font-size: 0.95rem;
}

/* --- Prose (syllabus and other markdown pages) -------------------------- */

.prose {
  max-width: 46rem;
}

.prose h2 {
  font-size: 1.9rem;
  margin-top: 2.6rem;
}

.prose h3 {
  font-size: 1.32rem;
  margin-top: 1.8rem;
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose blockquote {
  border-left: 3px solid var(--rule-strong);
  margin: 1.5rem 0;
  padding: 0.4rem 1.3rem;
  color: var(--muted);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.96rem;
}

.prose th,
.prose td {
  border-bottom: 1px solid var(--rule);
  padding: 0.6rem 0.9rem 0.6rem 0;
  text-align: left;
}

.prose th {
  color: var(--heading);
  font-weight: 500;
}

/* --- Footer baseline --------------------------------------------------- */

.footer-baseline .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem;
  padding-top: 2.2rem;
  padding-bottom: 7rem;
  font-size: 0.84rem;
  color: var(--faint);
}

/* Deliberately indistinguishable from the surrounding text. */
.footer-baseline a,
.footer-baseline a:hover,
.footer-baseline a:focus {
  color: inherit;
  font: inherit;
  text-decoration: none;
  border-bottom: 0;
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 900px) {
  .people-grid {
    grid-template-columns: 1fr;
  }

  .calendar .col-week {
    width: 4.6rem;
  }

  .calendar .col-date {
    width: 4rem;
  }

  .calendar .col-topic {
    width: 26%;
  }
}

@media (max-width: 720px) {
  :root {
    --gutter: 20px;
  }

  body {
    font-size: 16px;
  }

  .site-header .wrap {
    flex-wrap: wrap;
    gap: 0.8rem;
  }

  .header-title {
    font-size: 1.6rem;
  }

  .page-head .wrap {
    padding-top: 2.5rem;
  }

  .lists.two-col {
    columns: 1;
  }

  /* One card per week: the columns will not fit, and side-scrolling is worse. */
  .calendar,
  .calendar tbody,
  .calendar tr,
  .calendar tbody th,
  .calendar tbody td {
    display: block;
    width: auto;
  }

  .calendar thead {
    display: none;
  }

  .calendar tbody tr {
    border-bottom: 1px solid var(--rule-strong);
    padding: 1.1rem 0;
  }

  .calendar tbody th,
  .calendar tbody td {
    border-bottom: 0;
    padding: 0 0 0.5rem;
  }

  .calendar tbody tr:last-child th,
  .calendar tbody tr:last-child td {
    border-bottom: 0;
  }

  .calendar .col-week,
  .calendar .col-date,
  .calendar .col-topic,
  .calendar .col-notes {
    width: auto;
    white-space: normal;
  }

  /* Hides a stranded column label. Flagged in the template rather than
     matched with :empty, which fails on the whitespace Liquid leaves. */
  .calendar td.is-empty {
    display: none;
  }

  .calendar .col-week {
    padding-bottom: 0;
  }

  /* Restore the column headers the stacked layout drops. */
  .calendar td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.2rem;
    color: var(--faint);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
  }

  .calendar .col-topic {
    color: var(--heading);
    font-size: 1.05rem;
  }

  .calendar .col-topic::before {
    display: none !important;
  }

  .calendar tr.is-current th,
  .calendar tr.is-current td {
    background: none;
  }

  .calendar tr.is-current {
    background: #fbfbfb;
    box-shadow: inset 3px 0 0 var(--california-gold);
    padding-left: 0.9rem;
  }

  .calendar tr.is-current .col-week {
    box-shadow: none;
  }
}

@media (max-width: 520px) {
  .person-avatar {
    flex-basis: 76px;
    width: 76px;
    height: 76px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* --- Print -------------------------------------------------------------- */

@media print {
  .site-header,
  .footer-baseline,
  .skip-to-main {
    display: none !important;
  }

  body {
    font-size: 11pt;
    color: #000;
  }

  .calendar tr {
    break-inside: avoid;
  }

  .calendar tr.is-current th,
  .calendar tr.is-current td {
    background: none;
  }

  .wrap {
    max-width: none;
    padding: 0;
  }

  a {
    color: #000;
  }
}
