/* ==========================================================================
   KUTAY OS — System settings
   A grid of preference cards. Metrics follow the original's final System
   page (large title, 2-column cards, separated switch rows); controls get
   full interactive states and purposeful motion (sliding segment
   indicator, springy switches, a staggered entrance).
   ========================================================================== */

.system-page { padding: var(--space-6); }
.system-intro { display: grid; gap: 12px; padding: 12px 4px 22px; }
.system-intro > * { margin: 0; }
.system-kicker { font-size: 9px; letter-spacing: .18em; color: var(--text-dim); text-transform: uppercase; }
.system-intro h1 { font-size: 44px; font-weight: 700; letter-spacing: -.05em; line-height: 1.05; }
.system-intro p { font-size: 14px; line-height: 1.6; color: var(--text-muted); }

.system-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); align-items: stretch; }
.system-card {
  display: flex; flex-direction: column; gap: var(--space-3); min-width: 0;
  border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: var(--space-5); background: rgba(255, 255, 255, .025);
  transition: border-color var(--dur-base), background var(--dur-base);
}
.system-card:hover { border-color: var(--line); background: rgba(255, 255, 255, .035); }
.system-card h2 { font-size: 16px; font-weight: 600; margin: 0; }
.system-card p { margin: 0; font-size: 13.5px; color: var(--text-muted); line-height: 1.6; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.system-card .btn { cursor: pointer; transition: filter var(--dur-fast), transform var(--dur-fast); }
.system-card .btn:active { transform: scale(.97); }
.system-card .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.system-card .hint { font-size: 12px; color: var(--text-dim); }
kbd { font: 11px/1.4 var(--font-mono); background: rgba(255, 255, 255, .08); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--text); white-space: nowrap; }

.system-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 44px; font-size: 14px; }
.system-select {
  min-height: 38px; padding: 0 32px 0 12px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b929e' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 13px;
  color: var(--text); font: inherit; font-size: 13px; appearance: none; -webkit-appearance: none; cursor: pointer; transition: border-color var(--dur-fast);
}
.system-select:hover { border-color: color-mix(in srgb, var(--text) 30%, transparent); }
.system-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- Segmented control with a sliding indicator ---- */
.segmented { position: relative; display: inline-flex; align-self: flex-start; max-width: 100%; padding: 3px; gap: 2px; border-radius: 11px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line-2); isolation: isolate; }
.segmented::before {
  content: ""; position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 0; width: var(--seg-w, 0); border-radius: 8px;
  background: var(--accent); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
  transform: translateX(var(--seg-x, 0)); opacity: 0; transition: transform .32s cubic-bezier(.3, 1.3, .5, 1), width .32s cubic-bezier(.3, 1.3, .5, 1);
}
.segmented.has-value::before { opacity: 1; }
.segmented button {
  min-height: 36px; padding: 0 16px; border-radius: 8px; border: 0; background: transparent; color: var(--text-muted);
  font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: color var(--dur-base);
}
.segmented button:hover:not(.on) { color: var(--text); background: rgba(255, 255, 255, .05); }
.segmented button.on { color: var(--accent-ink); }
.segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Switch rows (the whole row is the click target) ---- */
.switch-list { display: flex; flex-direction: column; }
.switch-row { cursor: pointer; padding: 4px 0; border-bottom: 1px solid var(--line-2); }
.switch-row:last-child { border-bottom: 0; }
.switch-row:hover > span:first-child { color: var(--text); }
.switch-row > span:first-child { color: color-mix(in srgb, var(--text) 88%, transparent); transition: color var(--dur-fast); }
.setting-switch { position: relative; display: inline-flex; flex-shrink: 0; }
.setting-switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.setting-switch .track { position: relative; display: block; width: 42px; height: 26px; border-radius: 26px; background: rgba(255, 255, 255, .16); transition: background var(--dur-base); }
.setting-switch .knob {
  position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 20px; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
  transition: transform .3s cubic-bezier(.3, 1.4, .5, 1), width var(--dur-fast) var(--ease-out);
}
.setting-switch input:checked ~ .track { background: var(--accent); }
.setting-switch input:checked ~ .track .knob { transform: translateX(16px); }
.switch-row:active .knob { width: 24px; }
.switch-row:active .setting-switch input:checked ~ .track .knob { transform: translateX(12px); }
.setting-switch input:focus-visible ~ .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.keyboard-list { display: flex; flex-direction: column; margin: 0; }
.keyboard-list > div { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 40px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.keyboard-list > div:last-child { border-bottom: 0; }
.keyboard-list dt { color: color-mix(in srgb, var(--text) 88%, transparent); }
.keyboard-list dd { margin: 0; }

.realm-card { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.realm-card > div { display: grid; gap: 4px; min-width: 0; flex: 1 1 320px; }
.realm-card .btn span { display: inline-block; transition: transform var(--dur-base) var(--ease-out); }
.realm-card .btn:hover span { transform: translateX(3px); }

.system-grid.is-entering .system-card { animation: cardRise .5s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes cardRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) { .system-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .system-page { padding: var(--space-4); }
  .system-intro h1 { font-size: 36px; }
  .system-card { padding: var(--space-4); }
  .segmented { align-self: stretch; }
  .segmented button { flex: 1 1 0; padding: 0 8px; min-height: 40px; }
  .realm-card .btn { width: 100%; }
}
/* Touch-only devices have no keyboard shortcuts to show. */
@media (hover: none) and (pointer: coarse) { .system-card .hint, .system-card:has(.keyboard-list) { display: none; } }
/* Desktop wallpaper picker */
.wall-card { grid-column: 1 / -1; }
.wall-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.wall-picker button { display: flex; flex-direction: column; gap: 7px; padding: 6px; border-radius: 12px; border: 1px solid var(--line-2); background: transparent; color: var(--text-muted); font: 600 12px var(--font-sans); cursor: pointer; text-align: left; transition: border-color .2s, color .2s, transform .2s; }
.wall-picker button:hover { transform: translateY(-2px); color: var(--text); }
.wall-picker button.on { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 2px var(--accent) inset; }
@media (max-width: 760px) { .wall-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.wall-picker { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 900px) { .wall-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card-actions .btn-danger { color: #ffb3a8; border-color: rgba(255, 138, 122, .35); }
.card-actions .btn-danger:hover { background: rgba(255, 138, 122, .1); border-color: rgba(255, 138, 122, .6); }
