/* ==========================================================================
   WIZKET — sw-type.css · "Type your system" (Software page, #type)
   A textarea with a highlight layer behind it (matched words turn orange) and an
   app window that builds itself from the modules found. The window is always
   dark (it's a screen). js/sw-type.js. Prefix: ty-
   ========================================================================== */
.ty {
  --side: clamp(20px, 6vw, 110px);
  position: relative;
  padding: clamp(90px, 14vh, 160px) var(--side);
  background:
    radial-gradient(50% 60% at 78% 50%, var(--petrol) 0%, transparent 70%),
    var(--bg);
}
.ty__inner {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: center;
  gap: clamp(36px, 5vw, 80px);
}
.ty__title {
  margin: 0;
  font: 400 clamp(2.4rem, min(5vw, 9.4vh), 5.4rem)/0.92 var(--font-display);
  text-transform: uppercase;
  color: var(--text);
}
.ty__title .is-outline { display: block; }

/* ---- the field: textarea over a mirrored highlight layer ---- */
.ty__field {
  position: relative;
  margin-top: clamp(22px, 4vh, 36px);
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line2);
  box-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.5);
  transition: border-color 0.3s var(--ease-io), box-shadow 0.3s var(--ease-io);
}
.ty__field:focus-within { border-color: var(--text); box-shadow: 0 0 0 4px var(--accent-soft), 0 24px 50px -30px rgba(0, 0, 0, 0.5); }
.ty__back, .ty__input {
  display: block;
  width: 100%;
  min-height: 132px;
  margin: 0;
  padding: 20px 22px;
  border: 0;
  font: 500 clamp(1.05rem, 1.35vw, 1.25rem)/1.5 var(--font-body);
  letter-spacing: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}
.ty__back { position: absolute; inset: 0; color: var(--text); pointer-events: none; overflow: hidden; }
.ty__back mark {
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.ty__input {
  position: relative;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--accent);
  outline: none;
}
.ty__input::placeholder { color: var(--muted); }
.ty__input::selection { background: var(--accent-soft); color: transparent; }

.ty__hint { margin: 12px 0 0; font: 500 13.5px/1.5 var(--font-body); color: var(--muted); }
.ty__hint b { font-weight: 600; color: var(--text); }
.ty__end { margin-top: clamp(22px, 3.6vh, 32px); display: flex; flex-wrap: wrap; align-items: center; gap: 16px 26px; }
.ty__meter { margin: 0; font: 500 14.5px/1.4 var(--font-body); color: var(--muted); }
.ty__meter b { font: 400 26px/1 var(--font-display); color: var(--text); vertical-align: -3px; }
.ty__meter i { font-style: normal; margin: 0 4px; }
.ty__meter small { display: block; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.7; }

/* ---- the app window ---- */
.ty-win {
  height: clamp(420px, 62vh, 540px);
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: #0f1417;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 50px 100px -40px rgba(0, 0, 0, 0.7);
  color: #e6ecef;
  font-family: var(--font-body);
}
.ty-win__bar { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; flex-shrink: 0; background: #151c20; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.ty-win__bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.ty-win__bar i:nth-child(2) { background: #febc2e; }
.ty-win__bar i:nth-child(3) { background: #28c840; }
.ty-win__bar span { margin-left: 14px; font: 600 14px/1 var(--font-body); color: #c3ccd1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ty-win__bar span.is-swap { animation: ty-swap 0.5s var(--ease-out); }
@keyframes ty-swap { from { opacity: 0; transform: translateY(8px); } }
.ty-win__body { flex: 1; min-height: 0; display: grid; grid-template-columns: 28% 1fr; }
.ty-win__side { margin: 0; padding: 16px 12px; list-style: none; display: grid; align-content: start; gap: 4px; background: #121a1e; border-right: 1px solid rgba(255, 255, 255, 0.05); }
.ty-win__side li { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 8px; font: 600 13.5px/1 var(--font-body); color: #9aa6ad; }
.ty-win__side li::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; opacity: 0.6; }
.ty-win__side .ty-win__home { color: #fff; background: rgba(255, 255, 255, 0.07); }
.ty-win__side li.is-new { animation: ty-in 0.6s var(--ease-out); }
.ty-win__side li.is-new::before { background: var(--accent); opacity: 1; }
@keyframes ty-in { from { opacity: 0; transform: translateX(-12px); } }
.ty-win__main { position: relative; min-height: 0; padding: 16px; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(150px, auto); align-content: start; gap: 12px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2b343a transparent; }
.ty-win__empty {
  grid-column: 1 / -1;
  align-self: center;
  margin: 0;
  padding: 50px 20px;
  border: 1.5px dashed rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  text-align: center;
  font: 500 14px/1.4 var(--font-body);
  color: #6c7a82;
}

/* ---- module cards (widgets are generic shapes filled with each module's data) ---- */
.ty-mod {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 13px;
  background: #161e23;
  border: 1px solid rgba(255, 255, 255, 0.07);
  min-width: 0;
}
.ty-mod.is-wait { visibility: hidden; }
.ty-mod.is-wide { grid-column: 1 / -1; }
.ty-mod__h { display: flex; align-items: center; justify-content: space-between; margin: 0; font: 700 14px/1 var(--font-body); color: #fff; }
.ty-mod__h em { font: 600 10px/1 var(--font-body); font-style: normal; letter-spacing: 0.14em; text-transform: uppercase; color: #7ee2a8; }
.ty-w { flex: 1; min-height: 0; font: 500 11.5px/1.2 var(--font-body); color: #b9c3c8; }

.ty-w--board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ty-w--board div { display: grid; align-content: start; gap: 5px; padding: 6px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.ty-w--board b { font: 700 9.5px/1 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: #7d8a91; }
.ty-w--board span { padding: 6px 7px; border-radius: 6px; background: #1f292f; color: #dfe6ea; font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ty-w--table, .ty-w--list { display: grid; align-content: start; gap: 6px; }
.ty-w--table p, .ty-w--list p { display: flex; justify-content: space-between; gap: 10px; margin: 0; padding: 7px 9px; border-radius: 7px; background: rgba(255, 255, 255, 0.04); }
.ty-w--table p b { color: #fff; font-weight: 700; }
.ty-w--list p em { padding: 3px 7px; border-radius: 999px; background: rgba(46, 204, 113, 0.14); color: #7ee2a8; font-style: normal; font-size: 10px; font-weight: 700; white-space: nowrap; }
.ty-w--list p em.is-warn { background: rgba(253, 95, 7, 0.16); color: #ff9a5c; }

.ty-w--chart { display: flex; align-items: flex-end; gap: 5px; min-height: 80px; }
.ty-w--chart i { flex: 1; height: calc(var(--v) * 100%); border-radius: 3px 3px 1px 1px; background: linear-gradient(180deg, #5fb3c4, rgba(95, 179, 196, 0.2)); animation: ty-grow 0.9s var(--ease-out) both; transform-origin: 50% 100%; }
.ty-w--chart i:last-child { background: var(--accent); }
@keyframes ty-grow { from { transform: scaleY(0); } }

.ty-w--cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; align-content: start; }
.ty-w--cal i { aspect-ratio: 1; border-radius: 5px; background: rgba(255, 255, 255, 0.05); }
.ty-w--cal i.is-on { background: #2b6f80; }
.ty-w--cal i.is-hot { background: var(--accent); }

.ty-w--grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; align-content: start; }
.ty-w--grid span { display: grid; place-items: center; padding: 8px 0; border-radius: 7px; background: rgba(46, 204, 113, 0.14); color: #7ee2a8; font-weight: 700; font-size: 10.5px; }
.ty-w--grid span.is-busy { background: rgba(255, 255, 255, 0.06); color: #8b979e; }
.ty-w--grid span.is-hot { background: rgba(253, 95, 7, 0.18); color: #ff9a5c; }

/* the chip that peels off a word and flies into the window */
.ty-fly {
  position: fixed;
  z-index: 60;
  left: 0;
  top: 0;
  padding: 7px 12px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font: 700 13px/1 var(--font-body);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 16px 30px -12px rgba(253, 95, 7, 0.7);
}

@media (max-width: 899px) {
  .ty__inner { grid-template-columns: 1fr; }
  .ty-win { height: 460px; }
  .ty-win__body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .ty-win__side { display: flex; gap: 4px; overflow-x: auto; padding: 10px; border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); scrollbar-width: none; }
  .ty-win__side li { flex: 0 0 auto; }
  .ty-win__main { grid-template-columns: 1fr; }
}
