:root {
  color-scheme: dark;
  --page: #171817;
  --surface: #20211f;
  --surface-hover: #292a27;
  --text: #f1f1ec;
  --muted: #9a9b94;
  --subtle: #6f706a;
  --line: #353631;
  --line-strong: #55574f;
  --button-text: #d9dad4;
  --focus: #a8c7fa;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #efefe9;
  --surface: #f9f9f5;
  --surface-hover: #e5e5df;
  --text: #1a1b19;
  --muted: #66675f;
  --subtle: #85867e;
  --line: #d1d2ca;
  --line-strong: #a9aaa1;
  --button-text: #3c3d38;
  --focus: #315f9f;
  --shadow: 0 20px 60px rgba(34, 35, 31, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
}

body {
  display: grid;
  min-height: 100vh;
  margin: 0;
  grid-template-rows: 1fr auto;
  overflow-x: hidden;
  background: var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background-color 180ms ease, color 180ms ease;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.theme-toggle {
  position: fixed;
  z-index: 10;
  top: 24px;
  right: 28px;
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.theme-toggle span {
  font-size: 17px;
  line-height: 1;
}

.home {
  display: flex;
  width: min(820px, calc(100% - 40px));
  min-height: calc(100vh - 66px);
  margin: 0 auto;
  padding: 72px 0 58px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero {
  width: 100%;
  text-align: center;
}

.clock {
  display: block;
  font-size: clamp(64px, 9.6vw, 108px);
  font-weight: 240;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  line-height: 0.95;
}

.date {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.01em;
}

.search-area {
  display: flex;
  width: 100%;
  margin-top: clamp(40px, 6vh, 64px);
  flex-direction: column;
  align-items: center;
}

.search-box {
  width: min(700px, 100%);
  min-height: 60px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 180ms ease;
}

.search-box:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 16%, transparent);
}

.search-box input {
  width: 100%;
  height: 58px;
  padding: 0 26px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  text-align: center;
}

.search-box input::placeholder {
  color: var(--subtle);
  opacity: 1;
  text-align: center;
}

input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

.provider-groups {
  display: grid;
  width: min(700px, 100%);
  margin-top: 28px;
  grid-template-columns: 1fr;
}

.provider-group {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.provider-list {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.provider-list button {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--button-text);
  font-size: 13px;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.provider-list button:hover {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
  transform: translateY(-1px);
}

.provider-list button:active {
  transform: translateY(0);
}

.legal-footer {
  display: flex;
  min-height: 66px;
  padding: 18px 24px 22px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--subtle);
  font-size: 12px;
}

.legal-footer button,
.legal-footer a {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}

.legal-footer button:hover,
.legal-footer a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.modal {
  width: min(620px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 36px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(4, 5, 4, 0.66);
}

.modal[open] {
  animation: modal-in 150ms ease-out;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

.modal-shell {
  margin: 0;
}

.modal-header {
  display: flex;
  padding: 22px 24px 18px;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 3px 0 0;
  font-size: 22px;
  font-weight: 620;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.close-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.close-button:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.modal-body {
  max-height: calc(100vh - 136px);
  padding: 22px 24px 32px;
  overflow-y: auto;
}

.legal-copy section + section {
  margin-top: 24px;
}

.legal-copy h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 650;
}

.legal-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.72;
}

noscript {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-align: center;
}

@media (max-width: 640px) {
  .theme-toggle {
    top: 16px;
    right: 16px;
  }

  .home {
    width: min(100% - 28px, 820px);
    padding: 86px 0 46px;
    justify-content: flex-start;
  }

  .clock {
    font-size: clamp(42px, 15vw, 68px);
  }

  .search-area {
    margin-top: 46px;
  }

  .search-box {
    min-height: 58px;
    border-radius: 16px;
  }

  .search-box input {
    height: 56px;
    padding: 0 18px;
  }

  .provider-list button {
    min-height: 36px;
  }

  .modal-header,
  .modal-body {
    padding-right: 18px;
    padding-left: 18px;
  }
}

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