/* Bilkent Honor List — single search page. Theme-aware, responsive, no build. */

:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --ink: #18181b;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #8a1c2b;          /* Bilkent maroon */
  --accent-ink: #ffffff;
  --high: #b45309;            /* High Honor — amber */
  --high-bg: #fef3c7;
  --high-ink: #7c2d12;
  --honor: #1d4ed8;           /* Honor — blue */
  --honor-bg: #dbeafe;
  --honor-ink: #1e3a8a;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1012;
    --surface: #17181b;
    --surface-2: #1d1e22;
    --ink: #ededef;
    --muted: #9ca3af;
    --border: #2a2b30;
    --accent: #e0566a;
    --accent-ink: #1a0508;
    --high: #fbbf24;
    --high-bg: #3a2a08;
    --high-ink: #fde68a;
    --honor: #60a5fa;
    --honor-bg: #14233f;
    --honor-ink: #bfdbfe;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
  }
}

/* Explicit toggle wins over the OS preference, both directions. */
:root[data-theme="light"] {
  --bg: #f6f6f7; --surface: #fff; --surface-2: #fafafa; --ink: #18181b;
  --muted: #6b7280; --border: #e5e7eb; --accent: #8a1c2b; --accent-ink: #fff;
  --high: #b45309; --high-bg: #fef3c7; --high-ink: #7c2d12;
  --honor: #1d4ed8; --honor-bg: #dbeafe; --honor-ink: #1e3a8a;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}
:root[data-theme="dark"] {
  --bg: #0f1012; --surface: #17181b; --surface-2: #1d1e22; --ink: #ededef;
  --muted: #9ca3af; --border: #2a2b30; --accent: #e0566a; --accent-ink: #1a0508;
  --high: #fbbf24; --high-bg: #3a2a08; --high-ink: #fde68a;
  --honor: #60a5fa; --honor-bg: #14233f; --honor-ink: #bfdbfe;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.wrap { max-width: 780px; margin: 0 auto; padding: 0 1rem; }

/* --- Header --------------------------------------------------------------- */
header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem 0;
}
.brand { display: flex; align-items: baseline; gap: .5rem; margin-right: auto; }
.brand h1 { font-size: 1.15rem; margin: 0; letter-spacing: -.01em; }
.brand .dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 .7rem; gap: .4rem;
  font-size: .85rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; cursor: pointer; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--muted); }

/* --- Search --------------------------------------------------------------- */
.hero { padding: 2.2rem 0 1rem; }
.hero p.sub { color: var(--muted); margin: .3rem 0 1.3rem; }

form.search { display: flex; gap: .5rem; }
.search-field { position: relative; flex: 1; }
.search-field svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
input[type="search"] {
  width: 100%; padding: .8rem .9rem .8rem 2.4rem; font-size: 1rem;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
button.go {
  padding: 0 1.3rem; font-size: 1rem; font-weight: 600;
  color: var(--accent-ink); background: var(--accent);
  border: 0; border-radius: 10px; cursor: pointer; transition: filter .15s;
}
button.go:hover { filter: brightness(1.07); }
button.go:disabled { opacity: .6; cursor: default; }

.legend { display: flex; gap: 1.1rem; margin: .9rem 0 0; color: var(--muted); font-size: .85rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.swatch { width: .7rem; height: .7rem; border-radius: 3px; }
.swatch.high { background: var(--high); }
.swatch.honor { background: var(--honor); }

/* --- Status + results ----------------------------------------------------- */
.status { color: var(--muted); font-size: .9rem; margin: 1.4rem 0 .4rem; min-height: 1.2em; }
.status.error { color: var(--accent); }

.results { display: flex; flex-direction: column; gap: .8rem; padding-bottom: 1rem; }

.group {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow);
}
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.group h2 { font-size: 1.06rem; margin: 0; letter-spacing: -.01em; }
.group .count { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.group .dept { color: var(--muted); font-size: .88rem; margin: .1rem 0 .75rem; }

.timeline { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-variant-numeric: tabular-nums;
  padding: .25rem .6rem; border-radius: 999px; border: 1px solid transparent;
}
.chip.high_honor { background: var(--high-bg); color: var(--high-ink); border-color: color-mix(in srgb, var(--high) 35%, transparent); }
.chip.honor { background: var(--honor-bg); color: var(--honor-ink); border-color: color-mix(in srgb, var(--honor) 35%, transparent); }
.chip .tier { width: .5rem; height: .5rem; border-radius: 50%; }
.chip.high_honor .tier { background: var(--high); }
.chip.honor .tier { background: var(--honor); }

.empty, .hint { color: var(--muted); }
.skeleton { height: 92px; border-radius: var(--radius); background:
  linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border: 1px solid var(--border); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* --- Footer + dialog ------------------------------------------------------ */
footer { margin-top: 2rem; border-top: 1px solid var(--border); }
.footer-inner { padding: 1.3rem 0 2.5rem; color: var(--muted); font-size: .84rem; }
.footer-inner p { margin: .4rem 0; }
.footer-inner button.link {
  background: none; border: 0; padding: 0; color: var(--accent);
  cursor: pointer; font: inherit; text-decoration: underline;
}

dialog {
  width: min(560px, 92vw); border: 1px solid var(--border); border-radius: 14px;
  padding: 0; color: var(--ink); background: var(--surface); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.dialog-body { padding: 1.4rem 1.5rem; }
.dialog-body h2 { margin: 0 0 .6rem; font-size: 1.2rem; }
.dialog-body h3 { margin: 1.1rem 0 .3rem; font-size: .95rem; }
.dialog-body p { margin: .4rem 0; font-size: .9rem; color: var(--muted); }
.dialog-body .close {
  float: right; margin: -.3rem -.3rem 0 0; width: 32px; height: 32px; line-height: 1;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; cursor: pointer;
  color: var(--ink); font-size: 1.1rem;
}
.btn-primary {
  display: inline-block; margin-top: .6rem; padding: .55rem 1rem; font-size: .9rem; font-weight: 600;
  color: var(--accent-ink); background: var(--accent); border-radius: 9px; text-decoration: none;
}

@media (max-width: 560px) {
  .hero { padding: 1.6rem 0 .5rem; }
  .brand h1 { font-size: 1.05rem; }
  button.go { padding: 0 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  * { transition: none !important; }
}
