@import url("mobile.css");

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --layout-max: 1360px;
  --layout-pad-x: 1.25rem;
  --purple: #7b86e8;
  --purple-dark: #6a75d4;
  --blue: #3b71db;
  --blue-dark: #2f5fc0;
  --text: #222;
  --text-muted: #555;
  --border: #ccc;
  --bg: #fafafa;
  --surface: #fff;
  --surface-hover: #f5f5f5;
  --border-subtle: #e8e8e8;
  --divider: #ddd;
  --input-bg: #fff;
  --header-bg: #fff;
  --result-bg: #f0f4fc;
  --clock-bg-primary: #4a5060;
  --clock-text-primary: #fff;
  --clock-bg-secondary: #e4e7ec;
  --clock-text-secondary: #3d4451;
  --tz-active-bg: #f0f1f3;
  --success: #2e9e5b;
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --purple: #9aa5f0;
  --purple-dark: #7f8be8;
  --blue: #6b9fff;
  --blue-dark: #8eb4ff;
  --text: #e8eaef;
  --text-muted: #9aa3b5;
  --border: #3d4556;
  --bg: #12151c;
  --surface: #1e2330;
  --surface-hover: #2a3142;
  --border-subtle: #2a3142;
  --divider: #3d4556;
  --input-bg: #252b3a;
  --header-bg: #1a1f2b;
  --result-bg: #1a2744;
  --clock-bg-primary: #3d4556;
  --clock-text-primary: #f0f2f5;
  --clock-bg-secondary: #2a3142;
  --clock-text-secondary: #c5cad4;
  --tz-active-bg: #2a3142;
  --success: #4cd07a;
  color-scheme: dark;
}

html {
  font-size: 16px;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.site-header {
  background: var(--header-bg);
  border-bottom: 3px solid var(--purple);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 1rem var(--layout-pad-x);
  box-sizing: border-box;
}

.logo {
  font-family: var(--serif);
  font-size: 2.25rem;
  font-weight: normal;
  color: var(--purple);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none;
  transition: background 0.15s, color 0.15s;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

/* Language dropdown menu */
.lang-menu {
  position: relative;
}

.lang-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 7.5rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lang-menu-trigger:hover,
.lang-menu.is-open .lang-menu-trigger {
  border-color: var(--purple);
  box-shadow: 0 0 0 1px rgba(123, 134, 232, 0.25);
}

.lang-menu-globe {
  color: var(--text-muted);
  flex-shrink: 0;
}

.lang-menu-current {
  flex: 1;
  text-align: left;
  white-space: nowrap;
}

.lang-menu-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.lang-menu.is-open .lang-menu-chevron {
  transform: rotate(180deg);
}

.lang-menu-list {
  position: absolute;
  z-index: 100;
  top: calc(100% + 6px);
  right: 0;
  min-width: 100%;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .lang-menu-list {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.lang-menu-item {
  padding: 0.5rem 0.85rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}

.lang-menu-item:hover {
  background: var(--surface-hover);
  color: var(--blue);
}

.lang-menu-item.is-active {
  background: var(--result-bg);
  color: var(--blue);
  font-weight: 600;
}

.lang-menu-trigger:focus-visible,
.lang-menu-item:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

/* Theme pill switch */
.theme-switch-track {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 4.75rem;
  height: 2.1rem;
  padding: 3px;
  border-radius: 999px;
  background: #e4e7ec;
  border: 1px solid var(--border);
  box-sizing: border-box;
}

[data-theme="dark"] .theme-switch-track {
  background: #2a3142;
}

.theme-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 5px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.theme-switch[data-active="dark"] .theme-switch-thumb {
  transform: translateX(calc(100% + 6px));
}

.theme-switch-option {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
}

.theme-switch-option:hover {
  color: var(--text);
}

.theme-switch-option.is-active {
  color: var(--purple);
}

[data-theme="dark"] .theme-switch-option.is-active {
  color: var(--blue);
}

.theme-switch-option:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-radius: 999px;
}

/* Layout */
.page-wrap {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 1.25rem;
  width: 100%;
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 1rem var(--layout-pad-x) 1.5rem;
  box-sizing: border-box;
}

.main-content {
  background: var(--surface);
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border-subtle);
  min-width: 0;
}

/* Local time panel */
.local-time-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1.25rem 2rem;
  align-items: start;
  margin-bottom: 0.5rem;
}

.local-time-left,
.local-time-right {
  align-self: start;
  min-width: 0;
}

.local-time-heading {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  white-space: nowrap;
}

.local-time-zone-id {
  margin: 0 0 1.1rem;
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.local-time-date {
  margin: 0 0 1.15rem;
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.45;
  white-space: nowrap;
}

.digital-clock {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  width: max-content;
  max-width: 100%;
}

.clock-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: clamp(3.4rem, 8.5vw, 4.6rem);
  height: clamp(3.4rem, 8.5vw, 4.6rem);
  aspect-ratio: 1;
  padding: 0;
  border-radius: 8px;
  font-size: clamp(1.65rem, 3.8vw, 2.5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0.02em;
}

.clock-box--hm {
  background: var(--clock-bg-primary);
  color: var(--clock-text-primary);
}

.clock-box--s {
  background: var(--clock-bg-secondary);
  color: var(--clock-text-secondary);
}

.clock-colon {
  flex-shrink: 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--text-muted);
  line-height: 1;
  padding: 0 0.15rem;
  align-self: center;
}

.local-time-right {
  min-width: 0;
}

.tz-long-name {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.tz-abbr {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  color: var(--text-muted);
}

.tz-info-divider {
  border: none;
  border-top: 1px solid var(--divider);
  margin: 1rem 0;
}

.tz-info-list {
  margin: 0;
}

.tz-info-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem 1.5rem;
  align-items: start;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.tz-info-row:last-child {
  border-bottom: none;
}

.tz-info-row dt {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.tz-info-row dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}

.tz-info-dt {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tz-row-sub {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.35;
}

.tz-id-value {
  color: var(--blue);
  font-weight: 600;
}

.tz-info-row.is-active {
  background: var(--tz-active-bg);
  margin: 0 -0.75rem;
  padding: 0.85rem 0.75rem;
  border-radius: 6px;
  border-bottom-color: transparent;
}

.tz-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--success);
}

.tz-active-icon {
  flex-shrink: 0;
  color: var(--success);
}

.divider {
  border: none;
  border-top: 1px solid var(--divider);
  margin: 2rem 0;
}

/* Converter */
.converter-title {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 1.75rem;
  color: var(--text);
}

.converter-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
}

.btn-convert {
  flex-shrink: 0;
  margin-left: auto;
}

.converter-pick {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
  position: relative;
  z-index: 1;
}

.converter-pick:focus-within {
  z-index: 100;
}

.converter-label {
  flex-shrink: 0;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.searchable-select-wrap {
  flex: 1;
  min-width: 0;
}

.ss-root {
  position: relative;
  width: 100%;
}

.ss-field {
  position: relative;
  width: 100%;
}

.ss-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 2px;
}

.ss-input:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.ss-input--has-clear {
  padding-right: 2.1rem;
}

.ss-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  pointer-events: none;
}

.ss-clear.is-visible {
  display: flex;
  pointer-events: auto;
}

.ss-clear.is-visible:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.ss-list {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  max-height: 240px;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.ss-list--floating {
  position: fixed;
  left: auto;
  right: auto;
  top: auto;
  z-index: 10000;
}

[data-theme="dark"] .ss-list {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.ss-option {
  padding: 0.45rem 0.65rem;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--text);
}

.ss-option:hover,
.ss-option:focus {
  background: var(--surface-hover);
  color: var(--blue);
}

.btn-outline {
  padding: 0.4rem 0.9rem;
  background: transparent;
  color: var(--blue);
  border: 2px solid var(--blue);
  white-space: nowrap;
}

.btn-outline:hover {
  background: var(--blue);
  color: #fff;
}

.converter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.converter-result {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--result-bg);
  border-left: 4px solid var(--blue);
}

.converter-result .result-label {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.converter-result .result-from,
.converter-result .result-to {
  margin: 0.25rem 0;
  font-size: 1.05rem;
}

/* World Time */
.world-time {
  margin-top: 0.5rem;
  padding: 1.75rem 0 2rem;
}

.world-time-title {
  margin: 0 0 1.75rem;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.world-time-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem 1.5rem;
}

.world-clock-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.world-clock-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  padding: 0.35rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.world-clock-flag {
  display: block;
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
}

.world-clock-face-wrap {
  width: min(100%, 148px);
  aspect-ratio: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.12));
}

.analog-clock {
  width: 100%;
  height: 100%;
  display: block;
}

.analog-face {
  fill: #fff;
  stroke: #111;
  stroke-width: 3;
}

[data-theme="dark"] .analog-face {
  fill: #f5f5f5;
}

.analog-tick {
  stroke: #333;
  stroke-width: 0.6;
}

.analog-tick--major {
  stroke-width: 1.2;
}

.analog-num {
  fill: #222;
  font-size: 7px;
  font-weight: 600;
  text-anchor: middle;
  font-family: var(--sans);
}

.analog-hand {
  stroke-linecap: round;
}

.analog-hand--hour {
  stroke: #111;
  stroke-width: 2.8;
}

.analog-hand--minute {
  stroke: #111;
  stroke-width: 2;
}

.analog-hand--second {
  stroke: #e53935;
  stroke-width: 1;
}

.analog-center {
  fill: #111;
}

.world-clock-meta {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}

/* Sidebar */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sidebar-link {
  display: block;
  padding: 0.85rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.sidebar-link:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.sidebar-link.is-active {
  border-color: var(--purple);
  color: var(--purple);
  background: var(--result-bg);
  font-weight: 600;
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--header-bg);
  border-top: 1px solid var(--border-subtle);
}

.footer-inner {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 2rem var(--layout-pad-x) 1.5rem;
  box-sizing: border-box;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 3rem;
  justify-content: space-between;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.footer-brand {
  flex: 1 1 200px;
  min-width: 0;
}

.footer-logo {
  font-family: var(--serif);
  font-size: 1.75rem;
  color: var(--purple);
  text-decoration: none;
  letter-spacing: 0.02em;
}

html.js-site-seo-pending [data-site-name] {
  visibility: hidden;
}

.footer-logo:hover {
  color: var(--purple-dark);
}

.footer-tagline {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.45;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem 3rem;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 160px;
}

.footer-heading {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.footer-col a {
  font-size: 0.88rem;
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-col a:hover {
  color: var(--blue);
}

.footer-bottom {
  padding-top: 1.25rem;
}

.footer-copy {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 900px) {
  .page-wrap {
    grid-template-columns: 1fr;
  }

  .world-time-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.75rem 1rem;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-link {
    flex: 1 1 200px;
  }
}

@media (max-width: 600px) {
  .header-inner {
    padding: 0.85rem 1rem;
  }

  .logo {
    font-size: 1.75rem;
  }

  .header-tools {
    width: 100%;
    justify-content: flex-end;
  }

  .main-content {
    padding: 1.25rem;
  }

  .local-time-panel {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .local-time-heading,
  .local-time-date {
    white-space: normal;
  }

  .digital-clock {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .world-time {
    padding: 1.25rem 0 1.5rem;
  }

  .world-time-title {
    font-size: 1.45rem;
    margin-bottom: 1.25rem;
  }

  .world-clock-face-wrap {
    width: min(100%, 120px);
  }

  .tz-info-row dd {
    white-space: normal;
  }

  .page-wrap {
    padding: 0.75rem 1rem 1.25rem;
  }

  :root {
    --layout-pad-x: 1rem;
  }

  .converter-bar {
    flex-wrap: wrap;
  }

  .converter-pick {
    flex: 1 1 100%;
  }

  .footer-top {
    flex-direction: column;
    gap: 1.5rem;
  }

  .footer-links {
    width: 100%;
  }
}
