/* Day Clock — styles */
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 400; font-display: swap; src: url('fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 700; font-display: swap; src: url('fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); }

:root, [data-theme="dark"] { --bg: #101418; --fg: #FFFFFF; --soft: #C9D3DC; --accent: #FFD166; --panel: #1D242C; --line: #3A4652; }
[data-theme="beige"] { --bg: #EFE6D2; --fg: #3A2717; --soft: #5C4632; --accent: #2E5A36; --panel: #F7F1E3; --line: #CDBF9F; }
[data-theme="navy"] { --bg: #16233B; --fg: #BFDDF7; --soft: #8FB2D6; --accent: #FFFFFF; --panel: #1D2D4A; --line: #3E5A82; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Atkinson Hyperlegible', system-ui, sans-serif; background: var(--bg); color: var(--fg); line-height: 1.45; }
a { color: var(--accent); }
:focus-visible { outline: 4px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

/* The clock fills the screen */
.clock { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 3vmin 4vmin 2vmin; gap: 1.2vmin; position: relative; }
.brand { position: absolute; top: 12px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand h1 { margin: 0; font-size: 1rem; font-weight: 700; color: var(--soft); }
.brand a { font-size: 1rem; color: var(--soft); }
.weekday { font-size: clamp(3rem, 17vmin, 13rem); font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.part { font-size: clamp(2rem, 10vmin, 7.5rem); font-weight: 700; line-height: 1.05; color: var(--accent); }
.date { font-size: clamp(1.6rem, 7.5vmin, 5.5rem); font-weight: 700; line-height: 1.1; }
.time { font-size: clamp(2.4rem, 13vmin, 10rem); font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; margin-top: 1vmin; }
.time .ampm { font-size: .55em; margin-left: .2em; }
.message { font-size: clamp(1.3rem, 5vmin, 3.2rem); line-height: 1.2; margin-top: 1.5vmin; padding: .3em .8em; border: 3px solid var(--line); border-radius: 14px; max-width: 92vw; }
.other { font-size: clamp(1.1rem, 3.8vmin, 2.4rem); color: var(--soft); margin-top: 1vmin; }

.controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 3vmin; }
.btn { font: inherit; font-size: 1.2rem; font-weight: 700; min-height: 56px; padding: 10px 20px; border-radius: 14px; cursor: pointer; color: var(--bg); background: var(--fg); border: 3px solid var(--fg); }
.btn.line { color: var(--fg); background: transparent; }
.note { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: 92vw; background: var(--panel); color: var(--fg); border: 2px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 1.1rem; z-index: 20; text-align: center; }
.scroll-hint { position: absolute; bottom: 10px; font-size: 1rem; color: var(--soft); text-decoration: none; }

/* Clock-only mode: just the clock; the buttons appear when the screen is tapped */
body.clock-only .below, body.clock-only .brand, body.clock-only .scroll-hint { display: none; }
body.clock-only .controls { opacity: 0; pointer-events: none; transition: opacity .3s; }
body.clock-only.controls-on .controls { opacity: 1; pointer-events: auto; }
body.clock-only .clock { cursor: none; }
body.clock-only.controls-on .clock { cursor: auto; }
#btn-exit { display: none; }
body.clock-only #btn-exit { display: inline-block; }
body.clock-only #btn-full { display: none; }

/* Text below the clock */
.below { background: var(--panel); color: var(--fg); border-top: 2px solid var(--line); }
.page { max-width: 760px; margin: 0 auto; padding: 28px 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.page h2 { margin: 14px 0 0; font-size: 1.6rem; line-height: 1.2; }
.page h3 { margin: 6px 0 -8px; font-size: 1.25rem; }
.page p, .page li { font-size: 1.2rem; margin: 0; }
.page ul, .page ol { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0 !important; }
.tags li { font-size: 1.05rem; border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; }
.foot { max-width: 760px; margin: 0 auto; padding: 0 20px 32px; display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--soft); font-size: 1rem; }

/* Settings */
.layer { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 16px 10px; z-index: 30; }
.panel { background: var(--panel); color: var(--fg); border: 2px solid var(--line); border-radius: 16px; width: 100%; max-width: 560px; padding: 20px 18px 22px; display: flex; flex-direction: column; gap: 16px; margin: auto 0; }
.panel h2 { margin: 0; font-size: 1.7rem; }
.panel fieldset { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.panel legend { font-weight: 700; font-size: 1.2rem; margin-bottom: 6px; padding: 0; }
.options { display: flex; flex-wrap: wrap; gap: 8px; }
.option { position: relative; }
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.option span { display: inline-flex; align-items: center; min-height: 50px; padding: 8px 14px; border: 2px solid var(--line); border-radius: 12px; font-size: 1.1rem; cursor: pointer; }
.option input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); font-weight: 700; }
.option input:focus-visible + span { outline: 4px solid var(--accent); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 1.1rem; }
.field select, .field input { font: inherit; font-size: 1.1rem; min-height: 50px; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--line); background: var(--bg); color: var(--fg); }
.hint { font-size: 1rem; color: var(--soft); margin: 0; }
.panel .buttons { display: flex; flex-direction: column; gap: 10px; }
.share-box { display: flex; flex-direction: column; gap: 6px; }

@media (max-height: 520px) and (orientation: landscape) {
  .clock { gap: .5vmin; padding-top: 2vmin; }
  .brand { display: none; }
  .controls { margin-top: 1.5vmin; }
  .btn { min-height: 46px; font-size: 1.05rem; padding: 6px 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Layout: day and time first and biggest, details smaller below, buttons spread out at the bottom */
.clock { justify-content: flex-start; padding-top: max(52px, 6vmin); padding-bottom: 0; gap: 0; }
.main-info { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1vmin; min-height: 0; }
.weekday { font-size: clamp(3.2rem, 19vmin, 15rem); }
.time { font-size: clamp(3rem, 18vmin, 14rem); margin-top: 0; }
.details { display: flex; flex-direction: column; align-items: center; gap: .8vmin; padding: 1vmin 0 2vmin; }
.part { font-size: clamp(1.6rem, 7vmin, 5rem); }
.date { font-size: clamp(1.4rem, 6vmin, 4.2rem); color: var(--soft); }
.message { font-size: clamp(1.2rem, 4.2vmin, 2.8rem); margin-top: 1vmin; }
.other { font-size: clamp(1.05rem, 3.4vmin, 2.2rem); }
.controls { width: min(920px, 100%); justify-content: space-between; align-items: center; flex-wrap: nowrap; gap: 16px; margin-top: 0; padding: 2vmin 0 max(40px, 5vmin); }
.controls .btn { font-size: 1.1rem; min-height: 52px; padding: 8px 18px; }
.scroll-hint { bottom: 8px; }
body.clock-only .controls { padding-bottom: 4vmin; }
@media (max-width: 480px) {
  .controls { gap: 8px; }
  .controls .btn { font-size: 1rem; padding: 8px 10px; }
}
/* Phones upright: the day must fit across ("Wednesday"), the time can be bigger */
@media (orientation: portrait) {
  .weekday { font-size: min(16vw, 15vh); }
  .time { font-size: min(21vw, 16vh); }
}
/* Phones on their side and other very low screens */
@media (max-height: 520px) and (orientation: landscape) {
  .clock { padding-top: 2vmin; }
  .weekday { font-size: 17vh; }
  .time { font-size: 16vh; }
  .part { font-size: 7vh; }
  .date { font-size: 6vh; }
  .message { font-size: 4.5vh; padding: .1em .6em; margin-top: .5vh; }
  .other { font-size: 4vh; }
  .details { padding: 0 0 1vh; gap: .3vh; }
  .controls { padding: 1vh 0 2vh; }
  .scroll-hint { display: none; }
}

/* Buttons never break into two lines on small phones */
.controls .btn { white-space: nowrap; }
@media (max-width: 480px) {
  .controls { gap: 6px; }
  .controls .btn { flex: 1 1 0; min-width: 0; font-size: .95rem; padding: 8px 6px; }
}

/* Calm first screen: only the day, the time and the date. Everything else is further down. */
.clock { height: 100vh; height: 100svh; min-height: 0; justify-content: center; padding: 4vmin; gap: 6vmin; }
.main-info { flex: 0 0 auto; }
.details { padding: 0; }
.controls { width: min(920px, 92vw); margin: 0 auto; padding: 14vh 0 10vh; justify-content: space-around; }
.below { border-top: none; }
.page h1 { margin: 0; font-size: 2rem; line-height: 1.15; }
/* Full screen: just the clock; tapping the screen shows the buttons at the bottom */
body.clock-only .controls { position: fixed; left: 50%; bottom: 3vmin; transform: translateX(-50%); padding: 0; z-index: 10; }
@media (orientation: portrait) { .clock { gap: 8vh; } }
@media (max-height: 520px) and (orientation: landscape) { .clock { gap: 3vh; } .controls { padding: 10vh 0 8vh; } }

/* Ad slots: invisible until ads are turned on (add class "ads" to <html>). Never on the clock screen or in full screen. */
.ad-slot { display: none; }
html.ads .ad-slot { display: block; min-height: 280px; margin: 8px 0; }
body.clock-only .ad-slot { display: none !important; }
