/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { -webkit-font-smoothing: antialiased; }
ol, ul { list-style: none; }
img { display: block; max-width: 100%; }
svg { display: block; }
b, strong { font-weight: 700; }
a { text-decoration: none; }
button { background: none; border: none; cursor: pointer; padding: 0; }
input, textarea { outline: none; }

/* ── Tokens ────────────────────────────────────────────────────────────────── */
:root {
  --font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --accent: #828fff;

  /* dark (default) */
  --bg:          #151515;
  --bg-subtle:   #1e1e1e;
  --bg-hover:    rgba(255,255,255,0.08);
  --bg-overlay:  rgba(0,0,0,0.85);
  --border:      rgba(255,255,255,0.08);
  --text-1:      #f2f2f2;
  --text-2:      #d8d8d8;
  --text-3:      #a8a8a8;
  --text-4:      #777777;
  --flip-card:   #1c1c1c;
  --flip-text:   #cccccc;
  --flip-bg:     #000000;
}

[data-theme='light'] {
  --bg:          #ffffff;
  --bg-subtle:   #f0f0f0;
  --bg-hover:    rgba(0,0,0,0.06);
  --bg-overlay:  rgba(0,0,0,0.75);
  --border:      rgba(0,0,0,0.08);
  --text-1:      #111111;
  --text-2:      #333333;
  --text-3:      #666666;
  --text-4:      #999999;
  --flip-card:   #e5e5e5;
  --flip-text:   #333333;
  --flip-bg:     #000000;
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
html {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.3s;
}

html.show-scrollbar {
  scrollbar-color: var(--text-4) transparent;
}

body {
  font-family: var(--font);
  font-weight: 400;
  background-color: var(--bg);
  color: var(--text-1);
  transition: background-color 0.2s, color 0.2s;
  overflow-y: overlay; /* Chrome/Safari: overlay scrollbar doesn't take space */
}

/* Chrome, Edge, and Safari */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 10px;
}

html.show-scrollbar ::-webkit-scrollbar-thumb {
  background-color: var(--text-4);
}

a { color: var(--accent); }
a:hover { opacity: 0.8; }

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.d-flex        { display: flex; }
.align-center  { align-items: center; }
.justify-center{ justify-content: center; }
.ml-auto       { margin-left: auto; }
.hidden        { display: none !important; }
.overflow-hidden { overflow: hidden; }

/* ── Header ────────────────────────────────────────────────────────────────── */
.header-topbar {
  display: flex;
  align-items: center;
  height: 70px;
  padding: 5px 10px;
  position: relative;
  z-index: 100;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.header-topbar.height-50 {
  height: 50px;
}
.header-topbar.header-invisible {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.topbar-start-column { width: 50%; display: flex; }
.topbar-center-column {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  /* width: 250px; */
}
.topbar-center-column h1 a {
  font-size: 22px;
  font-weight: 500;
  color: var(--text-2);
  opacity: 0.8;
  display: block;
}
.topbar-center-column h1 a:hover { opacity: 1; }

.topbar-end-column {
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

/* icon buttons */
.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-1);
  opacity: 0.7;
  transition: background-color 0.15s, opacity 0.15s;
}
.btn-icon:hover { background-color: var(--bg-hover); opacity: 1; }
.btn-icon svg { width: 20px; height: 20px; }

/* Theme switcher in settings */
.theme-switcher {
  display: flex;
  gap: 8px;
  width: 100%;
}
.theme-opt {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-4);
  transition: all 0.15s;
}
.theme-opt { color: var(--text-4); }
.theme-opt:hover { color: var(--text-1) !important; border-color: var(--text-3); }
.theme-opt.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* fullscreen button */
.toggle-fullscreen-svg path {
  fill: none;
  stroke: var(--text-1);
  stroke-width: 2;
}
.toggle-fullscreen-btn:not(.on) .icon-fullscreen-leave { display: none; }
.toggle-fullscreen-btn.on .icon-fullscreen-enter { display: none; }

/* ── Slide-out menu ────────────────────────────────────────────────────────── */
.menu-icon { cursor: pointer; }

#slide-out-menu {
  position: fixed;
  top: 0; left: -270px;
  width: 260px;
  height: 100%;
  background-color: var(--bg-subtle);
  z-index: 200;
  padding: 2px;
  transition: left 0.3s ease;
  overflow-y: auto;
}
#slide-out-menu.menu-visible { left: 0; }

#overlay {
  position: fixed;
  inset: 0;
  background-color: var(--bg-overlay);
  z-index: 150;
  cursor: pointer;
}

.menu-content-box {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
}
.menu-content-box .menu-title {
  font-size: 13px;
  color: var(--text-4);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 12px 10px;
}
.menu-content-box li a {
  display: flex;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-1);
  border-radius: 4px;
  transition: background-color 0.15s;
}
.menu-content-box li a:hover { background-color: var(--bg-hover); }

/* ── Settings popup ────────────────────────────────────────────────────────── */
.settings-wrap { position: relative; }

.settings-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 999;
  padding: 4px 0 8px;
}
.settings-panel.open { display: block; }

.settings-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-4);
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-1);
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-flex; cursor: pointer; }
.toggle-switch input { display: none; }
.toggle-track {
  display: block;
  width: 36px;
  height: 20px;
  background: var(--text-4);
  border-radius: 20px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.2s;
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track .toggle-thumb { left: 18px; }

/* ── Hero ──────────────────────────────────────────────────────────────────── */
.full-screen-header {
  width: 100%;
  height: calc(100vh - 70px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0 15px;
}

#dayAndYear {
  font-size: 28px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 40px;
}

#clock1 { height: 240px; }

/* ── World Clock ───────────────────────────────────────────────────────────── */
.world-clock-section {
  margin-top: 40px;
  width: 100%;
  max-width: 900px;
}
.world-clock-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
}
.world-clock-card {
  background-color: var(--bg-subtle);
  border-radius: 8px;
  padding:16px 12px;
  text-align: center;
  transition: transform 0.2s;
}
.world-clock-card:hover {
  background-color: var(--bg-hover);
}
.world-clock-city {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-4);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.world-clock-time {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-2);
}

.quotes-section { margin-top: 50px; text-align: center; }
#quotation {
  font-size: 20px;
  color: var(--text-3);
  font-weight: 500;
  font-style: italic;
}
#source {
  font-size: 16px;
  color: var(--text-4);
  margin-top: 12px;
}

/* ── Flip clock library overrides ──────────────────────────────────────────── */
.flip-clock-wrapper * { box-sizing: border-box; backface-visibility: hidden; }
.flip-clock-wrapper {
  font: normal 11px 'Helvetica Neue', Helvetica, sans-serif;
  user-select: none;
  text-align: center;
  position: relative;
  pointer-events: none;
}
.flip-clock-wrapper ul {
  position: relative; float: left; margin: 5px;
  width: 130px; height: 160px;
  font-size: 80px; font-weight: 700; line-height: 87px;
  border-radius: 6px; background: var(--flip-bg);
}
.flip-clock-wrapper ul li { z-index: 1; position: absolute; left: 0; top: 0; width: 100%; height: 100%; line-height: 157px; }
.flip-clock-wrapper ul li:first-child { z-index: 2; }
.flip-clock-wrapper ul li a { display: block; height: 100%; perspective: 200px; cursor: default !important; overflow: visible !important; margin: 0 !important; }
.flip-clock-wrapper ul li a div { z-index: 1; position: absolute; left: 0; width: 100%; height: 50%; overflow: hidden; outline: 1px solid transparent; }
.flip-clock-wrapper ul li a div .shadow { position: absolute; width: 100%; height: 100%; z-index: 2; }
.flip-clock-wrapper ul li a div.up { transform-origin: 50% 100%; top: 0; }
.flip-clock-wrapper ul li a div.up::after { content: ''; position: absolute; top: 78px; left: 0; z-index: 5; width: 100%; height: 3px; background-color: rgba(0,0,0,0.4); }
.flip-clock-wrapper ul li a div.down { transform-origin: 50% 0; bottom: 0; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; }
.flip-clock-wrapper ul li a div div.inn { position: absolute; left: 0; z-index: 1; width: 100%; height: 200%; color: var(--flip-text); text-align: center; background-color: var(--flip-card); border-radius: 6px; font-size: 130px; }
.flip-clock-wrapper ul li a div.up div.inn { top: 0; }
.flip-clock-wrapper ul li a div.down div.inn { bottom: 0; }
.flip-clock-divider { float: left; display: inline-block; position: relative; width: 20px; height: 160px; }
.flip-clock-divider:first-child { width: 0; }
.flip-clock-dot { display: block; background: #323434; width: 10px; height: 10px; position: absolute; border-radius: 50%; box-shadow: 0 0 5px rgba(0,0,0,0.5); left: 5px; }
.flip-clock-dot.top { top: 60px; }
.flip-clock-dot.bottom { bottom: 60px; }
.flip-clock-wrapper ul.flip-clock-meridium { margin: 0 0 0 20px; width: auto; background: none !important; box-shadow: none !important; font-size: 36px !important; }
.flip-clock-meridium a { color: var(--text-3); }
.flip-clock-wrapper ul.play li.flip-clock-before { z-index: 3; }
.flip-clock-wrapper ul.play li.flip-clock-active { animation: asd 10ms 0.49s linear both; z-index: 5; }
.flip-clock-wrapper ul.play li.flip-clock-active .down { z-index: 2; animation: turn 0.5s 0.5s linear both; }
.flip-clock-wrapper ul.play li.flip-clock-before .up { z-index: 2; animation: turn2 0.5s linear both; }
.flip-clock-wrapper ul li.flip-clock-active { z-index: 3; }
.flip-clock-wrapper ul.play li.flip-clock-before .up .shadow { background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, #000 100%); animation: show 0.5s linear both; }
.flip-clock-wrapper ul.play li.flip-clock-active .up .shadow { background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, #000 100%); animation: hide 0.5s 0.3s linear both; }
.flip-clock-wrapper ul.play li.flip-clock-before .down .shadow { background: linear-gradient(to bottom, #000 0%, rgba(0,0,0,0.1) 100%); animation: show 0.5s linear both; }
.flip-clock-wrapper ul.play li.flip-clock-active .down .shadow { background: linear-gradient(to bottom, #000 0%, rgba(0,0,0,0.1) 100%); animation: hide 0.5s 0.2s linear both; }

@keyframes asd   { 0% { z-index: 2; } 100% { z-index: 4; } }
@keyframes turn  { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes turn2 { 0% { transform: rotateX(0); } 100% { transform: rotateX(-90deg); } }
@keyframes show  { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes hide  { 0% { opacity: 1; } 100% { opacity: 0; } }

/* ── Content ───────────────────────────────────────────────────────────────── */
.flipclock-content { padding: 80px 0; }
.content-container { max-width: 700px; margin: 0 auto; padding: 0 20px; }

.content-container h2 {
  font-size: 28px; font-weight: 600;
  color: var(--text-1);
  margin: 40px 0 16px;
  line-height: 1.4;
}
.content-container h3 {
  font-size: 20px; font-weight: 600;
  color: var(--text-1);
  margin: 32px 0 12px;
  line-height: 1.4;
}
.content-container p {
  font-size: 1rem; line-height: 1.75;
  color: var(--text-2);
  margin-bottom: 16px;
}
.content-container ul {
  list-style: disc;
  padding-left: 20px;
  margin-bottom: 16px;
}
.content-container ul li {
  font-size: 1rem; line-height: 1.75;
  color: var(--text-2);
  margin-bottom: 8px;
  padding-left: 4px;
}
.content-container a {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
}

/* ── Popular Articles ── */
.articles-list {
  margin-top: 24px;
}
.article-item {
  margin-bottom: 32px;
}
.article-item h3 {
  margin-top: 0 !important;
}
.article-item p {
  color: var(--text-3);
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.footer-section-main {
  padding: 50px 20px 60px;
  text-align: center;
  border-top: 1px solid var(--border);
}
.footer-row-second { margin-bottom: 24px; }
.footer-row-second li { display: inline-block; margin:8px; }
.footer-row-second li a {
  font-size: 14px;
  color: var(--text-3);
  transition: color 0.2s;
}
.footer-row-second li a:hover { color: var(--text-1); }
.footer-bottom-row p,
.footer-bottom-row a {
  font-size: 14px;
  color: var(--text-4);
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .mobile-hidden { display: none !important; }

  #dayAndYear { font-size: 18px; margin-bottom: 24px; }
  #clock1 {
    height: auto;
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .flip-clock-wrapper { margin: 0 auto; display: inline-block; width: auto; }
  .flip-clock-wrapper ul { width: 44px; height: 70px; margin: 2px; }
  .flip-clock-divider { height: 70px; width: 14px; }
  .flip-clock-dot { width: 6px; height: 6px; left: 4px; }
  .flip-clock-dot.top { top: 25px; }
  .flip-clock-dot.bottom { bottom: 25px; }
  .flip-clock-wrapper ul li { line-height: 70px; }
  .flip-clock-wrapper ul li a div div.inn { font-size: 38px; }
  .flip-clock-wrapper ul li a div.up::after { top: 34px; height: 2px; }
  .flip-clock-wrapper ul.flip-clock-meridium { display: none !important; }

  .content-container h2 { font-size: 22px; }
  .content-container h3 { font-size: 18px; }

  .world-clock-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .flip-clock-divider { display: none !important; }
  .flip-clock-wrapper ul { width: 38px; height: 60px; margin: 1px; }
  .flip-clock-divider { height: 60px; width: 10px; }
  .flip-clock-dot { width: 4px; height: 4px; left: 3px; }
  .flip-clock-dot.top { top: 20px; }
  .flip-clock-dot.bottom { bottom: 20px; }
  .flip-clock-wrapper ul li { line-height: 60px; }
  .flip-clock-wrapper ul li a div div.inn { font-size: 32px; }
  .flip-clock-wrapper ul li a div.up::after { top: 29px; }
  .flip-clock-wrapper ul.flip-clock-meridium { margin-left: 5px; font-size: 18px !important; }

  .world-clock-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .flip-clock-wrapper ul { width: 32px; height: 50px; }
  .flip-clock-divider { height: 50px; width: 8px; }
  .flip-clock-dot { width: 3px; height: 3px; left: 2px; }
  .flip-clock-wrapper ul li { line-height: 50px; }
  .flip-clock-wrapper ul li a div div.inn { font-size: 26px; }
  .flip-clock-wrapper ul li a div.up::after { top: 24px; }
}

