/* TimeCord - single stylesheet for the whole site. Discord-blurple dark theme.
   Every color/spacing decision goes through a CSS custom property so a single
   edit propagates everywhere. */

:root {
  /* Surfaces */
  --bg: #0b0d14;
  --bg-elevated: #161922;
  --bg-input: #1d2129;
  --bg-code: #11141b;

  /* Text */
  --fg: #f2f3f5;
  --fg-muted: #9aa3b2;
  --fg-faint: #6b7280;

  /* Brand / state */
  --accent: #5865f2;          /* Discord blurple */
  --accent-bright: #7984f5;
  --accent-dim: rgba(88, 101, 242, 0.16);
  --success: #3ba55d;
  --error: #ed4245;

  --border: #262b36;
  --border-strong: #333a47;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --maxw: 760px;
}

* {
  box-sizing: border-box;
}

/* Suppress Chromium's default focus ring (the gold outline that pops up when a
   keypress, e.g. a Windows screenshot shortcut, flips the page into keyboard
   modality while an element is focused). Controls that need a focus cue define
   their own via border-color / box-shadow; higher-specificity :focus-visible
   rules still win if we ever want an intentional outline. */
:focus,
:focus-visible {
  outline: none;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  background-image: radial-gradient(
      1100px 600px at 50% -10%,
      rgba(88, 101, 242, 0.14),
      transparent 60%
    ),
    radial-gradient(800px 500px at 100% 0%, rgba(88, 101, 242, 0.06), transparent 55%);
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-bright);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5em;
}

code,
kbd {
  font-family: var(--font-mono);
}

/* ------------------------------------------------------------------ */
/* Top nav                                                            */
/* ------------------------------------------------------------------ */

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo .logo-mark {
  width: 1.4em;
  height: 1.4em;
  display: block;
}
.logo .accent {
  color: var(--accent-bright);
}

.topnav nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.95rem;
}
.topnav nav a {
  color: var(--fg-muted);
}
.topnav nav a:hover {
  color: var(--fg);
  text-decoration: none;
}

.btn-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff !important;
}
.btn-discord:hover {
  background: var(--accent-bright);
}
.btn-discord svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* ------------------------------------------------------------------ */
/* Layout primitives                                                  */
/* ------------------------------------------------------------------ */

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 1.25rem 4rem;
}

.hero {
  text-align: center;
  margin: 1rem 0 2rem;
}
.hero h1 {
  font-size: clamp(2rem, 6vw, 2.9rem);
  letter-spacing: -0.03em;
}
.hero .lead {
  color: var(--fg-muted);
  font-size: 1.08rem;
  max-width: 48ch;
  margin: 0 auto;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  padding: 1.4rem;
}
.card + .card {
  margin-top: 1.25rem;
}

.section-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Inputs (picker card)                                               */
/* ------------------------------------------------------------------ */

.picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.field.field--wide {
  grid-column: 1 / -1;
}
.field label {
  font-size: 0.82rem;
  color: var(--fg-muted);
  font-weight: 500;
}

input[type="date"],
input[type="time"],
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.98rem;
  padding: 0.62rem 0.7rem;
  color-scheme: dark;
}
input[type="date"]:focus,
input[type="time"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.1rem;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover {
  background: #232834;
  border-color: var(--accent);
}
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
}

.epoch-readout {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--fg-faint);
}
.epoch-readout code {
  color: var(--fg-muted);
}

/* ------------------------------------------------------------------ */
/* Format list (results)                                              */
/* ------------------------------------------------------------------ */

.ts-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ts-row {
  display: grid;
  grid-template-columns: 11.5rem 1fr auto;
  align-items: center;
  gap: 0.5rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
}
.ts-row--default {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

/* ts-info wraps the label + preview but lays them out as grid items of the
   row, so each row reads on one line: style name | value | code | copy. */
.ts-info {
  display: contents;
}
.ts-style-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--fg-muted);
  margin: 0;
  min-width: 0;
}
.ts-default-pill {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-bright);
  background: var(--accent-dim);
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
}
.ts-preview {
  font-size: 0.98rem;
  color: var(--fg);
  word-break: break-word;
  min-width: 0;
}

.ts-code-col {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: end;
}
.ts-code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--fg-muted);
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.55rem;
  white-space: nowrap;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--fg-muted);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  flex: none;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.copy-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.copy-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* "Copy all" full-width row */
.ts-copy-all {
  margin-top: 0.9rem;
  width: 100%;
  justify-content: center;
}

/* ------------------------------------------------------------------ */
/* Guide page                                                         */
/* ------------------------------------------------------------------ */

.prose p,
.prose li {
  color: var(--fg-muted);
}
.prose code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08rem 0.35rem;
  font-size: 0.9em;
  color: var(--fg);
}

table.formats {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  font-size: 0.92rem;
}
table.formats th,
table.formats td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.formats th {
  color: var(--fg-faint);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
table.formats td code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05rem 0.3rem;
}
table.formats .ex {
  color: var(--fg);
}

/* ------------------------------------------------------------------ */
/* Footer                                                             */
/* ------------------------------------------------------------------ */

footer.site-footer {
  max-width: var(--maxw);
  margin: 2rem auto 0;
  padding: 1.5rem 1.25rem 2.5rem;
  text-align: center;
  color: var(--fg-faint);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}
footer.site-footer a {
  color: var(--fg-muted);
}
footer.site-footer .disclaimer {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--fg-faint);
}

/* ------------------------------------------------------------------ */
/* Toast                                                              */
/* ------------------------------------------------------------------ */

#toast-root {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  z-index: 50;
  pointer-events: none;
}
.toast {
  background: var(--accent);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.6rem 1.05rem;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

/* ------------------------------------------------------------------ */
/* Cursor hover tip (hover-tip.js, ported from the 7x Studio app)     */
/* ------------------------------------------------------------------ */

.hover-tip {
  position: fixed;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  z-index: 20000;
  pointer-events: none;
  max-width: min(280px, calc(100vw - 24px));
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  white-space: pre-wrap;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
}
.hover-tip[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ */
/* Date / time pickers (custom, replace the native input popups)      */
/* ------------------------------------------------------------------ */

.dt-control {
  position: relative;
}

.dt-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.98rem;
  padding: 0.4rem 0.4rem 0.4rem 0.7rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.dt-trigger:hover,
.dt-trigger.open {
  border-color: var(--accent);
}
.dt-trigger.open {
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.dt-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dt-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 6px;
  color: var(--fg-muted);
  transition: background 0.12s ease, color 0.12s ease;
}
.dt-icon svg {
  width: 17px;
  height: 17px;
}
.dt-trigger:hover .dt-icon,
.dt-trigger.open .dt-icon {
  background: var(--accent);
  color: #fff;
}

/* Shared popup shell */
.dt-popup {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.6rem;
  animation: dt-pop 0.12s ease;
}
.dt-popup--above {
  top: auto;
  bottom: calc(100% + 6px);
}
.dt-popup[hidden] {
  display: none;
}
@keyframes dt-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Calendar */
.cal-popup {
  width: 268px;
}
.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.cal-title {
  font-weight: 600;
  font-size: 0.92rem;
}
.cal-nav {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--fg-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.cal-nav:hover {
  background: var(--bg-input);
  border-color: var(--border-strong);
  color: var(--fg);
}
.cal-dow-row,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-dow-row {
  margin-bottom: 4px;
}
.cal-dow {
  text-align: center;
  font-size: 0.66rem;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cal-day {
  aspect-ratio: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--fg);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}
.cal-day:hover {
  background: var(--bg-input);
  border-color: var(--border-strong);
}
.cal-day.today {
  border-color: var(--accent);
  color: var(--accent-bright);
}
.cal-day.selected,
.cal-day.selected:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.cal-day.blank {
  visibility: hidden;
  pointer-events: none;
}
.cal-foot {
  margin-top: 0.5rem;
  display: flex;
  justify-content: center;
}
.cal-today {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--fg-muted);
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 0.28rem 0.9rem;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.cal-today:hover {
  border-color: var(--accent);
  color: var(--fg);
}

/* Time picker */
.time-popup {
  width: 248px;
}
.time-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 0.4rem;
}
.time-col {
  min-width: 0;
}
.time-col-label {
  text-align: center;
  font-size: 0.66rem;
  color: var(--fg-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
/* 5 visible rows (34px each); 2-row padding top + bottom so any value -
   including the first/last - can scroll to dead-center (2 above, 2 below). */
.time-scroll {
  height: 170px;
  padding-block: 68px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.time-scroll::-webkit-scrollbar {
  width: 6px;
}
.time-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
.time-opt {
  flex: none;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}
.time-opt:hover {
  background: var(--bg-input);
}
.time-opt.selected {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.time-ampm {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}
.time-seg {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.time-seg:hover {
  border-color: var(--accent);
  color: var(--fg);
}
.time-seg.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                         */
/* ------------------------------------------------------------------ */

@media (max-width: 560px) {
  .picker-grid {
    grid-template-columns: 1fr;
  }
  .ts-row {
    grid-template-columns: 1fr;
  }
  .ts-code-col {
    justify-self: stretch;
  }
  .ts-code {
    flex: 1;
    white-space: normal;
    word-break: break-all;
  }
  .epoch-readout {
    margin-left: 0;
    width: 100%;
  }
}
