:root {
  --ink: #102f3d;
  --ink-deep: #09232e;
  --accent: #d71932;
  --accent-dark: #ad1125;
  --paper: #f4f0e8;
  --paper-light: #fbf9f4;
  --surface: #ffffff;
  --muted: #5d6a70;
  --line: #d9d5cc;
  --line-dark: rgba(16, 47, 61, 0.18);
  --focus: #f9b233;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--paper-light);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: Arial, sans-serif;
  color: var(--ink);
  background: var(--paper-light);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1180px, calc(100% - 48px));
  max-width: none;
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10000;
  padding: 10px 14px;
  color: white;
  background: var(--ink-deep);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: relative;
  z-index: 100;
  background: var(--paper-light);
  border-bottom: 1px solid var(--line);
}

.site-nav,
.site-nav .nav-wrapper {
  height: 88px;
  line-height: normal;
  background: transparent;
  box-shadow: none;
}

.site-nav .nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-nav .brand-logo {
  position: relative;
  left: auto;
  display: flex;
  align-items: center;
  width: 188px;
  height: 58px;
  transform: none;
}

.site-nav .brand-logo img {
  display: block;
  width: 100%;
  height: auto;
  padding: 0;
}

.site-nav ul a {
  color: var(--ink);
}

.site-nav .language-trigger {
  height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.site-nav .language-trigger:hover,
.site-nav .language-trigger:focus-visible {
  background: var(--surface);
  border-color: var(--ink);
}

.language-trigger .language-chevron {
  font-size: 16px;
}

.language-menu.dropdown-content {
  min-width: 190px;
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(9, 35, 46, 0.12);
}

.language-menu.dropdown-content li > a {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  font-size: 15px;
}

.language-menu small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.site-nav .sidenav-trigger {
  margin: 0;
  color: var(--ink);
}

.sidenav {
  background: var(--paper-light);
}

.sidenav-heading {
  padding: 24px 32px 12px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 700;
}

.sidenav .language-trigger {
  margin: 16px;
  width: calc(100% - 32px);
  justify-content: flex-start;
}

.sidenav .language-chevron {
  margin-left: auto;
}

.site-main {
  flex: 1;
}

.alert:empty {
  display: none;
}

.alert {
  width: min(1180px, calc(100% - 48px));
  margin: 12px auto;
}

.home-hero {
  position: relative;
  overflow: hidden;
  padding: 96px 0 104px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.home-hero::after {
  content: "F";
  position: absolute;
  right: -0.04em;
  bottom: -0.33em;
  color: rgba(16, 47, 61, 0.035);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(340px, 42vw, 660px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr);
  gap: 9%;
  align-items: end;
}

.eyebrow {
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow > span {
  width: 24px;
  height: 2px;
  display: inline-block;
  background: var(--accent);
}

.hero-copy h1,
.results-header h1 {
  margin: 0;
  color: var(--ink-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 5.3vw, 78px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.hero-intro {
  max-width: 560px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.hero-search {
  padding-bottom: 4px;
}

.dictionary-search {
  position: relative;
  margin: 0;
}

.dictionary-search.input-field > .search-label {
  position: static;
  width: auto;
  pointer-events: auto;
  transform: none;
}

.search-label {
  margin-bottom: 12px;
  display: block;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.search-control {
  height: 72px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto 54px;
  align-items: center;
  background: var(--surface);
  border: 1px solid rgba(16, 47, 61, 0.35);
  box-shadow: 8px 8px 0 var(--ink);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.search-control:focus-within {
  border-color: var(--accent);
  box-shadow: 8px 8px 0 var(--accent);
}

.search-icon {
  justify-self: center;
  color: var(--ink);
  font-size: 25px;
}

.search-control input[type="search"]:not(.browser-default) {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 8px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border-radius: 0;
  color: var(--ink-deep);
  border: 0;
  box-shadow: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  font-weight: 700;
}

.search-control > .fieldset,
.search-control > .fieldset > label {
  display: contents;
}

.search-control input[type="search"]::-webkit-search-cancel-button,
.search-control input[type="search"]::-webkit-search-decoration {
  display: none;
  appearance: none;
  -webkit-appearance: none;
}

.search-control input[type="search"]:not(.browser-default):focus {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}

.search-control input::placeholder {
  color: #8e989c;
  font-weight: 400;
  opacity: 1;
}

.search-submit {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: var(--accent);
  border: 0;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    transform 160ms ease;
}

.search-clear {
  width: 36px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: color 160ms ease, transform 160ms ease;
}

.search-clear-icon {
  width: 22px;
  height: 22px;
}

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

.search-clear:hover {
  color: var(--accent);
  transform: scale(1.08);
}

.search-clear:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -2px;
}

.search-submit:hover {
  background: var(--accent-dark);
  transform: translateX(2px);
}

.search-submit:focus-visible,
.social a:focus-visible,
.footer-meta a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.search-meta {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.search-meta i {
  color: var(--accent);
  font-style: normal;
}

.autocomplete-content.dropdown-content {
  top: 86px !important;
  border: 1px solid var(--line);
  box-shadow: 0 18px 42px rgba(9, 35, 46, 0.14);
}

.autocomplete-content li > a,
.autocomplete-content li > span {
  color: var(--ink);
}

.discovery-section {
  padding: 80px 0 96px;
  background: var(--paper-light);
}

.discovery-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  gap: 9%;
  align-items: start;
}

.section-heading {
  display: block;
}

.section-heading h2,
.result-group-heading h2,
.empty-state h2 {
  margin: 0;
  color: var(--ink-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 31px;
  font-weight: 700;
  line-height: 1.18;
}

.section-heading p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.word-cloud {
  min-height: 112px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
}

.word-cloud a {
  padding: 11px 16px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.word-cloud a:nth-child(3n + 1) {
  color: var(--accent);
}

.word-cloud a:hover,
.word-cloud a:focus-visible {
  color: white;
  background: var(--ink);
  border-color: var(--ink);
  outline: none;
}

.word-cloud-message {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.word-skeleton {
  width: 104px;
  height: 42px;
  display: block;
  background: linear-gradient(90deg, #e7e2d8 25%, #f1ede5 50%, #e7e2d8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.word-skeleton:nth-child(2) {
  width: 138px;
}

.word-skeleton:nth-child(3) {
  width: 88px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

.detail-search {
  padding: 48px 0 56px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.detail-search-inner {
  max-width: 760px;
}

.results-section {
  padding: 72px 0 96px;
}

.results-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.55fr) minmax(0, 1.45fr);
  column-gap: 9%;
}

.results-header {
  align-self: start;
  position: sticky;
  top: 32px;
}

.results-header h1 {
  overflow-wrap: anywhere;
  font-size: clamp(48px, 6vw, 74px);
}

.result-count {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.result-groups {
  min-width: 0;
}

.result-group + .result-group {
  margin-top: 56px;
}

.result-group-heading {
  padding-bottom: 18px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  border-bottom: 2px solid var(--ink);
}

.result-group-heading h2 {
  font-size: 24px;
}

.definition-item {
  padding: 28px 0;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.definition-number {
  margin-top: 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.definition-item dl,
.definition-item dd {
  margin: 0;
}

.definition-item dt {
  color: var(--ink-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
  font-weight: 700;
  line-height: 1.2;
}

.definition-item dd {
  margin-top: 8px;
  color: #4f6067;
  font-size: 17px;
  line-height: 1.65;
}

.empty-state {
  padding: 56px;
  text-align: center;
  background: var(--paper);
  border: 1px solid var(--line);
}

.empty-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 700;
}

.empty-state p {
  margin: 12px 0 0;
  color: var(--muted);
}

.related-words {
  grid-column: 2;
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--line-dark);
}

.section-heading.compact {
  margin-bottom: 24px;
}

.section-heading.compact h2 {
  font-size: 23px;
}

.section-heading.compact p {
  margin-top: 6px;
  font-size: 14px;
}

.small-font.word-cloud a {
  font-size: 16px;
}

.site-footer {
  color: white;
  background: var(--ink-deep);
  border-top: 4px solid var(--accent);
}

.footer-inner {
  min-height: 132px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 32px;
}

.footer-signature {
  display: flex;
  align-items: center;
  gap: 13px;
}

.footer-signature div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-signature strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
}

.footer-signature div span {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.social a {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition:
    background-color 160ms ease,
    border-color 160ms ease;
}

.social a:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.social img {
  width: 18px;
  height: 18px;
  padding: 0;
  filter: brightness(0) invert(1);
}

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
}

.footer-meta a {
  color: white;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 4px;
}

@media (max-width: 900px) {
  .hero-grid,
  .discovery-grid {
    grid-template-columns: 1fr;
    gap: 52px;
  }

  .hero-copy {
    max-width: 680px;
  }

  .hero-search {
    max-width: 680px;
  }

  .results-layout {
    grid-template-columns: 1fr;
  }

  .results-header {
    position: static;
    margin-bottom: 52px;
  }

  .related-words {
    grid-column: 1;
  }
}

@media (max-width: 600px) {
  .container,
  .alert {
    width: calc(100% - 32px);
  }

  .site-nav,
  .site-nav .nav-wrapper {
    height: 72px;
  }

  .site-nav .brand-logo {
    width: 144px;
    height: 48px;
  }

  .home-hero {
    padding: 64px 0 72px;
  }

  .hero-grid {
    gap: 44px;
  }

  .hero-copy h1,
  .results-header h1 {
    font-size: 46px;
  }

  .hero-intro {
    margin-top: 20px;
    font-size: 16px;
  }

  .search-control {
    height: 64px;
    grid-template-columns: 44px minmax(0, 1fr) auto 48px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .search-control:focus-within {
    box-shadow: 5px 5px 0 var(--accent);
  }

  .search-control input[type="search"]:not(.browser-default) {
    padding-inline: 4px;
    font-size: 19px;
  }

  .search-clear {
    width: 32px;
    height: 38px;
  }

  .search-submit {
    width: 38px;
    height: 38px;
  }

  .discovery-section,
  .results-section {
    padding: 56px 0 72px;
  }

  .discovery-grid {
    gap: 32px;
  }

  .section-heading h2 {
    font-size: 27px;
  }

  .word-cloud {
    min-height: 96px;
    gap: 8px;
  }

  .word-cloud a {
    padding: 10px 13px;
    font-size: 16px;
  }

  .detail-search {
    padding: 36px 0 44px;
  }

  .results-header {
    margin-bottom: 40px;
  }

  .result-group-heading h2 {
    font-size: 21px;
  }

  .definition-item {
    padding: 22px 0;
    grid-template-columns: 28px 1fr;
    gap: 8px;
  }

  .definition-item dt {
    font-size: 25px;
  }

  .definition-item dd {
    font-size: 16px;
  }

  .empty-state {
    padding: 40px 22px;
  }

  .related-words {
    margin-top: 52px;
  }

  .footer-inner {
    padding: 36px 0;
    grid-template-columns: 1fr;
    gap: 24px;
    justify-items: center;
    text-align: center;
  }

  .footer-meta {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* LiveView behavior layered onto the preserved v3.5.1 design. */
button,
input,
summary {
  font: inherit;
}

.language-picker {
  position: relative;
  margin-left: auto;
}

.language-picker summary {
  list-style: none;
  cursor: pointer;
}

.language-picker summary::-webkit-details-marker {
  display: none;
}

.language-picker .language-trigger {
  color: var(--ink);
}

.language-picker .language-icon,
.language-picker .language-chevron {
  width: 19px;
  height: 19px;
}

.language-picker .language-chevron {
  width: 16px;
  height: 16px;
}

.language-picker[open] .language-chevron {
  transform: rotate(180deg);
}

.language-menu.dropdown-content {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1000;
  width: 190px;
  height: auto;
  margin: 0;
  padding: 0;
  display: block;
  list-style: none;
  background: var(--surface);
}

.language-menu.dropdown-content li {
  min-height: 48px;
}

.language-menu.dropdown-content li > a {
  text-decoration: none;
}

#dictionary-search-shell {
  position: relative;
}

.search-icon {
  width: 25px;
  height: 25px;
}

.search-submit-icon {
  width: 22px;
  height: 22px;
}

.search-suggestions.dropdown-content {
  position: absolute;
  z-index: 50;
  right: 0;
  left: 0;
  width: auto;
  height: auto;
  margin: 0;
  padding: 6px 0;
  display: block;
  list-style: none;
  background: var(--surface);
}

.search-suggestions[hidden] {
  display: none;
}

.search-suggestions li {
  min-height: 48px;
}

.search-suggestions li > button {
  width: 100%;
  min-height: 48px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
}

.search-suggestions li > button:hover,
.search-suggestions li > button:focus-visible {
  background: var(--paper);
  outline: none;
}

.search-suggestions button svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

svg {
  display: block;
}

.size-3 {
  width: 0.75rem;
  height: 0.75rem;
}

.size-4 {
  width: 1rem;
  height: 1rem;
}

.size-5 {
  width: 1.25rem;
  height: 1.25rem;
}

.toast {
  position: fixed;
  z-index: 2000;
  top: 18px;
  right: 18px;
}

.toast .alert {
  width: min(384px, calc(100vw - 36px));
  margin: 0;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(9, 35, 46, 0.16);
}

.toast .alert button {
  margin-left: auto;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}

[data-phx-session],
[data-phx-teleported-src] {
  display: contents;
}
