:root {
  --bg: #090b10;
  --panel: #10141c;
  --panel-2: #131822;
  --panel-3: #171d28;

  --border: #202734;
  --border-strong: #313a4a;

  --text: #f5f7fa;
  --soft: #c5cbd6;
  --muted: #8791a2;
  --dim: #5c6676;

  --white: #f4f6f8;
  --black: #090b10;

  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 17px;

  --content-width: 1480px;
}


/* ==========================================================
   RESET
   ========================================================== */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;

  overflow-x: hidden;

  background: var(--bg);
  color: var(--text);

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
input,
.technology-card {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--soft);
  outline-offset: 2px;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.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;
}


/* ==========================================================
   HEADER
   ========================================================== */

.topbar {
  position: sticky;
  top: 0;

  z-index: 100;

  width: 100%;
  height: 64px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding-left:
    max(16px, env(safe-area-inset-left));

  padding-right:
    max(16px, env(safe-area-inset-right));

  background: rgba(9, 11, 16, 0.94);

  border-bottom: 1px solid var(--border);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: var(--text);

  text-decoration: none;

  font-size: 17px;
  font-weight: 850;

  letter-spacing: 0.23em;

  padding-left: 0.23em;
}


/* ==========================================================
   PAGE
   ========================================================== */

.shell {
  width: 100%;
  max-width: var(--content-width);

  margin: 0 auto;

  padding:
    20px
    max(16px, env(safe-area-inset-right))
    80px
    max(16px, env(safe-area-inset-left));
}

.section-label {
  display: block;

  color: var(--muted);

  font-size: 10px;
  font-weight: 800;

  letter-spacing: 0.14em;
}


/* ==========================================================
   PROGRESS
   ========================================================== */

.progress-panel {
  width: 100%;

  display: grid;
  gap: 18px;

  margin-bottom: 18px;

  padding: 18px;

  background: var(--panel);

  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.progress-primary {
  min-width: 0;
}

.progress-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 16px;
}

.progress-title-row strong {
  flex: 0 0 auto;

  font-size: 19px;
  letter-spacing: -0.02em;
}

.progress-track {
  position: relative;

  width: 100%;
  height: 9px;

  margin-top: 15px;

  overflow: hidden;

  background: #1a202b;

  border-radius: 999px;
}

.progress-fill {
  width: 0;
  height: 100%;

  background: var(--white);

  border-radius: inherit;

  transition: width 180ms ease;
}

.progress-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 8px;
}

.metric-button {
  min-width: 0;

  padding: 12px 10px;

  background: var(--panel-2);

  border: 1px solid var(--border);
  border-radius: 11px;

  text-align: left;

  cursor: pointer;
}

.metric-button:hover {
  background: var(--panel-3);

  border-color: var(--border-strong);
}

.metric-value {
  display: block;

  overflow: hidden;

  color: var(--text);

  font-size: 19px;
  font-weight: 750;

  text-overflow: ellipsis;
}

.metric-label {
  display: block;

  margin-top: 2px;

  color: var(--muted);

  font-size: 10px;
  font-weight: 700;

  letter-spacing: 0.06em;

  text-transform: uppercase;
}


/* ==========================================================
   SEARCH
   ========================================================== */

.control-panel {
  position: relative;

  width: 100%;

  margin-bottom: 32px;
}

.search-row {
  position: relative;

  width: 100%;

  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px;

  gap: 8px;
}

.search-shell {
  position: relative;

  min-width: 0;
}

.search-icon {
  position: absolute;

  left: 15px;
  top: 50%;

  width: 18px;
  height: 18px;

  transform: translateY(-50%);

  fill: none;

  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;

  pointer-events: none;
}

#search {
  width: 100%;
  height: 50px;

  min-width: 0;

  padding:
    0
    44px
    0
    44px;

  background: var(--panel);

  color: var(--text);

  border: 1px solid var(--border-strong);
  border-radius: 12px;

  outline: none;
}

#search:hover,
#search:focus {
  border-color: #4b5668;
}

#search::placeholder {
  color: var(--dim);
}

.clear-search {
  position: absolute;

  right: 8px;
  top: 50%;

  width: 32px;
  height: 32px;

  transform: translateY(-50%);

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  background: transparent;

  color: var(--muted);

  border: 0;
  border-radius: 8px;

  cursor: pointer;

  font-size: 20px;
}

.clear-search:hover {
  background: var(--panel-3);

  color: var(--text);
}


/* ==========================================================
   FILTER BUTTON
   ========================================================== */

.filter-shell {
  position: relative;

  min-width: 0;
}

.filter-toggle {
  position: relative;

  width: 50px;
  height: 50px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  background: var(--panel);

  color: var(--muted);

  border: 1px solid var(--border-strong);
  border-radius: 12px;

  cursor: pointer;
}

.filter-toggle:hover,
.filter-toggle[aria-expanded="true"],
.filter-toggle.active {
  background: var(--panel-2);

  color: var(--text);

  border-color: #4b5668;
}

.filter-toggle svg {
  width: 21px;
  height: 21px;

  fill: none;

  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.filter-count {
  position: absolute;

  top: -6px;
  right: -6px;

  min-width: 19px;
  height: 19px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0 5px;

  background: var(--white);

  color: var(--black);

  border: 2px solid var(--bg);
  border-radius: 999px;

  font-size: 9px;
  font-weight: 800;
}


/* ==========================================================
   FILTER POPOVER
   ========================================================== */

.filter-panel {
  position: absolute;

  z-index: 200;

  top: calc(100% + 9px);
  right: 0;

  width: min(560px, calc(100vw - 32px));

  max-height: min(
    680px,
    calc(100dvh - 100px)
  );

  overflow-x: hidden;
  overflow-y: auto;

  background: #0d1118;

  border: 1px solid var(--border-strong);
  border-radius: 15px;

  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.45);
}

.filter-panel-header {
  position: sticky;
  top: 0;

  z-index: 2;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  padding: 17px 18px;

  background: rgba(13, 17, 24, 0.97);

  border-bottom: 1px solid var(--border);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.filter-panel-header strong {
  display: block;

  margin-top: 4px;

  font-size: 16px;
}

.filter-reset {
  flex: 0 0 auto;

  padding: 7px 10px;

  background: transparent;

  color: var(--muted);

  border: 1px solid var(--border);
  border-radius: 8px;

  cursor: pointer;
}

.filter-reset:hover {
  color: var(--text);

  border-color: var(--border-strong);
}

.filter-panel-body {
  padding: 4px 18px 18px;
}

.filter-group {
  padding: 17px 0;

  border-bottom: 1px solid var(--border);
}

.filter-group:last-child {
  border-bottom: 0;
}

.filter-heading {
  display: block;

  margin-bottom: 10px;

  color: var(--muted);

  font-size: 9px;
  font-weight: 800;

  letter-spacing: 0.13em;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;

  gap: 7px;
}

.filter-chip {
  flex: 0 0 auto;

  min-height: 35px;

  padding: 7px 12px;

  background: var(--panel);

  color: var(--muted);

  border: 1px solid var(--border);
  border-radius: 999px;

  cursor: pointer;

  white-space: nowrap;
}

.filter-chip:hover {
  background: var(--panel-2);

  color: var(--text);

  border-color: var(--border-strong);
}

.filter-chip.active {
  background: var(--white);

  color: var(--black);

  border-color: var(--white);
}

.filter-panel-footer {
  position: sticky;
  bottom: 0;

  padding: 12px 18px 17px;

  background: rgba(13, 17, 24, 0.97);

  border-top: 1px solid var(--border);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.filter-done {
  width: 100%;
  min-height: 42px;

  background: var(--white);

  color: var(--black);

  border: 1px solid var(--white);
  border-radius: 9px;

  font-weight: 700;

  cursor: pointer;
}


/* ==========================================================
   LIBRARY
   ========================================================== */

.library {
  width: 100%;
  min-width: 0;
}

.library-header {
  width: 100%;

  display: flex;
  align-items: end;
  justify-content: space-between;

  gap: 20px;

  margin-bottom: 14px;
}

.library-header h1 {
  margin: 5px 0 0;

  font-size: 20px;
  letter-spacing: -0.02em;
}

#result-count {
  flex: 0 0 auto;

  color: var(--muted);

  font-size: 11px;
}


/* ==========================================================
   TILE GRID
   ========================================================== */

.technology-grid {
  width: 100%;
  min-width: 0;

  display: grid;

  grid-template-columns:
    repeat(
      auto-fill,
      minmax(
        min(100%, 260px),
        1fr
      )
    );

  gap: 10px;
}


/* ==========================================================
   TECHNOLOGY CARD
   ========================================================== */

.technology-card {
  position: relative;

  width: 100%;
  min-width: 0;
  min-height: 190px;

  display: flex;
  flex-direction: column;

  padding: 16px;

  appearance: none;

  overflow: hidden;

  background: var(--panel);

  color: var(--text);

  border: 1px solid var(--border);
  border-radius: var(--radius);

  text-align: left;

  cursor: pointer;

  transition:
    border-color 130ms ease,
    background 130ms ease,
    transform 130ms ease;
}

.technology-card:hover {
  background: var(--panel-2);

  border-color: var(--border-strong);

  transform: translateY(-1px);
}

.technology-card.read {
  border-color: #3b4658;
}

.card-top {
  width: 100%;

  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 12px;
}

.card-category {
  min-width: 0;

  overflow: hidden;

  color: var(--muted);

  font-size: 9px;
  font-weight: 800;

  letter-spacing: 0.13em;

  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.read-indicator {
  width: 23px;
  height: 23px;

  flex: 0 0 23px;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--muted);

  border: 1px solid var(--border);
  border-radius: 50%;

  font-size: 10px;
}

.technology-card.read .read-indicator {
  background: var(--white);

  color: var(--black);

  border-color: var(--white);
}

.card-title {
  margin: 14px 0 0;

  overflow-wrap: anywhere;

  font-size: 18px;
  font-weight: 760;

  letter-spacing: -0.02em;
}

.card-summary {
  margin: 8px 0 18px;

  overflow-wrap: anywhere;

  color: var(--soft);

  font-size: 13px;
  line-height: 1.55;
}

.card-footer {
  width: 100%;

  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  gap: 10px;

  margin-top: auto;
}

.card-tags {
  min-width: 0;

  display: flex;
  flex-wrap: wrap;

  gap: 5px;
}

.mini-tag,
.badge {
  display: inline-flex;
  align-items: center;

  max-width: 100%;

  padding: 4px 7px;

  overflow: hidden;

  background: #0b0e13;

  color: var(--muted);

  border: 1px solid var(--border);
  border-radius: 999px;

  font-size: 9px;

  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}


/* ==========================================================
   SVG SPEAKER
   ========================================================== */

.card-speaker {
  width: 30px;
  height: 30px;

  flex: 0 0 30px;

  display: flex;
  align-items: center;
  justify-content: center;

  color: var(--muted);
}

.card-speaker svg {
  width: 18px;
  height: 18px;

  fill: none;

  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* ==========================================================
   EMPTY STATE
   ========================================================== */

.empty-state {
  padding: 60px 20px;

  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);

  text-align: center;
}

.empty-state strong {
  display: block;

  font-size: 18px;
}

.empty-state p {
  margin: 7px 0 18px;

  color: var(--muted);
}


/* ==========================================================
   BUTTONS
   ========================================================== */

.primary-button,
.secondary-button {
  min-height: 41px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  gap: 8px;

  padding: 8px 14px;

  border-radius: 9px;

  cursor: pointer;
}

.primary-button {
  background: var(--white);

  color: var(--black);

  border: 1px solid var(--white);
}

.secondary-button {
  background: transparent;

  color: var(--text);

  border: 1px solid var(--border-strong);
}

.primary-button svg,
.secondary-button svg {
  width: 17px;
  height: 17px;

  fill: none;

  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* ==========================================================
   DETAIL DIALOG
   ========================================================== */

.technology-dialog {
  width: min(900px, calc(100vw - 16px));

  max-width: 900px;

  max-height: calc(100dvh - 16px);

  margin: auto;
  padding: 0;

  overflow-x: hidden;
  overflow-y: auto;

  background: var(--bg);

  color: var(--text);

  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}

.technology-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);

  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.dialog-shell {
  width: 100%;

  padding:
    20px
    max(18px, env(safe-area-inset-right))
    32px
    max(18px, env(safe-area-inset-left));
}

.dialog-header {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    auto;

  gap: 18px;
}

.dialog-heading {
  min-width: 0;
}

.dialog-header h2 {
  margin: 13px 0 0;

  overflow-wrap: anywhere;

  font-size: clamp(29px, 7vw, 48px);

  letter-spacing: -0.04em;
}

.dialog-summary {
  max-width: 720px;

  margin: 13px 0 0;

  color: var(--soft);

  font-size: 14px;
  line-height: 1.65;
}

.badges {
  display: flex;
  flex-wrap: wrap;

  gap: 6px;
}

.close-button {
  width: 38px;
  height: 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  background: transparent;

  color: var(--muted);

  border: 1px solid var(--border);
  border-radius: 10px;

  cursor: pointer;

  font-size: 21px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;

  gap: 8px;

  margin-top: 23px;
  padding-bottom: 23px;

  border-bottom: 1px solid var(--border);
}

.dialog-sections {
  display: grid;
}

.knowledge-section {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    auto;

  gap: 18px;

  padding: 22px 0;

  border-bottom: 1px solid var(--border);
}

.knowledge-section h3 {
  margin: 0 0 7px;

  font-size: 13px;
}

.knowledge-section p {
  margin: 0;

  overflow-wrap: anywhere;

  color: var(--soft);

  font-size: 14px;
  line-height: 1.7;
}

.speaker-button {
  width: 38px;
  height: 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  background: var(--panel);

  color: var(--muted);

  border: 1px solid var(--border);
  border-radius: 9px;

  cursor: pointer;
}

.speaker-button:hover {
  background: var(--panel-2);

  color: var(--text);

  border-color: var(--border-strong);
}

.speaker-button svg {
  width: 18px;
  height: 18px;

  fill: none;

  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* ==========================================================
   RELATIONSHIPS
   ========================================================== */

.relationship-section {
  padding-top: 26px;
}

.relationship-group {
  margin-top: 17px;
}

.relationship-label {
  margin: 0 0 8px;

  color: var(--muted);

  font-size: 9px;
  font-weight: 800;

  letter-spacing: 0.1em;

  text-transform: uppercase;
}

.relationship-links {
  display: flex;
  flex-wrap: wrap;

  gap: 7px;
}

.relationship-link {
  max-width: 100%;

  padding: 7px 10px;

  overflow: hidden;

  background: var(--panel);

  color: var(--soft);

  border: 1px solid var(--border);
  border-radius: 999px;

  cursor: pointer;

  text-overflow: ellipsis;
  white-space: nowrap;
}

.relationship-link:hover {
  background: var(--panel-2);

  color: var(--text);

  border-color: var(--border-strong);
}


/* ==========================================================
   NEXT
   ========================================================== */

.next-section {
  margin-top: 28px;

  padding: 18px;

  background: var(--panel);

  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.next-card {
  width: 100%;

  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    auto;

  gap: 18px;

  margin-top: 12px;
  padding: 0;

  background: transparent;

  color: inherit;

  border: 0;

  text-align: left;

  cursor: pointer;
}

.next-card strong {
  display: block;

  margin-bottom: 5px;

  overflow-wrap: anywhere;

  font-size: 17px;
}

.next-card span span {
  display: block;

  overflow-wrap: anywhere;

  color: var(--muted);

  font-size: 13px;
  line-height: 1.5;
}

.next-arrow {
  align-self: center;

  color: var(--muted);

  font-size: 22px;
}


/* ==========================================================
   TABLET
   ========================================================== */

@media (min-width: 700px) {

  .shell {
    padding-top: 28px;
  }

  .progress-panel {
    grid-template-columns:
      minmax(0, 1fr)
      330px;

    align-items: center;

    gap: 30px;

    padding: 20px 22px;
  }

  .search-row {
    grid-template-columns:
      minmax(0, 1fr)
      52px;
  }

  #search,
  .filter-toggle {
    height: 52px;
  }

  .filter-toggle {
    width: 52px;
  }

  .filter-panel {
    width: 580px;
  }

}


/* ==========================================================
   LARGE DESKTOP
   ========================================================== */

@media (min-width: 1200px) {

  .shell {
    padding-top: 32px;
  }

  .progress-panel {
    padding: 22px 24px;
  }

}


/* ==========================================================
   SMALL MOBILE
   ========================================================== */

@media (max-width: 520px) {

  .shell {
    padding-top: 16px;
  }

  .progress-panel {
    border-radius: 14px;
  }

  .progress-metrics {
    gap: 6px;
  }

  .metric-button {
    padding: 11px 9px;
  }

  .metric-value {
    font-size: 18px;
  }

  .control-panel {
    margin-bottom: 26px;
  }

  .filter-panel {
    position: fixed;

    top: 76px;
    left: 12px;
    right: 12px;

    width: auto;

    max-height:
      calc(
        100dvh
        - 88px
        - env(safe-area-inset-bottom)
      );
  }

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

    gap: 8px;
  }

  .technology-card {
    min-height: 180px;

    padding: 14px;
  }

  .card-title {
    font-size: 16px;
  }

  .card-summary {
    font-size: 12px;
  }

}


/* ==========================================================
   VERY SMALL MOBILE
   ========================================================== */

@media (max-width: 390px) {

  .technology-grid {
    grid-template-columns: 1fr;
  }

}


/* ==========================================================
   WIDE DESKTOP
   ========================================================== */

@media (min-width: 1500px) {

  .technology-grid {
    grid-template-columns:
      repeat(5, minmax(0, 1fr));
  }

}
