/* Zillion Design Guide 0.2.0 — preview. Pin a reviewed release before adoption. */
/* Native primitives: load tokens.css first. Layout and content belong to the consumer. */
.field {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  font-family: var(--font-body, sans-serif);
  font-size: var(--type-reading);
  line-height: 1.5;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--field-line);
  border-radius: var(--radius-field);
  transition:
    border-color var(--duration-feedback) var(--ease-standard),
    background-color var(--duration-feedback) var(--ease-standard);
}
.field[aria-invalid="true"] {
  border-color: var(--danger);
}
.field:read-only:not(select) {
  background: var(--surface);
}
.field:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.button:focus-visible {
  outline: 2px solid var(--focus-line);
  outline-offset: -2px;
}
.field:focus-visible {
  outline: none;
  border-color: var(--focus-line);
  box-shadow: inset 0 0 0 1px var(--focus-line);
}
.field[aria-invalid="true"]:focus-visible {
  border-color: var(--danger);
  box-shadow: inset 0 0 0 1px var(--danger);
}
@media (forced-colors: active) {
  .field:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
}
.button {
  box-sizing: border-box;
  line-height: 1.5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 44px;
  border-radius: var(--radius-control);
  padding: 10px 22px;
  font-size: var(--type-ui);
  font-weight: 550;
  transition:
    filter var(--duration-feedback),
    transform var(--duration-feedback);
}
@media (hover: hover) and (pointer: fine) {
  .button:hover:not(:disabled) {
    filter: brightness(1.07);
    transform: translateY(-1px);
  }
}
.button.primary,
.button.secondary {
  position: relative;
  border: 1px solid var(--module-edge);
  color: var(--ink);
  background: var(--surface-raised);
  box-shadow: none;
}
.button.primary {
  background: var(--accent-fill);
  color: var(--accent-ink);
  border-color: transparent;
}
.button:active:not(:disabled) {
  transform: scale(0.99);
}
@media (forced-colors: active) {
  .button.primary,
  .button.secondary {
    background: ButtonFace;
    color: ButtonText;
    border: 1px solid ButtonText;
  }
}

.button {
  font-family: var(--font-body, sans-serif);
  text-decoration: none;
  cursor: pointer;
}
.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
@media (prefers-reduced-motion: reduce) {
  .field,
  .button {
    transition: none;
  }
  .button:hover:not(:disabled),
  .button:active:not(:disabled) {
    transform: none;
  }
}

/* Shared selection surface: restrained translucency, clear focus, no native menu chrome. */
.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: start;
  cursor: pointer;
}
.select-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.select-trigger svg {
  flex-shrink: 0;
  transition: transform var(--duration-feedback) var(--ease-standard);
}
.select-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
.select-trigger[aria-expanded="true"] {
  border-color: var(--focus-line);
}
.select-popup {
  position: fixed;
  margin: 0;
  padding: 6px;
  box-sizing: border-box;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.1);
  font-family: var(--font-body);
  font-size: 16px;
  backdrop-filter: blur(24px);
}
.select-popup:popover-open {
  animation: select-enter var(--duration-navigation) var(--ease-standard) both;
}
.select-option {
  min-height: 44px;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  line-height: 1.5;
}
.select-option.is-active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.select-option[aria-selected="true"] {
  font-weight: 500;
}
.select-option[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
@keyframes select-enter {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .select-popup:popover-open {
    animation: none;
  }
  .select-trigger svg {
    transition: none;
  }
}
@media (forced-colors: active) {
  .select-option.is-active {
    outline: 1px solid Highlight;
  }
}

/* Soft Precision: reusable content modules, independent of the guide shell. */
.module-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font:
    400 14px/1.5 var(--font-body),
    "PingFang SC",
    sans-serif;
}
.module-card h3 {
  margin: 0;
  font:
    600 14px/1.4 var(--font-body),
    "PingFang SC",
    sans-serif;
  letter-spacing: 0;
}
.module-card p {
  margin: 0;
}
.module-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}
.module-card-head .select-trigger {
  width: 88px;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 12px;
  border-color: transparent;
  background: transparent;
}
.module-meta,
.module-footer {
  font-size: 12px;
  color: var(--muted);
}
.module-card .module-value {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.module-value small {
  font-size: 14px;
  letter-spacing: 0;
}
.module-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.module-positive {
  color: var(--success);
}
.module-action {
  color: var(--muted);
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 6px 4px;
  border-radius: 6px;
  min-height: 32px;
}
@media (hover: hover) and (pointer: fine) {
  .module-action:hover {
    color: var(--ink);
    background: var(--canvas);
  }
}
.module-action:disabled {
  opacity: 0.5;
  cursor: default;
}
.module-chart {
  width: 100%;
  height: 108px;
  overflow: visible;
}
.module-tag {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 8px;
}
.module-inbox {
  display: grid;
}
.module-message {
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr);
  gap: 10px;
  text-align: start;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--module-edge);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.module-message:last-child {
  border: 0;
}
@media (hover: hover) and (pointer: fine) {
  .module-message:hover {
    background: var(--surface-raised);
  }
}
.module-message-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}
.module-message strong,
.module-message b {
  font-size: 12px;
  font-weight: 500;
}
.module-message small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.module-unread {
  width: 5px;
  height: 5px;
  margin-top: 7px;
  background: var(--accent);
  border-radius: 50%;
}
.module-unread.is-read {
  background: transparent;
}
.module-note {
  margin: 18px 0;
  font:
    400 28px/1.25 var(--font-display),
    "Songti SC",
    serif;
  letter-spacing: -0.4px;
  flex: 1;
  overflow-wrap: anywhere;
}
.module-note-editor {
  flex: 1;
  display: grid;
  gap: 12px;
}
.module-note-editor textarea {
  font-size: 16px;
  resize: vertical;
}
.module-image-button {
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
  flex: 1;
}
.module-image-button img {
  width: 100%;
  height: 190px;
  display: block;
  object-fit: cover;
}
.module-event {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.module-event > div {
  min-width: 0;
}
.module-event .module-value {
  margin: 6px 0 10px;
}
.module-event strong {
  font-size: 13px;
}
.module-event img {
  width: 35%;
  height: 116px;
  object-fit: cover;
  border-radius: 12px;
}
.module-place,
.module-focus {
  position: relative;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
  color: var(--on-image);
}
.module-place > img,
.module-focus > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}
.module-place::after,
.module-focus::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 20%, rgba(10, 24, 27, 0.72));
  z-index: -1;
}
.module-photo-caption {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
  margin-top: auto;
  padding: 20px;
}
.module-photo-caption h3 {
  font:
    500 21px/1.3 var(--font-display),
    "Songti SC",
    serif;
}
.module-photo-caption p {
  font-size: 12px;
  margin-top: 4px;
  color: var(--on-image);
}
.module-photo-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  min-height: 36px;
  color: var(--on-image);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
@media (hover: hover) and (pointer: fine) {
  .module-photo-action:hover {
    background: rgba(0, 0, 0, 0.35);
  }
}
.module-focus > div {
  padding: 20px;
  margin-top: auto;
}
.module-focus .module-timer {
  font-size: 40px;
  font-variant-numeric: tabular-nums;
  margin: 12px 0;
  line-height: 1.2;
}
.module-tasks {
  display: grid;
  flex: 1;
}
.module-tasks label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--module-edge);
  cursor: pointer;
}
.module-tasks input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: none;
}
.module-tasks span {
  flex: 1;
  font-size: 12px;
}
.module-tasks small {
  color: var(--muted);
  font-size: 10px;
}
.module-card progress {
  width: 100%;
  height: 4px;
  accent-color: var(--accent);
}
.module-bars {
  display: flex;
  align-items: end;
  gap: 14px;
  flex: 1;
}
.module-bars > div {
  flex: 1;
  text-align: center;
}
.module-bar-track {
  height: 84px;
  display: flex;
  align-items: end;
  justify-content: center;
}
.module-bar-track span {
  display: block;
  width: 7px;
  background: var(--accent-fill);
  border-radius: 4px;
}
.module-bars small {
  font-size: 10px;
  color: var(--muted);
}
.module-dialog {
  max-width: var(--width-dialog);
  width: calc(100% - 40px);
  max-height: 85dvh;
  overflow: auto;
}
.module-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
.module-dialog h2 {
  font:
    600 24px/1.3 var(--font-body),
    sans-serif;
  margin: 12px 0;
}
.module-dialog img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 12px;
}
.module-dialog p {
  margin-top: 16px;
  line-height: 1.7;
}
.module-card button,
.module-card input {
  transition:
    background-color var(--duration-feedback) var(--ease-standard),
    color var(--duration-feedback) var(--ease-standard);
}
@media (prefers-reduced-motion: reduce) {
  .module-card * {
    transition: none !important;
    animation: none !important;
  }
}
.module-card .module-value {
  color: var(--ink);
}
.module-focus .module-timer {
  color: var(--on-image);
}
.module-card .module-footer {
  padding: 0;
  border: 0;
}
.module-card-head .select-trigger {
  width: 104px;
  gap: 6px;
}

.module-message {
  border-radius: 10px;
  padding: 12px 8px;
  margin-inline: -8px;
}
.module-message:active {
  background: var(--surface-raised);
}
.module-message:focus-visible {
  outline: 2px solid var(--focus-line);
  outline-offset: -2px;
}

/* State changes share feedback timing; geometry stays fixed. */
.module-tasks input {
  appearance: none;
  display: grid;
  place-content: center;
  margin: 0;
  border: 1px solid var(--muted);
  border-radius: 5px;
  background: transparent;
  transition:
    background-color var(--duration-feedback) var(--ease-standard),
    border-color var(--duration-feedback) var(--ease-standard);
}
.module-tasks input::before {
  content: "";
  width: 8px;
  height: 4px;
  border-left: 1.5px solid var(--accent-ink);
  border-bottom: 1.5px solid var(--accent-ink);
  transform: translateY(-1px) rotate(-45deg) scale(0);
  opacity: 0;
  transition:
    transform var(--duration-feedback) var(--ease-standard),
    opacity var(--duration-feedback) var(--ease-standard);
}
.module-tasks input:checked {
  background: var(--accent-fill);
  border-color: var(--accent-fill);
}
.module-tasks input:checked::before {
  transform: translateY(-1px) rotate(-45deg) scale(1);
  opacity: 1;
}
.module-tasks input:focus-visible {
  outline: 2px solid var(--focus-line);
  outline-offset: 2px;
}
.module-tasks input + span {
  transition: color var(--duration-feedback) var(--ease-standard);
}
.module-tasks input:checked + span {
  color: var(--muted);
}
.module-progress {
  width: 100%;
  height: 4px;
  background: var(--module-edge);
  border-radius: 4px;
  overflow: hidden;
}
.module-progress > span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  transition: transform var(--duration-enter) var(--ease-standard);
}
.module-note-editor,
.module-note {
  animation: select-enter var(--duration-navigation) var(--ease-standard);
}
@supports (transition-behavior: allow-discrete) {
  .select-popup {
    opacity: 0;
    transform: translateY(-4px);
    transition:
      opacity var(--duration-navigation) var(--ease-standard),
      transform var(--duration-navigation) var(--ease-standard),
      display var(--duration-navigation) allow-discrete,
      overlay var(--duration-navigation) allow-discrete;
  }
  .select-popup:popover-open {
    animation: none;
    opacity: 1;
    transform: translateY(0);
  }
  @starting-style {
    .select-popup:popover-open {
      opacity: 0;
      transform: translateY(-4px);
    }
  }
  .module-dialog::backdrop {
    background: rgb(0 0 0 / 0);
    transition:
      background var(--duration-feedback),
      display var(--duration-feedback) allow-discrete,
      overlay var(--duration-feedback) allow-discrete;
  }
  .module-dialog[open]::backdrop {
    background: rgb(0 0 0 / 0.45);
  }
  @starting-style {
    .module-dialog[open]::backdrop {
      background: rgb(0 0 0 / 0);
    }
  }
}
@media (prefers-reduced-motion: reduce) {
  .module-tasks input::before,
  .module-progress > span,
  .module-dialog::backdrop,
  .select-popup {
    animation: none !important;
    transition: none !important;
  }
}
@media (forced-colors: active) {
  .module-tasks input {
    appearance: auto;
  }
  .module-tasks input::before {
    display: none;
  }
  .module-progress > span {
    background: Highlight;
  }
}

/* Shared by modules, specimens, forms and dialogs. Layout stays with its owner. */
.surface-panel {
  padding: var(--module-padding);
  border: 1px solid var(--module-edge);
  border-radius: var(--radius-panel);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--module-shadow);
}

/* Image-backed cards keep content contrast independent of the page theme. */
.surface-panel:is(.module-place, .module-focus) {
  color: var(--on-image);
}

.button.primary:focus-visible {
  outline-color: var(--accent-ink);
}
