/* --- UNIBOARD STRUCTURE ---
   Layout and structure first; colours live in vaio.css.
   Deliberately old school: monospace, bevels, tables, no framework. */

* { box-sizing: border-box; }

html, body { min-height: 100%; }

html { margin: 0; }

body {
  margin: 0;
  padding: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  font-family: "Courier New", "DejaVu Sans Mono", monospace;
  font-size: 16px;
  line-height: 1.45;
}

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

hr {
  border: none;
  border-bottom: 2px ridge;
  margin: .5em 0 1em;
  width: 100%;
  clear: both;
}

/* --- Sidebar --- */
#bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 11.5em;
  padding: 14px 12px;
  font-family: inherit;
}

.brand {
  font-size: 21px;
  font-weight: bold;
  line-height: 1.1;
  margin-bottom: 2px;
}
.brand a { text-decoration: none; }
.brand-sub {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 14px;
  opacity: .7;
}

#bar ul { margin: 0; padding: 0; list-style: none; }
.li-aside {
  font-size: 16px;
  padding: 5px 3px;
  border-bottom: 2px ridge;
  text-align: left;
}
.li-aside a { text-decoration: none; display: block; }
.li-aside a:hover, .li-aside a.here { text-decoration: underline; }
.li-aside a.here:before { content: "> "; }

.side-status {
  margin-top: 18px;
  font-size: 11px;
}
#clock {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: 1px;
}
.link-button {
  background: none;
  border: none;
  padding: 0;
  margin-top: 8px;
  font: inherit;
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

/* --- Main column --- */
#article {
  width: auto;
  max-width: 82em;
  margin-left: 13em;
  margin-right: 2em;
  padding: 1em 2em 2em;
  min-height: 100vh;
  text-align: left;
}
#article.logged-out { margin: 0 auto; max-width: 42em; padding-top: 6em; }

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.masthead .mast-left { font-weight: bold; }
.masthead .mast-right { opacity: .75; }

h1 {
  font-size: 38px;
  line-height: 1.1;
  font-weight: bold;
  margin: .35em 0 .15em;
  letter-spacing: -1px;
}
h2 {
  font-size: 22px;
  font-weight: bold;
  margin: 1.4em 0 .15em;
}
h3 { font-size: 18px; font-weight: bold; margin: 1.1em 0 .2em; }
p { margin: .55em 0; }
.subtitle { font-size: 14px; margin-top: 0; }
.small { font-size: 12px; }
.muted { opacity: .68; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.big-count { font-size: 18px; font-weight: bold; }
.error-text { color: #a00; font-weight: bold; }

a { text-decoration: none; }
a:hover { text-decoration: underline; }
a.link { text-decoration: underline; }
a.button, button, input[type=submit] {
  display: inline-block;
  font: 13px "Courier New", monospace;
  padding: 3px 9px;
  border: 2px outset #aaa;
  background: #d6d6d6;
  color: #000;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
}
a.button:hover, button:hover { text-decoration: none; }
a.button:active, button:active { border-style: inset; }
button.danger { color: #900; }
button.small { font-size: 11px; padding: 1px 5px; }
button.tick {
  border: none;
  background: none;
  padding: 0 4px 0 0;
  font-weight: bold;
  vertical-align: top;
}
button.link-button { border: none; background: none; padding: 0; }

/* --- Tables --- */
.table-scroll { width: 100%; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td {
  border: 1px solid;
  padding: 4px 7px;
  vertical-align: top;
  text-align: left;
}
th {
  font-size: 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
  background: rgba(128,128,128,.18);
}
.plain-table td, .plain-table th { font-size: 14px; }
.work-table td { font-size: 14px; }
.work-table tr.row-graded td, .work-table tr.row-submitted td { opacity: .7; }
.work-table.compact td, .work-table.compact th { font-size: 13px; padding: 3px 5px; }

.badge {
  display: inline-block;
  font-size: 10px;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 1px 5px;
  border: 1px solid;
  white-space: nowrap;
}
.badge.open { border-color: #666; }
.badge.submitted, .badge.graded { border-color: #2f6b3a; }
.badge.overdue, .badge.missing { border-color: #a00; font-weight: bold; }
.badge.soon { border-color: #a05a00; }
.tag {
  font-size: 10px;
  text-transform: uppercase;
  border: 1px solid;
  padding: 0 3px;
  opacity: .8;
}
.course-tag { white-space: nowrap; }
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 4px;
  vertical-align: baseline;
  border: 1px solid rgba(0,0,0,.3);
}
.overdue, .due-overdue { color: #b00000; font-weight: bold; }
.soon, .due-soon { color: #a05a00; font-weight: bold; }
.week, .due-week { font-weight: bold; }
.later, .due-later { opacity: .85; }

/* --- Notices --- */
.notice {
  border: 2px ridge;
  padding: 6px 10px;
  margin: 10px 0;
  font-size: 14px;
}
.notice.error { border-color: #a00; }
.notice.warn { border-color: #a05a00; }
.flash {
  border: 2px ridge;
  padding: 2px 10px;
  margin: 10px 0;
  font-size: 14px;
}
.flash p { margin: 3px 0; }

/* --- Ticker --- */
.ticker {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px ridge;
  padding: 3px 8px;
  margin: 10px 0 14px;
  font-size: 13px;
  overflow: hidden;
}
.ticker-label {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  border: 1px solid;
  padding: 0 4px;
  flex: 0 0 auto;
}
.ticker marquee { flex: 1; }

/* --- Dashboard --- */
.dash-grid { display: flex; gap: 1.8em; align-items: flex-start; }
.dash-main { flex: 2 1 0; min-width: 0; }
.dash-side { flex: 1 1 0; min-width: 0; }

.countdown-list, .task-list, .tight { list-style: none; margin: 0; padding: 0; }
.countdown-list li, .task-list li, .tight li {
  padding: 6px 0;
  border-bottom: 1px dotted;
}
.countdown-list li:last-child, .task-list li:last-child { border-bottom: none; }
.announcement {
  border-bottom: 1px dotted;
  padding: 7px 0;
}
.announcement:last-child { border-bottom: none; }
.ann-title { font-weight: bold; font-size: 15px; }
.ann-body { margin-top: 3px; }

/* --- Toolbars and filters --- */
.toolbar, .filters, .add-form, .module-actions, .mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin: 10px 0 14px;
  font-size: 13px;
}
.filters label { white-space: nowrap; }
.mini-stats {
  border: 1px solid;
  padding: 6px 10px;
  font-size: 13px;
}
.mini-stats span { margin-right: 16px; }
.search-form { display: flex; gap: 8px; margin: 12px 0; }

/* --- Forms --- */
input[type=text], input[type=password], input[type=datetime-local],
input[type=date], input[type=search], select, textarea {
  font: 14px "Courier New", monospace;
  border: 2px inset #999;
  background: #fff;
  color: #000;
  padding: 3px 4px;
  max-width: 100%;
}
textarea { width: 100%; }
form.stack { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
form.stack label { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
form.stack input[type=text], form.stack input[type=password] { min-width: 18em; }
form .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
label.grow { flex: 1 1 20em; }
.inline { display: inline; }
.quick-add { display: flex; gap: 5px; margin-top: 8px; }
.quick-add input { width: 100%; }
.wide { width: 100%; margin-bottom: 6px; }
.add-box { border: 2px ridge; padding: 8px 12px; margin: 12px 0; }
.add-box summary { cursor: pointer; font-weight: bold; }

/* --- Login --- */
.login-form { display: flex; flex-direction: column; gap: 10px; max-width: 22em; }
.login-form label { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }

/* --- Calendar --- */
.calendar { table-layout: fixed; width: 100%; }
.calendar th { text-align: center; font-size: 11px; }
.calendar td {
  height: 112px;
  padding: 3px 4px;
  vertical-align: top;
  width: 14.285%;
  overflow: hidden;
}
.cal-day.other-month { opacity: .45; }
.cal-day.is-today { outline: 2px solid; outline-offset: -2px; }
.cal-num { text-align: right; font-size: 13px; font-weight: bold; }
.cal-items { list-style: none; margin: 3px 0 0; padding: 0; font-size: 11px; line-height: 1.25; max-height: 86px; overflow: hidden; }
.cal-item { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item a { text-decoration: none; }
.cal-dot { display: inline-block; width: 6px; height: 6px; margin-right: 2px; vertical-align: middle; }
.cal-time { font-variant-numeric: tabular-nums; }
.legend { margin-top: 10px; }
.mobile-only { display: none; }
.entry-list { list-style: none; margin: 0; padding: 0; }
.entry { border-bottom: 1px dotted; padding: 7px 0; display: flex; gap: 14px; }
.entry-time { flex: 0 0 5.5em; font-weight: bold; }
.entry-title { flex: 1; }
.entry-deadline .entry-time { color: #a00000; }
.entry-exam .entry-time { color: #7a1f1f; }

/* --- Courses --- */
.course-grid { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 16px; }
.course-card {
  flex: 1 1 17em;
  max-width: 26em;
  border: 2px ridge;
  border-left-width: 9px;
  border-left-style: solid;
  padding: 8px 12px;
}
.course-card h2 { margin: .1em 0 .35em; font-size: 18px; }
.course-card p { margin: .25em 0; }
.course-checks { max-height: 22em; overflow-y: auto; border: 2px inset; padding: 8px; margin-bottom: 8px; }
label.check { display: flex; gap: 5px; align-items: center; font-size: 13px; padding: 2px 0; }

/* --- Modules --- */
details.module { border: 2px ridge; margin: 8px 0; padding: 5px 10px; }
details.module summary { cursor: pointer; }
details.module[open] { padding-bottom: 10px; }
.module-items { list-style: none; margin: 8px 0 0; padding: 0 0 0 8px; }
.module-items li { padding: 2px 0; font-size: 14px; }
.mod-subheader {
  font-weight: bold;
  margin-top: 8px;
  border-bottom: 1px dotted;
}
.module-actions { font-size: 12px; }

/* --- Topics --- */
.topic-table td { vertical-align: middle; }
.status-btn { font-size: 11px; min-width: 7.5em; border-width: 2px; }
.status-btn.s0 { background: #ddd; }
.status-btn.s1 { background: #ffe9a8; }
.status-btn.s2 { background: #bfe6bf; }
.progress { font-family: "Courier New", monospace; font-weight: bold; letter-spacing: 1px; }

/* --- Notes --- */
.note-form { margin-top: 12px; }
.note-body {
  width: 100%;
  font: 15px/1.5 "Courier New", monospace;
  margin: 10px 0;
}
.note-form .row { margin: 8px 0; }

/* --- Settings --- */
.settings-grid { display: flex; gap: 2.2em; align-items: flex-start; margin-top: 8px; }
.settings-grid > div { flex: 1 1 0; min-width: 0; }
.feed-row { border-bottom: 1px dotted; padding: 6px 0; margin-bottom: 4px; }

/* --- Canvas page content --- */
.canvas-page { font-size: 15px; max-width: 70em; }
.canvas-page table { width: auto; margin: 10px 0; }
.canvas-page img { height: auto; }
.canvas-page h1, .canvas-page h2, .canvas-page h3 { margin-top: 1em; }

/* --- Footer --- */
.site-footer { margin-top: 22px; font-size: 12px; }
.site-footer p { margin: 4px 0; }
.theme-links a { text-decoration: underline; }

/* --- Responsive --- */
@media (max-width: 900px) {
  body { background-attachment: scroll; }
  #bar {
    position: static;
    width: auto;
    padding: 10px 12px 4px;
    border-style: none;
  }
  #bar ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
  }
  .li-aside {
    border: none;
    padding: 4px 10px 4px 0;
    font-size: 15px;
  }
  .brand { display: inline-block; }
  .brand-sub { display: inline-block; margin-left: 8px; }
  .side-status {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 4px 0 8px;
    border-top: 1px dotted;
    padding-top: 4px;
  }
  #clock { font-size: 15px; }
  #article {
    width: auto;
    max-width: none;
    margin: 0;
    padding: .5em 12px 2em;
    min-height: 0;
  }
  h1 { font-size: 30px; }
  h2 { font-size: 20px; }
  .dash-grid, .settings-grid { display: block; }
  .dash-side { margin-top: 10px; }
  .mobile-only { display: block; }
  .calendar-wrap { display: none; }
  .mobile-agenda h3 {
    margin: 14px 0 2px;
    border-bottom: 1px solid;
    font-size: 15px;
  }
  .mobile-agenda .entry-list { margin-bottom: 8px; }
  .calendar { min-width: 640px; }
  .calendar td { height: 88px; }
  .cal-items { max-height: 62px; }
  .course-grid { display: block; }
  .course-card { max-width: none; margin-bottom: 10px; }
  .entry { display: block; }
  .entry-time { display: inline; margin-right: 8px; }
  .toolbar, .filters { gap: 6px; }
  .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  marquee { animation: none; }
}

@media print {
  #bar, .toolbar, .filters, .site-footer, .ticker { display: none; }
  #article { margin: 0; max-width: none; }
  body { background: #fff !important; color: #000 !important; }
}
