/* ---------- Global Reset & Variables ---------- */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --accent:       #2563eb;
  --accent-dark:  #1e40af;
  --gray-light:   #f1f5f9;
  --border:       #e5e7eb;
  --radius:       .25rem;
  --space:        .75rem;
}

/* ---------- Layout ---------- */
body {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial,
               "Noto Sans", sans-serif;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1000;
  padding: 1rem 0;
  text-align: center;
}

/* Controls bar */
.header-controls {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space);
  position: relative; /* anchors #results dropdown */
}

/* ---------- Buttons ---------- */
#random-word {
  background: var(--accent-dark);
  color: #fff;
  border: 0;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color .2s ease;
}

#random-word:hover,
#random-word:focus {
  background: var(--accent);
}

/* ---------- Search ---------- */
#search {
  width: 18rem;
  max-width: 100%;
  font-size: 1rem;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

#results {
  position: absolute;
  top: calc(100% + .25rem);
  left: 0;
  right: 0;
  background: #fff;
  list-style: none;
  margin: 0;
  padding: .25rem 0;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1001;
  border: 2px solid #d9d9d9;   /* thin light-grey border */
  border-radius: .25rem;       /* optional: rounded corners */
}

#results li {
  padding: .35rem .75rem;
  cursor: pointer;
}

#results li:hover {
  background: var(--gray-light);
}

/* Hide the box altogether when it has no <li> children */
#results:empty {
  display: none;
}

/* ---------- Typography ---------- */
.site-title a,
.site-title a:visited {
  text-decoration: none;
  color: var(--accent-dark);
  font-size: clamp(2.25rem, 5vw, 2.5rem);
  font-weight: 700;
  transition: color .25s ease;
}

.site-title a:hover,
.site-title a:focus {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 4px;
}

/* ---------- Term Page Elements ---------- */
.ozellikler {
  font-weight: 600;
  color: #2c596b;
}

.ornekler {
  padding: 1rem;
}

.orneklerkaynak {
  font-weight: 550;
  font-style: italic;
}

/* ---------- Footer ---------- */
footer {
  margin-top: 3rem;
  text-align: center;
  font-size: .875rem;
  color: #666;
}

/* ---------- 404 Page ---------- */
body.error-404 {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.error-404 main { width: 100%; }

.error-404 .error-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
}

.error-404 .error-box h1 {
  font-size: 8rem;
  margin: 0;
  line-height: 1;
  color: #e63946;
}

.error-404 .error-box p {
  font-size: 1.25rem;
  margin: .5rem 0;
}

.btn-home {
  display: inline-block;
  margin-top: 1.5rem;
  padding: .75rem 1.5rem;
  background: #1d3557;
  color: #fff;
  text-decoration: none;
  border-radius: .5rem;
  font-size: 1rem;
  transition: background-color .2s ease;
}

.btn-home:hover,
.btn-home:focus {
  background: #457b9d;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .header-controls {
    flex-direction: column;
    align-items: stretch;
  }
  #search,
  #random-word {
    width: 100%;
  }
}