@font-face {
  font-family: "ABCMarfa";
  src: url("assets/ABCMarfa-Regular-Trial.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "ABCMarfa";
  src: url("assets/ABCMarfa-Medium-Trial.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: "ABCMarfa";
  src: url("assets/ABCMarfa-Bold-Trial.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: "ABCMarfa";
  src: url("assets/ABCMarfa-Light-Trial.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
}

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: rgba(0, 0, 0, 0.03);
  --surface-soft-hover: rgba(0, 0, 0, 0.05);
  --text: #111111;
  --muted: #6f6f6f;
  --line: #8f8f8f;
  --border: #d0d0d0;
  --border-soft: #e0e0e0;
  --button-bg: #d2d2d2;
  --button-bg-secondary: #cfcfcf;
  --meta: #6d877a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.dropdown-actions {
  margin-top: 24px;
  padding-top: 10px;
}

body.dark-mode {
  --bg: #111111;
  --surface: #111111;
  --surface-soft: rgba(255, 255, 255, 0.06);
  --surface-soft-hover: rgba(255, 255, 255, 0.1);
  --text: #f2f2f2;
  --muted: #b5b5b5;
  --line: #6b6b6b;
  --border: #5a5a5a;
  --border-soft: #444444;
  --button-bg: #2a2a2a;
  --button-bg-secondary: #222222;
  --meta: #9bb5a8;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "ABCMarfa", Arial, sans-serif;
}

h1,
h2,
.result-name,
.directory-name {
  font-weight: 500;
}

.nav-link,
.subhead,
.results-label,
.results-count,
.result-date,
.directory-meta,
.about-copy,
button,
input {
  font-weight: 400;
}

body {
  min-height: 100vh;
  padding: 0;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.page {
  position: relative;
  width: min(100%, 1600px);
  margin: 0 auto;
  padding: 8px 34px 44px;
}

.theme-toggle {
  position: absolute;
  top: 12px;
  right: 34px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  z-index: 100;
}

.theme-toggle:hover {
  opacity: 0.65;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  margin-bottom: 0;
  padding-top: 5px;
  padding-right: 44px;
}

.nav-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
}

.nav-link.active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 36px;
  padding-top: 100px;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(34px, 5vw, 44px);
  font-weight: 400;
  line-height: 1.04;
  text-transform: uppercase;
}

.hero-reset {
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.hero-reset:hover {
  opacity: 0.72;
}

.hero-reset:active {
  transform: scale(0.995);
}

h2 {
  margin: 0 0 10px;
  font-size: clamp(24px, 2vw, 32px);
  font-weight: 400;
}

.subhead {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.search-module {
  width: min(100%, 980px);
  margin: 0 auto 24px;
  position: relative;
  padding-bottom: 0;
}

.search-module.has-autocomplete {
  padding-bottom: 320px;
}

.searchbar-wrap {
  width: 100%;
  min-height: 58px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}

.search-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

#searchInput {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 18px;
  color: var(--text);
}

#searchInput::placeholder,
#directoryFilter::placeholder {
  color: #606060;
  font-size: 18px;
}

.autocomplete {
  position: absolute;
  left: 0;
  right: 0;
  top: 58px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 28px;
  padding: 12px 20px 40px;
  z-index: 50;
  box-shadow: var(--shadow);
}

.autocomplete.hidden {
  display: none;
}

.autocomplete-item {
  border-bottom: 1px solid var(--line);
  padding: 14px 6px;
  cursor: pointer;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-name {
  font-size: 18px;
  margin-bottom: 4px;
}

.autocomplete-meta {
  font-size: 14px;
  color: var(--meta);
}

.search-actions {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 46px;
  flex-wrap: wrap;
}

.action-btn {
  border: none;
  background: var(--button-bg-secondary);
  color: var(--text);
  padding: 14px 22px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.action-btn:hover {
  transform: translateY(-1px);
}

.action-btn.primary {
  background: var(--button-bg);
}

.results-section {
  max-width: 920px;
  margin: 52px auto 0;
}

.results-section.hidden {
  display: none;
}

.results-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.results-header > div {
  min-width: 0;
}

.results-label {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

.results-count {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

#resultsTitle {
  font-size: 22px;
  line-height: 1.15;
  font-weight: 400;
  margin: 0;
  max-width: 100%;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 18px 18px;
  padding: 18px;
}

.result-card:hover {
  transform: translateY(-2px);
  background: var(--surface-soft-hover);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.result-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.result-name {
  font-size: 18px;
  max-width: 100%;
}

.result-date {
  color: var(--muted);
  font-size: 14px;
}

.result-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.meta-pill {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  max-width: 100%;
}

.result-title {
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
}

.empty-state {
  padding: 36px 4px;
  color: var(--muted);
}

.section-header {
  margin-bottom: 24px;
  padding-top: 40px;
}

.directory-tools {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.directory-search-wrap {
  width: min(100%, 520px);
  min-height: 58px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
}

.directory-search-wrap .search-icon {
  font-size: 22px;
  flex-shrink: 0;
}

#directoryFilter {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text);
  font-size: 16px;
  padding: 0;
}

.directory-count {
  color: var(--muted);
  margin: 0;
}

.directory-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.directory-item {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.directory-item:hover {
  transform: translateY(-1px);
  background: var(--surface-soft-hover);
}

.directory-name {
  font-size: 17px;
  margin-bottom: 6px;
}

.directory-meta {
  color: var(--meta);
  font-size: 14px;
}

.about-copy {
  max-width: 700px;
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
}

.hidden {
  display: none;
}

.connect-state {
  text-align: left;
}

.empty-title {
  font-size: 26px;
  color: var(--text);
  margin: 0 0 10px;
}

.empty-sub {
  margin: 0 0 22px;
  font-size: 16px;
}

.connect-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.connect-links a {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 999px;
  transition: all 0.15s ease;
}

.connect-links a:hover {
  background: var(--surface-soft-hover);
  transform: translateY(-1px);
}

/* Large laptop / smaller desktop */
@media (max-width: 1200px) {
  .page {
    padding-left: 28px;
    padding-right: 28px;
  }

  .hero {
    max-width: 720px;
  }

  .search-module {
    width: min(100%, 900px);
  }
}

/* Tablet */
@media (max-width: 900px) {
  .page {
    padding: 0 20px 34px;
  }

  .theme-toggle {
    right: 20px;
    top: 10px;
    font-size: 24px;
  }

  .top-nav {
    gap: 18px;
    padding-right: 36px;
  }

  .hero {
    padding-top: 42px;
    max-width: 680px;
  }

  h1 {
    font-size: clamp(30px, 6vw, 52px);
  }

  .subhead {
    font-size: 15px;
  }

  .search-module {
    width: 100%;
  }

  .search-module.has-autocomplete {
    padding-bottom: 280px;
  }

  .results-section {
    margin-top: 42px;
  }

  .directory-list {
    grid-template-columns: 1fr;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .page {
    padding: 0 14px 28px;
  }

  .theme-toggle {
    top: 10px;
    right: 14px;
    font-size: 22px;
  }

  .top-nav {
    gap: 14px;
    padding-top: 14px;
    padding-left: 20px;
    margin-bottom: 10px;
    width:100%;
  }

  .nav-link {
    font-size: 14px;
  }

  .hero {
    padding-top: 54px;
    margin-bottom: 22px;
    max-width:350px;
  }

  h1 {
    font-size: clamp(46px, 9vw, 60px);
    line-height: 1.02;
    margin-bottom: 10px;
    max-width:350px;
  }

  h2 {
    font-size: 24px;
    max-width:300px;
  }

  .subhead {
    font-size: 14px;
    line-height: 1.45;
    max-width:300px;
    align-self: center;
    margin-left:20px;
  }

  .search-module {
    width: 88%;
    padding-bottom: 0;
  }

  .searchbar-wrap,
  .directory-search-wrap {
    min-height: 54px;
    padding: 0 16px;
    gap: 10px;
    max-width:350px;
  }

  .search-icon {
    font-size: 18px;
  }

  #searchInput,
  #directoryFilter {
    font-size: 16px;
  }

  #searchInput::placeholder,
  #directoryFilter::placeholder {
    font-size: 16px;
  }

  .search-actions {
    margin-top: 24px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .action-btn {
    width: 60%;
    padding: 14px 18px;
    align-self: center;
  }

  .autocomplete {
    top: 54px;
    border-radius: 22px;
    padding: 10px 14px 24px;
  }

  .search-module.has-autocomplete {
    padding-bottom: 300px;
  }

  .autocomplete-name {
    font-size: 16px;
  }

  .autocomplete-meta {
    font-size: 13px;
  }

  .results-section {
    margin-top: 36px;
    padding: 10px 24px 24px;
  }

  .results-header {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
  }

  .results-label {
    font-size: 11px;
  }

  #resultsTitle {
    font-size: 18px;
    line-height: 1.15;
  }

  .results-count {
    font-size: 13px;
  }

  .result-card {
    padding: 14px;
    border-radius: 0 0 14px 14px;
  }

  .result-top {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
  }

  .result-name {
    font-size: 16px;
    line-height: 1.2;
  }

  .result-date {
    font-size: 13px;
  }

  .result-meta {
    gap: 8px;
  }

  .meta-pill {
    font-size: 11px;
    padding: 5px 8px;
  }

  .section-header {
    padding-top: 24px;
    margin-bottom: 18px;
    max-width:350px;
  }

  .directory-tools {
    gap: 12px;
    margin-bottom: 18px;
  }

  .directory-count {
    font-size: 14px;
  }

  .directory-item {
    padding: 14px 16px;
  }

  .directory-name {
    font-size: 16px;
  }

  .directory-meta {
    font-size: 13px;
  }

  .about-copy {
    font-size: 15px;
    line-height: 1.6;
  }

  .empty-title {
    font-size: 22px;
  }

  .empty-sub {
    font-size: 15px;
  }

  .connect-links {
    gap: 10px;
  }

  .connect-links a {
    width: 100%;
    text-align: center;
  }
}

/* Very small phones */
@media (max-width: 400px) {
  .page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .top-nav {
    gap: 12px;
  }

  .nav-link {
    font-size: 13px;
  }

  h1 {
    font-size: 24px;
  }

  .subhead {
    font-size: 13px;
  }

  #resultsTitle {
    font-size: 17px;
  }

  .result-name,
  .directory-name {
    font-size: 15px;
  }
}