/* ==================================================================
   07 — Automation ("Don't repeat yourself.")
   Everything is scoped under #automation / .au-*
   ================================================================== */
#automation {
  max-width: 100vw;
  padding: 224px 24px;
  overflow-x: hidden;
}
#automation .au-container {
  max-width: 1204px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 48px;
}
#automation .au-title { max-width: 510px; margin: 0 auto; }

#automation .au-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "top top" "left right";
  gap: 40px;
}

/* ---------- card shell ---------- */
#automation .au-card {
  position: relative;
  background: linear-gradient(45deg, var(--grey-800) 0%, var(--grey-900) 100.67%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
#automation .au-desc {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
}
#automation .au-desc > h5 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: #fff;
  font-size: 18px;
  font-weight: 400;
  line-height: normal;
  letter-spacing: 0.2px;
}
#automation .au-desc > h5 > svg { width: 24px; height: 24px; flex: none; }
#automation .au-desc > p {
  color: var(--grey-200);
  font-size: 14px;
  font-weight: 500;
  line-height: 160%;
  letter-spacing: 0.2px;
}

/* ================= Snippets (top) ================= */
#automation .au-top-wrap { grid-area: top; position: relative; z-index: 0; }
#automation .au-glow {
  position: absolute;
  inset: -13px 24px;
  z-index: -1;
  filter: blur(37.5px);
  pointer-events: none;
}
#automation .au-glow::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 50% 12%, 100% 0, 94% 50%, 100% 100%, 50% 88%, 0 100%, 6% 50%);
  background: radial-gradient(95% 60% at 25% 45%, rgba(154, 170, 255, 0) 20%, rgba(154, 170, 255, 0.1) 100%);
}
#automation .au-top {
  height: 218px;
  display: grid;
  grid-template-columns: minmax(0, 556px) minmax(0, 1fr);
  padding: 0 16px 16px 0;
}
#automation .au-top .au-desc { max-width: 420px; grid-column: 1; grid-row: 1; }

#automation .au-glass {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  width: 720px;
  height: 100%;
  opacity: 0.9;
  pointer-events: none;
  display: block;
  max-width: none;
}

#automation .au-snip-stage {
  position: relative;
  z-index: 1;
  grid-column: 2;
  grid-row: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 16px;
  min-width: 0;
}
#automation .au-composer {
  width: 459px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 17px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(137deg, rgba(17, 18, 20, 0.75) 4.87%, rgba(12, 13, 15, 0.9) 75.88%);
  -webkit-backdrop-filter: blur(15px);
          backdrop-filter: blur(15px);
  box-shadow: 0 7px 3px rgba(0, 0, 0, 0.03), 0 4px 4px rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  line-height: 160%;
  letter-spacing: 0.2px;
  user-select: none;
  -webkit-user-select: none;
  transform: translateY(-12px);
}
#automation .au-composer > p + p { margin-top: 19px; margin-bottom: 29px; }
#automation .au-line { position: relative; }
#automation .au-completion { position: relative; opacity: 0; transition: opacity 0.25s ease; }
#automation .au-completion-text {
  color: #8cd6ff;
  background: linear-gradient(90deg, rgba(86, 194, 255, 0.16) 1.41%, rgba(86, 194, 255, 0.06) 98.59%);
  -webkit-box-decoration-break: clone;
          box-decoration-break: clone;
}
#automation .au-input { position: absolute; top: 0; left: 0; transition: opacity 0.12s ease; }
#automation .au-line.is-expanded .au-completion { opacity: 1; }
#automation .au-line.is-expanded .au-input { opacity: 0; }
#automation .au-line:not(.is-expanded) .au-completion .au-caret { visibility: hidden; }
#automation .au-caret { position: relative; }
#automation .au-caret::before {
  content: "|";
  color: var(--grey-200);
  font-weight: 400;
  animation: au-blink 1.1s step-end infinite;
}
@keyframes au-blink { 50% { opacity: 0; } }

#automation .au-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#automation .au-emoji {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  box-shadow: 0 7px 3px rgba(0, 0, 0, 0.03), 0 4px 4px rgba(0, 0, 0, 0.25);
  cursor: default;
}
#automation .au-emoji[data-state="restart"] { cursor: pointer; }
#automation .au-emoji > svg {
  width: 14px;
  height: 14px;
  transition: opacity 0.3s ease-in-out, transform 0.5s ease-in-out;
}
#automation .au-emoji .au-i-restart { position: absolute; opacity: 0; transform: rotate(30deg); }
#automation .au-emoji[data-state="restart"] .au-i-emoji { opacity: 0; }
#automation .au-emoji[data-state="restart"] .au-i-restart { opacity: 1; transform: rotate(0); }
#automation .au-send {
  padding: 2px 12px;
  border-radius: 4px;
  line-height: 160%;
  cursor: default;
}
#automation .au-send.is-pressed { transform: scale(0.95); }

/* ================= Quicklinks (left) ================= */
#automation .au-left {
  grid-area: left;
  display: flex;
  flex-direction: column;
}
#automation .au-left .au-desc { max-width: 399px; }
#automation .au-ql-shot {
  align-self: flex-end;
  width: 558px;
  max-width: calc(100% - 24px);
  height: 208px;
  padding-top: 24px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(179deg, #000 73.71%, transparent 91.16%);
          mask-image: linear-gradient(179deg, #000 73.71%, transparent 91.16%);
}
#automation .au-ql-window {
  height: 100%;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-right: 0;
  border-bottom: 0;
  border-radius: 12px 0 0 0;
  background: linear-gradient(180deg, #0f1012 0%, #0e0f11 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
#automation .au-ql-search {
  height: 55px;
  display: flex;
  align-items: center;
  padding: 0 15px;
  background: #0a0b0d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.1px;
}
#automation .au-ql-caret {
  width: 1.5px;
  height: 19px;
  margin-left: 1px;
  background: #e6e6e6;
  animation: au-blink 1.1s step-end infinite;
}
#automation .au-ql-results { padding: 14px 0 0 8px; }
#automation .au-ql-heading {
  padding: 0 8px 7px;
  color: var(--grey-300);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 18px;
}
#automation .au-ql-row {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 9px;
  border-radius: 8px 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1px;
  transition: opacity 0.35s ease, transform 0.35s var(--ease-out), background-color 0.25s ease;
}
#automation .au-ql-row.is-selected { background: rgba(255, 255, 255, 0.075); }
#automation .au-ql-icon { width: 16px; height: 16px; flex: none; margin-right: 12px; }
#automation .au-ql-title { color: #e6e6e6; margin-right: 11px; }
#automation .au-ql-sub { color: var(--grey-300); }
#automation .au-ql-row:not(.is-selected) .au-ql-title { color: var(--grey-200); }
#automation .au-ql-row:not(.is-selected) .au-ql-sub { color: var(--grey-400); }
#automation .au-ql-results.is-empty .au-ql-row,
#automation .au-ql-results.is-empty .au-ql-heading { opacity: 0; transform: translateY(4px); }
#automation .au-ql-heading { transition: opacity 0.3s ease, transform 0.3s ease; }

/* ================= Hotkeys (right) ================= */
#automation .au-right {
  grid-area: right;
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: minmax(0, 1fr);
}
#automation .au-hk-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 206.4px;
  pointer-events: none;
  user-select: none;
}
#automation .au-hk-combo {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  height: 106px;
  transform-origin: 50% 50%;
}
#automation .au-hk-combo.is-enter { opacity: 0; transform: translateY(10px) scale(0.97); }
#automation .au-hk-combo.is-shown {
  opacity: 1;
  transform: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.22, 0.96), transform 0.3s cubic-bezier(0.4, 0, 0.22, 0.96);
}
#automation .au-hk-combo.is-exit {
  opacity: 0;
  transform: scale(0.97) translateY(-5px);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.22, 0.96), transform 0.3s cubic-bezier(0.4, 0, 0.22, 0.96);
}
#automation .au-hk-plus {
  display: flex;
  align-items: center;
  height: 100%;
  font-size: 22px;
  color: #fff;
  opacity: 0.5;
}
#automation .au-key {
  position: relative;
  flex: none;
  width: 110px;
  height: 100%;
  display: grid;
  grid-template-rows: 1fr 1fr;
  padding: 14.5px 15px;
  border-radius: 11px;
  color: #fff;
  font-size: 23.75px;
  font-weight: 500;
  line-height: 1.2;
  text-shadow: 0 0.5px 0.5px rgba(0, 0, 0, 0.1);
  background: radial-gradient(75% 75% at 50% 91.9%, #121212 0%, #0d0d0d 100%);
  box-shadow:
    0 1.5px 0.5px 2.5px rgba(0, 0, 0, 0.4),
    0 0 0.5px 1px #000,
    inset 0 2px 1px 1px rgba(0, 0, 0, 0.25),
    inset 0 1px 1px 1px rgba(255, 255, 255, 0.2);
  transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.2s cubic-bezier(0.23, 1, 0.32, 1), background 0.3s ease;
}
#automation .au-key.is-wide { width: 138.5px; }
#automation .au-key.is-pressed {
  transform: translateY(2px);
  background: radial-gradient(75% 75% at 50% 91.9%, #151515 0%, #0d0d0d 100%);
  box-shadow:
    0 0 0 transparent,
    0 0 0.5px 1px #000,
    inset 0 2px 1px 1px rgba(0, 0, 0, 0.25),
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.15);
}
#automation .au-key-alt {
  grid-row: 1;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  color: #d8d8d8;
}
#automation .au-key-alt svg { width: 23px; height: 21px; }
#automation .au-key-main {
  grid-row: 2;
  display: flex;
  align-items: flex-end;
  white-space: nowrap;
}
#automation .au-key-main svg { width: 20px; height: 20px; color: #d8d8d8; margin-bottom: 2px; }
#automation .au-key-main.is-center {
  grid-row: 1 / span 2;
  justify-content: center;
  align-items: center;
  font-size: 32px;
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  #automation .au-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 860px) {
  #automation { padding: 168px 20px; }
  #automation .au-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "left" "right"; gap: 24px; }
  #automation .au-top { height: auto; grid-template-columns: minmax(0, 1fr); padding: 0 0 16px; }
  #automation .au-top .au-desc { grid-row: 2; padding-top: 24px; max-width: none; }
  #automation .au-snip-stage { grid-column: 1; grid-row: 1; }
  /* stacked layout: the key row of the artwork would sit behind the description */
  #automation .au-top .au-keys { display: none; }
  #automation .au-composer { transform: none; }
  #automation .au-glass { width: 100%; }
  #automation .au-hk-combo { transform: scale(0.8); }
  #automation .au-hk-combo.is-enter { transform: translateY(10px) scale(0.78); }
  #automation .au-hk-combo.is-shown { transform: scale(0.8); }
  #automation .au-hk-combo.is-exit { transform: scale(0.78) translateY(-5px); }
}
@media (max-width: 520px) {
  #automation .au-composer { padding: 16px 16px 14px; font-size: 15px; }
  #automation .au-hk-stage { min-height: 170px; }
  #automation .au-hk-combo,
  #automation .au-hk-combo.is-shown { transform: scale(0.62); }
  #automation .au-hk-combo.is-enter { transform: translateY(10px) scale(0.6); }
  #automation .au-hk-combo.is-exit { transform: scale(0.6) translateY(-5px); }
}

@media (prefers-reduced-motion: reduce) {
  #automation .au-caret::before,
  #automation .au-ql-caret { animation: none; }
  #automation .au-hk-combo.is-shown,
  #automation .au-hk-combo.is-exit { transition: none; }
}
