/*
 * hyd-time-machine.css
 *
 * Time machine window (hyd-time-machine.js). Styles the archive clock on the desktop: the year readout and year
 * buttons, the preview card with its kind badge and play mark, the caption, the action buttons and the status
 * strip, and where the window sits at desktop, tablet and phone widths. Colours come from the --paper-*,
 * --metal-* and --selected-* tokens that hyd-theme.css sets for each wallpaper theme; the hex value after each
 * token is its fallback.
 */

/* The archive clock belongs to the same Aqua window system as the desktop. */
#home #desk-time-machine {
  top: 140px;
  left: auto;
  right: 10%;
  width: 340px;
  border-radius: 8px 8px 4px 4px;
  rotate: 0deg;
}

/* --- Window body and year dial --- */
.time-machine-body {
  padding: 12px;
  color: var(--paper-text,#e6f3f6);
  font:
    calc(12 * var(--px))/1.4 Tahoma,
    sans-serif;
}

.time-machine-dial {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 0 12px;
}

/* Bigger text (see --px in hyd-platform.css): the year buttons move under the year display when both do not fit. */
@container not style(--px: 1px) {
  .time-machine-dial {
    flex-wrap: wrap;
  }
}

/* The year readout. Tabular digits keep its width steady while the year changes. */
.time-machine-year {
  display: block;
  padding: 5px 9px;
  border: 1px solid var(--paper-edge,#56727c);
  border-radius: 5px;
  background: linear-gradient(#061118 49%, #31414b 50%, #09151d 53%);
  box-shadow:
    inset 0 2px 5px #0008,
    0 1px #fff2;
  color: #f1f9fc;
  font:
    500 calc(27 * var(--px))/1.2 'IBM Plex Mono',
    monospace;
  letter-spacing: 1px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* --- Year buttons --- */
/* 6 Oct 2026: an even grid of separate buttons beside the year display; columns are set from the number of years. */
.time-machine-years {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 228px;
  display: grid;
  grid-template-columns: repeat(var(--year-columns,3),minmax(0,1fr));
  gap: 4px;
}

.time-machine-years button {
  margin: 0;
  border: 1px solid var(--paper-edge,#627583);
  border-radius: 5px;
  background: var(--paper-inset,#122a36);
  color: var(--paper-text,#e6f3f6);
  padding: 6px 4px;
  font:
    calc(11 * var(--px)) Tahoma,
    sans-serif;
  min-height: 32px;
}

/* The year currently shown; hyd-time-machine.js sets aria-pressed on it. */
.time-machine-years button[aria-pressed='true'] {
  position: relative;
  z-index: 1;
  background: linear-gradient(var(--selected-top,#87d3e4),var(--selected-mid,#236a8e) 48%,var(--selected-end,#6babc8));
  color: var(--paper-text,#fff);
  text-shadow: 0 1px 2px #000;
  box-shadow: inset 0 1px #ffffff66;
  border-color: var(--paper-accent,#a1dbe5);
}

/* --- Preview card --- */
.time-machine-preview {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  padding: 0;
  border: 1px solid var(--paper-edge,#56727c);
  border-radius: 3px;
  overflow: hidden;
  background: #04090b;
  color: #fff;
}

.time-machine-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.time-machine-preview-kind {
  position: absolute;
  left: 7px;
  top: 7px;
  background: #071018cb;
  color: #fff;
  border-radius: 3px;
  padding: 3px 6px;
  font:
    calc(9 * var(--px))/1.2 Tahoma,
    sans-serif;
}

.time-machine-preview-play {
  position: absolute;
  inset: auto 9px 9px auto;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding-left: 2px;
  border: 1px solid #e4faff99;
  border-radius: 50%;
  background: linear-gradient(#ebf9ffbb, #34596ddb 55%, #172e3ad9);
  color: white;
  text-shadow: 0 1px #071018;
  box-shadow: 0 2px 4px #0008;
}

/* --- Caption, actions and status strip --- */
.time-machine-caption {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 1px 12px;
  min-height: 61px;
}

.time-machine-caption strong {
  font-size: calc(14 * var(--px));
  font-weight: 600;
  line-height: 1.3;
}

.time-machine-caption > span {
  font-size: calc(11 * var(--px));
  color: var(--paper-muted,#bfd1d9);
}

.time-machine-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.time-machine-actions button {
  font:
    calc(11 * var(--px))/1.3 Tahoma,
    sans-serif;
  min-height: 34px;
  border: 1px solid var(--paper-edge,#56727c);
  border-radius: 6px;
  padding: 6px;
  background: linear-gradient(var(--metal-top,#ddeaf0),var(--metal-mid,#a8bac5) 45%,var(--metal-end,#7e949f) 55%,var(--metal-mid,#b7c8d1));
  color: var(--metal-ink,#122c39);
  box-shadow:
    inset 0 1px #ffffff80,
    0 1px 2px #0004;
}

.time-machine-actions button:active {
  box-shadow: inset 0 1px 4px #0008;
}

.time-machine-status {
  margin: 11px -12px -12px;
  padding: 6px 10px;
  border-top: 1px solid var(--paper-edge,#456677);
  color: var(--paper-muted,#bfd1d9);
  font-size: calc(10 * var(--px));
  background: var(--paper-inset,#102431);
}

/* Keyboard focus ring for every button and link in the window. */
#desk-time-machine :is(button, a):focus-visible {
  outline: 2px solid var(--paper-accent,#b4e8f4);
  outline-offset: 3px;
}

/* --- Responsive layout and motion --- */
@media (min-width: 901px) {
  /*
   * Wide screens: a little more room between the desktop shortcut icons, which include the time machine icon
   * that hyd-time-machine.js adds.
   */
  #home .desktop-icons {
    gap: 8px;
  }

  #home .desktop-icons > button {
    min-height: 60px;
  }
}

@media (max-width: 900px) and (min-width: 621px) {
  /* Tablet widths: the window sits a little lower, closer to the right edge and narrower. */
  #home #desk-time-machine {
    top: 175px;
    right: 4%;
    width: 320px;
  }
}

@media (max-width: 620px) {
  /*
   * Phone widths: extra top padding on the desktop, and the window is no longer placed freely; it becomes a
   * full-width block ordered first (order -1).
   */
  #home .portal-collage .web-desktop {
    padding-top: 365px;
  }

  #home #desk-time-machine {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    width: 100%;
    max-width: 100%;
    order: -1;
    margin: 0;
    rotate: 0deg;
  }

  .time-machine-preview {
    aspect-ratio: 16/9;
  }

  .time-machine-years button {
    min-height: 36px;
    padding: 7px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Reduced motion and the motion-off setting: no transition on the shortcut icon. */
  .time-machine-shortcut svg {
    transition: none;
  }
}

.motion-off .time-machine-shortcut svg {
  transition: none;
}
