/* UND Community Quilt — prototype styles
   Brand reference: https://campus.und.edu/brand/
   Colors: UND Green #009A44, accessible link green #00662c, gray #AEAEAE
   Typography: Oswald Medium (headings), Arial/Helvetica (body), Trocchi (accent serif)
*/

:root {
  --und-green: #009a44;
  --und-green-dark-mid: #005a28;
  --und-green-dark-light: #007838;
  --und-gray: #aeaeae;
  --und-gray-light: #f4f4f4;
  --und-black: #000;
  --und-white: #fff;
  --prairie-rose: #f5b6cd;
  --flame-orange: #ff671f;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  --sidebar-width: clamp(320px, 27vw, 460px);
  --header-height: auto;
  --grid-gap: 3px;
  --touch-min: 48px;
  --font-heading: "Oswald", "Arial", sans-serif;
  --font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Trocchi", Georgia, serif;
}

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

html {
  width: 100%;
  min-height: 100%;
  font-size: 16px;
}

body {
  width: 100%;
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--und-black);
  background: var(--und-white);
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: var(--und-green);
  color: var(--und-white);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 4px solid var(--und-green);
  background: var(--und-white);
}

.brand-lockup {
  display: flex;
  align-items: center;
}

.und-logo-link {
  display: block;
  line-height: 0;
}

.und-logo-link:focus-visible {
  outline: 3px solid var(--und-green);
  outline-offset: 4px;
  border-radius: 2px;
}

.und-logo {
  display: block;
  width: 20rem;
  height: auto;
  aspect-ratio: 365 / 46;
  object-fit: contain;
}

.page-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 2.5vw, 2.25rem);
  font-weight: 600;
  color: var(--und-green);
  text-align: right;
  line-height: 1.2;
}

/* Layout */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border-right: 1px solid var(--und-gray-light);
  background: var(--und-gray-light);
  overflow: hidden;
}

.sidebar-actions .button-group--sidebar {
  flex-direction: column;
  margin: 0;
  width: 100%;
  gap: 0.75rem;
}

.sidebar-actions .button-group--sidebar li {
  flex: none;
  margin: 0;
  width: 100%;
}

.sidebar-actions .button-group--sidebar .button {
  width: 100%;
  min-height: var(--touch-min);
}

.search-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--und-black);
}

.search-input,
.filter-select {
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--und-gray);
  border-radius: 4px;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--und-white);
}

.field-control {
  position: relative;
}

.field-control .search-input {
  padding-right: 3.25rem;
}

.field-control .filter-select {
  padding-right: 5rem;
}

.search-input::-webkit-search-cancel-button {
  appearance: none;
  -webkit-appearance: none;
}

.field-clear {
  position: absolute;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--und-green);
  cursor: pointer;
  transform: translateY(-50%);
}

.field-clear[hidden] {
  display: none;
}

.field-clear--search {
  right: 0.25rem;
}

.field-clear--select {
  right: 2rem;
}

.field-clear svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: square;
}

.field-clear:hover,
.field-clear:focus-visible {
  background: rgba(0, 154, 68, 0.12);
  color: var(--und-green);
}

.field-clear:focus-visible {
  outline: 3px solid var(--und-green);
  outline-offset: -3px;
}

.search-input:focus-visible,
.filter-select:focus-visible {
  outline: 3px solid var(--und-green);
  outline-offset: 2px;
  border-color: var(--und-green);
}

.results-count {
  margin: 0;
  font-size: 0.875rem;
  color: #555;
}

.square-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: var(--und-green) #d5dad7;
  flex: 1;
  min-height: 0;
  background:
    linear-gradient(to bottom, var(--und-gray-light) 35%, rgba(244, 244, 244, 0)) center top,
    linear-gradient(to top, var(--und-gray-light) 35%, rgba(244, 244, 244, 0)) center bottom,
    radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.28), transparent) center top,
    radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.28), transparent) center bottom;
  background-repeat: no-repeat;
  background-size: 100% 2rem, 100% 2rem, 100% 0.75rem, 100% 0.75rem;
  background-attachment: local, local, scroll, scroll;
}

.square-list::-webkit-scrollbar {
  width: 56px;
}

.square-list::-webkit-scrollbar-track {
  background: #d5dad7;
}

.square-list::-webkit-scrollbar-thumb {
  min-height: 4rem;
  border: 2px solid #d5dad7;
  border-radius: 0;
  background: var(--und-green);
}

.square-list::-webkit-scrollbar-thumb:hover,
.square-list::-webkit-scrollbar-thumb:active {
  background: var(--und-green);
}

.square-list-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.6rem;
  border: none;
  border-bottom: 1px solid #ddd;
  border-left: 4px solid transparent;
  border-radius: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  transition: background-color 0.15s ease, border-left-color 0.15s ease;
}

.square-list-item:hover {
  border-left-color: var(--und-green);
  background: rgba(0, 154, 68, 0.08);
}

.square-list-item:focus-visible {
  border-left-color: var(--und-green);
  background: rgba(0, 154, 68, 0.08);
  outline: 3px solid var(--und-green);
  outline-offset: -3px;
}

.square-list-item.is-selected {
  border-left-color: var(--und-green);
  background: rgba(0, 154, 68, 0.18);
}

.square-list-item img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 0;
  outline: 2px solid var(--und-green);
  outline-offset: 1px;
  flex-shrink: 0;
  background: #eee;
}

.square-list-item .item-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.square-list-item .item-title {
  font-weight: 700;
  color: var(--und-black);
  line-height: 1.25;
  overflow-wrap: anywhere;
  transition: color 0.15s ease;
}

.square-list-item:hover .item-title,
.square-list-item:focus-visible .item-title {
  color: var(--und-green);
}

.square-list-item .item-subtitle {
  font-size: 0.8rem;
  color: #555;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.empty-state {
  margin: 1rem 0;
  padding: 1rem;
  text-align: center;
  color: #555;
  font-style: italic;
}

.hidden {
  display: none !important;
}

/* Main quilt area */
.quilt-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  min-height: 0;
  padding: clamp(0.75rem, 1.5vw, 1.5rem);
  overflow: auto;
  overscroll-behavior: contain;
}

.quilt-instructions {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: #444;
  text-align: center;
  max-width: 48rem;
}

.quilt-frame {
  width: min(100%, 100%);
  max-width: calc(100dvh - 8rem);
  max-height: calc(100% - 3rem);
  aspect-ratio: 1;
  padding: clamp(0.75rem, 3vmin, 2.75rem);
  background-color: var(--und-green);
  background-image:
    linear-gradient(rgba(0, 154, 68, 0.06), rgba(0, 79, 42, 0.12)),
    url("../assets/images/textures/quilt-green-border.jpg");
  background-repeat: repeat;
  background-position: center;
  background-size: auto, 600px 90px;
  box-shadow:
    inset 0 0 0 1px rgba(0, 79, 42, 0.35),
    inset 0 0 12px rgba(0, 60, 32, 0.22),
    var(--shadow);
}

.quilt-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(12, 1fr);
  gap: var(--grid-gap);
  width: 100%;
  height: 100%;
  background: #ddd;
  padding: var(--grid-gap);
}

.quilt-grid::after {
  content: "";
  position: absolute;
  inset: var(--grid-gap);
  z-index: 2;
  background: rgba(0, 0, 0, 0.58);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
}

.quilt-grid.has-preview::after {
  opacity: 1;
}

.quilt-cell {
  position: relative;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: var(--und-white);
  cursor: pointer;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
  transform-origin: center;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}

.quilt-cell:focus-visible {
  outline: 3px solid var(--und-green);
  outline-offset: -3px;
  z-index: 2;
}

.quilt-cell.is-selected {
  box-shadow: inset 0 0 0 3px var(--flame-orange);
  z-index: 1;
}

.quilt-cell.is-previewed {
  outline: 4px solid var(--und-green);
  outline-offset: 3px;
  box-shadow:
    0 0 0 3px var(--und-white),
    0 10px 24px rgba(0, 0, 0, 0.45);
  transform: scale(1.35);
  z-index: 3;
}

.quilt-cell.is-centerpiece.is-previewed {
  transform: scale(1.1);
}

.quilt-cell.is-empty {
  background: repeating-linear-gradient(
    45deg,
    #ececec,
    #ececec 4px,
    #f8f8f8 4px,
    #f8f8f8 8px
  );
  cursor: default;
  pointer-events: none;
}

.quilt-cell.is-centerpiece {
  background: linear-gradient(
    145deg,
    var(--und-green) 0%,
    var(--und-green-dark-mid) 40%,
    var(--und-green) 70%,
    var(--und-green-dark-light) 100%
  );
}

.quilt-cell.is-centerpiece .cell-label {
  opacity: 0;
}

.quilt-cell.is-centerpiece:hover .cell-label,
.quilt-cell.is-centerpiece:focus-visible .cell-label,
.quilt-cell.is-centerpiece.is-selected .cell-label {
  opacity: 1;
  bottom: 0.5rem;
  left: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 3px;
  font-size: clamp(0.65rem, 1.2vw, 0.95rem);
  text-align: center;
  font-family: var(--font-heading);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quilt-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.quilt-cell.is-centerpiece img {
  object-fit: cover;
  object-position: center;
}

.quilt-cell .cell-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.15rem 0.25rem;
  background: rgba(0, 0, 0, 0.55);
  color: var(--und-white);
  font-size: clamp(0.45rem, 0.8vw, 0.65rem);
  line-height: 1.2;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.quilt-cell:not(.is-empty):hover .cell-label,
.quilt-cell:focus-visible .cell-label,
.quilt-cell.is-selected .cell-label {
  opacity: 1;
}

.quilt-cell.is-previewed .cell-label,
.quilt-cell.is-centerpiece.is-previewed .cell-label {
  opacity: 0;
}

.quilt-cell .missing-image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--und-gray-light);
  color: #666;
  font-size: 0.65rem;
  text-align: center;
  padding: 0.25rem;
}

/* Modals */
html.modal-open,
html.modal-open body {
  overflow: hidden;
}

html.modal-open .site-header,
html.modal-open .app-layout {
  overflow: hidden;
  touch-action: none;
  pointer-events: none;
}

.modal {
  border: 2px solid var(--und-white);
  padding: 0;
  max-width: min(960px, 92vw);
  max-height: calc(100dvh - 1.5rem);
  width: 100%;
  border-radius: 0;
  box-shadow: var(--shadow);
  background: var(--und-white);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 1.5rem);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-shrink: 0;
  min-height: 2.5rem;
  padding: 0.375rem 1rem;
  background: linear-gradient(
    135deg,
    var(--und-green) 0%,
    var(--und-green) 45%,
    var(--und-green) 100%
  );
  border-radius: 0;
}

.modal-title {
  margin: 0;
  padding: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  font-weight: 600;
  color: var(--und-white);
  letter-spacing: 0.03em;
  line-height: 1.15;
  display: flex;
  align-items: center;
  min-width: 0;
  overflow-wrap: anywhere;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  width: var(--touch-min);
  height: var(--touch-min);
  margin: 0;
  padding: 0 0 0.12em;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--und-white);
  font-family: Arial, sans-serif;
  font-size: 1.75rem;
  font-weight: 300;
  line-height: 0;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.15s;
}

.modal-close:hover,
.modal-close:focus-visible {
  opacity: 1;
}

.modal-close:focus-visible {
  outline: 3px solid var(--und-white);
  outline-offset: 2px;
  border-radius: 2px;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
}

.square-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  overflow: hidden;
}

.square-detail.has-no-image {
  grid-template-columns: minmax(0, 48rem);
  justify-content: center;
}

.square-detail-image-wrap {
  position: relative;
  display: grid;
  place-items: center;
  align-self: start;
  aspect-ratio: 1;
  margin: 0;
  min-height: 0;
  background: #f7f8f7;
  border: 1px solid #ddd;
}

.square-detail-image-wrap.is-loading::after {
  width: min(60%, 12rem);
  aspect-ratio: 1;
  content: "";
  grid-area: 1 / 1;
  z-index: 1;
  background: url("../assets/UND-flame-animated.gif") center / contain no-repeat;
}

.square-detail-image-wrap.is-loading.use-spinner::after {
  width: 2.75rem;
  height: 2.75rem;
  background: none;
  border: 0.35rem solid rgba(0, 103, 71, 0.2);
  border-top-color: var(--und-green);
  border-radius: 50%;
  animation: square-image-loading 0.8s linear infinite;
}

.square-detail-image-wrap img {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  max-height: 70dvh;
  object-fit: contain;
  border: 0;
  border-left: 4px solid var(--und-green);
  border-radius: 0;
}

@keyframes square-image-loading {
  to {
    transform: rotate(1turn);
  }
}

@media (prefers-reduced-motion: reduce) {
  .square-detail-image-wrap.is-loading.use-spinner::after {
    animation: none;
  }
}
.square-detail-text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  min-height: 0;
  padding-right: 0.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
}

.detail-section {
  padding: 1rem;
  border: 1px solid #cfd5d2;
  border-left: 4px solid var(--und-green);
  border-radius: 0;
  background: #f7f8f7;
}

.detail-section--meta {
  background: var(--und-white);
}

.detail-value,
.square-detail-text .detail-section p {
  margin: 0;
  color: #333;
  line-height: 1.5;
}

#square-modal-description p,
#square-modal-elements p {
  white-space: pre-line;
}

.square-detail-text h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--und-green);
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.draft-badge {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.35rem 0.65rem;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #664d03;
}

.president-detail {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
}

.president-byline,
.president-video-wrap {
  flex-shrink: 0;
}

.president-byline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  padding: 0.35rem 0.65rem;
  background: var(--und-gray-light);
  border-left: 3px solid var(--und-green);
  border-radius: 0 3px 3px 0;
}

.president-byline-primary {
  flex: 1;
  min-width: 0;
}

.president-byline-name {
  margin: 0 0 0.1rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--und-green);
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-align: left;
}

.president-byline-role {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-style: italic;
  color: #444;
  line-height: 1.25;
  text-align: left;
}

.president-byline-recorded {
  flex-shrink: 0;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: #777;
  text-align: right;
  line-height: 1.25;
}

.president-video-wrap {
  margin: 0;
}

.president-video-wrap video {
  display: block;
  width: 100%;
  max-height: min(40vh, 400px);
  background: var(--und-black);
  border-radius: 4px;
}

#president-video,
#president-video::-webkit-media-controls,
#president-video::-webkit-media-controls-enclosure,
#president-video::-webkit-media-controls-panel,
#president-video::-webkit-media-controls-play-button {
  cursor: pointer !important;
}

.president-transcript {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--und-gray-light);
}

.president-transcript-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  margin-bottom: 0.35rem;
}

.president-transcript-heading {
  margin: 0;
  flex-shrink: 0;
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--und-green);
}

.transcript-note {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-family: var(--font-serif);
  font-size: 0.8rem;
  font-style: italic;
  text-align: right;
  color: #555;
  line-height: 1.3;
}

.president-transcript-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.25rem;
}

.president-cues {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.transcript-cue {
  display: block;
  width: 100%;
  margin: 0;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--und-black);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.transcript-cue:hover,
.transcript-cue:focus-visible {
  background: rgba(0, 102, 44, 0.08);
  outline: none;
  border-color: rgba(0, 102, 44, 0.25);
}

.transcript-cue.is-active {
  background: var(--und-green);
  border-color: var(--und-green);
  color: var(--und-white);
}

.transcript-cue.is-active:hover,
.transcript-cue.is-active:focus-visible {
  background: var(--und-green-dark-mid);
  border-color: var(--und-green-dark-mid);
  color: var(--und-white);
}

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

.progress-modal {
  max-width: min(1180px, 96vw);
}

.progress-modal .modal-inner {
  max-height: calc(100dvh - 1.5rem);
}

.progress-modal-body {
  padding: 1rem 1.25rem 1.25rem;
}

.progress-intro {
  max-width: 64rem;
  margin: 0 0 0.9rem;
  color: #3f3f3f;
  line-height: 1.45;
}

.progress-phases {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.progress-phase-button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 3.35rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #c8cfcb;
  border-radius: 0;
  background: #f4f6f5;
  color: var(--und-green);
  font: 600 0.86rem/1.2 var(--font-heading);
  text-align: left;
  cursor: pointer;
}

.progress-phase-button:hover,
.progress-phase-button:focus-visible {
  border-color: var(--und-green);
  background: rgba(0, 153, 68, 0.08);
  outline: none;
}

.progress-phase-button.is-active {
  border-color: var(--und-green);
  background: var(--und-green);
  color: var(--und-white);
}

.progress-phase-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.65rem;
  width: 1.65rem;
  height: 1.65rem;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 0.8rem;
}

.progress-stage-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.progress-stage-date,
.progress-stage-title,
.progress-count,
.progress-stage-description {
  margin: 0;
}

.progress-stage-date {
  color: var(--und-green);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.progress-stage-title {
  margin-top: 0.1rem;
  color: var(--und-black);
  font-family: var(--font-heading);
  font-size: clamp(1.15rem, 2.3vw, 1.55rem);
}

.progress-count {
  flex-shrink: 0;
  color: #555;
  font-size: 0.85rem;
  font-weight: 600;
}

.progress-stage-description {
  margin-top: 0.35rem;
  color: #4c4c4c;
  font-size: 0.9rem;
  line-height: 1.4;
}

.progress-viewer {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) 3rem;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.progress-feature {
  display: grid;
  grid-template-rows: minmax(16rem, 48vh) auto;
  margin: 0;
  overflow: hidden;
  border-radius: 0;
  background: #111;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
}

.progress-feature img,
.progress-feature video {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: #111;
}

.progress-feature figcaption {
  min-height: 2.9rem;
  padding: 0.7rem 0.9rem;
  background: var(--und-white);
  color: #2f2f2f;
  font-size: 0.88rem;
  line-height: 1.35;
}

.progress-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 4rem;
  padding: 0 0 0.18em;
  border: 2px solid var(--und-green);
  border-radius: 0;
  background: var(--und-white);
  color: var(--und-green);
  font: 400 2.5rem/1 Arial, sans-serif;
  cursor: pointer;
}

.progress-nav:hover,
.progress-nav:focus-visible {
  background: var(--und-green);
  color: var(--und-white);
  outline: none;
}

.progress-nav:disabled {
  border-color: #aaa;
  color: #aaa;
  cursor: default;
}

.progress-thumbnails {
  display: flex;
  gap: 0.55rem;
  margin: 0.8rem 3.65rem 0;
  padding: 0.15rem 0.1rem 0.45rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
}

.progress-thumbnail {
  position: relative;
  flex: 0 0 5rem;
  width: 5rem;
  height: 3.75rem;
  padding: 0;
  overflow: hidden;
  border: 3px solid transparent;
  border-radius: 0;
  background: #222;
  cursor: pointer;
  scroll-snap-align: center;
}

.progress-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.progress-thumbnail:hover,
.progress-thumbnail:focus-visible,
.progress-thumbnail.is-active {
  border-color: var(--und-green);
  outline: none;
}

.progress-thumbnail.is-active {
  border-color: var(--und-green);
  outline: none;
  box-shadow: 0 0 0 2px var(--und-green);
}

.progress-thumbnail.is-active::after {
  content: "\2713  Selected";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0.18rem 0.2rem;
  background: var(--und-green);
  color: var(--und-white);
  font-family: Arial, sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.progress-video-thumbnail {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--und-white);
  font-size: 1.4rem;
}

/* Touch / large display */
@media (min-width: 901px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  .site-header,
  .sidebar-actions,
  .search-panel {
    flex-shrink: 0;
  }

  .app-layout {
    flex: 1;
    height: 0;
    min-height: 0;
  }

  .sidebar,
  .quilt-main {
    min-height: 0;
  }
}

@media (min-width: 901px) and (max-height: 900px) {
  .site-header {
    gap: 1rem;
    padding-block: 0.65rem;
  }

  .und-logo {
    width: clamp(15rem, 20vw, 20rem);
  }

  .sidebar {
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .sidebar-actions .button-group--sidebar {
    gap: 0.5rem;
  }

  .quilt-instructions {
    margin-bottom: 0.65rem;
  }

  .quilt-frame {
    max-width: calc(100dvh - 7.25rem);
  }
}

@media (min-width: 1920px) {
  html {
    font-size: 18px;
  }

  .quilt-frame {
    width: min(85vh, 1200px);
  }

  .square-list-item img {
    width: 64px;
    height: 64px;
  }
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    max-height: none;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--und-gray-light);
  }

  .square-list {
    flex: 0 1 auto;
    max-height: min(40vh, 24rem);
  }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-title {
    text-align: left;
  }

  .square-detail,
  .president-detail {
    grid-template-columns: 1fr;
  }

  .square-detail {
    overflow-y: auto;
  }

  .square-detail-text {
    min-height: auto;
    padding-right: 0;
    overflow: visible;
    scrollbar-gutter: auto;
  }

  .progress-phases {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .progress-viewer {
    grid-template-columns: 2.5rem minmax(0, 1fr) 2.5rem;
    gap: 0.4rem;
  }

  .progress-nav {
    width: 2.5rem;
  }

  .progress-thumbnails {
    margin-inline: 2.9rem;
  }
}

@media (max-width: 560px) {
  .progress-phases {
    grid-template-columns: 1fr;
  }

  .progress-feature {
    grid-template-rows: minmax(12rem, 40vh) auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }

  .button::before,
  .button::after {
    transition: none !important;
  }

  .button:hover::before,
  .button:hover::after,
  .button:focus::before,
  .button:focus::after,
  .button:focus-visible::before,
  .button:focus-visible::after {
    width: 140%;
  }
}

/* Development-only tile image loader controls */
.dev-mode-modal {
  max-width: min(34rem, 92vw);
}

.dev-mode-body {
  display: grid;
  gap: 1rem;
}

.dev-mode-body p {
  margin: 0;
  line-height: 1.5;
}

.dev-mode-toggle,
.dev-mode-delay {
  display: grid;
  gap: 0.5rem;
  color: var(--und-black);
  font-weight: 600;
}

.dev-mode-toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.dev-mode-toggle input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--und-green);
}

.dev-mode-delay input {
  width: min(100%, 14rem);
  min-height: var(--touch-min);
  box-sizing: border-box;
  border: 2px solid var(--und-green);
  border-radius: 0;
  padding: 0.5rem 0.75rem;
  font: inherit;
}

.dev-mode-delay input:disabled {
  border-color: var(--und-gray);
  background: var(--und-gray-light);
  color: #555;
}

.dev-mode-note {
  color: #555;
  font-size: 0.9rem;
}