/* Easter-egg profile (staff/member.php?id=dylan): the whole page drawn as a code editor. */

:root {
  --ed-deep: #071517;
  --ed-chrome: #0A1B1E;
  --ed-side: #0B2023;
  --ed-bg: #0E2427;
  --ed-pop: #12302F;
  --ed-rule: rgba(191, 221, 218, 0.10);
  --ed-line-hl: rgba(191, 221, 218, 0.06);
  --ed-text: #D3E2E3;
  --ed-muted: #93ACB0;
  --ed-punct: #8EA7AB;
  --ed-gutter: #5E7B80;
  --ed-gutter-hl: #BFDDDA;
  --ed-comment: #A3B9BC;
  --ed-keyword: #FFD74B;
  --ed-prop: #E8F4F2;
  --ed-string: #9FE3CF;
  --ed-type: #5FD0C9;
  --ed-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --ed-ui: 'Source Sans Pro', 'Lato', sans-serif;
  --ed-gutter-w: 5ch;
  --ed-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

body {
  background: var(--ed-deep);
}

.ide {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ed-bg);
  color: var(--ed-text);
  font-family: var(--ed-ui);
}

.ide ::selection {
  background: rgba(255, 215, 75, 0.32);
  color: var(--white);
}

.ide a:focus-visible,
.ide button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

.ts-badge {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: #3178C6;
  color: var(--white);
  font-family: var(--ed-ui);
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1;
}

/* ---------- Title bar + menus ---------- */
.ide-titlebar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 10px 0 6px;
  background: var(--ed-deep);
  border-bottom: 1px solid var(--ed-rule);
}

.ide-logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
}

.ide-menubar ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ide-menu {
  position: relative;
  margin: 0;
  font-size: inherit;
}

.ide-menu__button {
  padding: 5px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ed-text);
  font-size: 14px;
  line-height: 1.4;
  transition: background-color 120ms linear;
}

.ide-menu__button:hover,
.ide-menu__button[aria-expanded="true"] {
  background: rgba(191, 221, 218, 0.12);
  color: var(--white);
}

.ide-menu__list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  min-width: 280px;
  max-width: calc(100vw - 24px);
  padding: 5px;
  border: 1px solid var(--ed-rule);
  border-radius: 8px;
  background: var(--ed-pop);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  animation: ide-pop 160ms var(--ed-ease);
  transform-origin: top left;
}

@keyframes ide-pop {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
}

.ide-menu__list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 32px;
  padding: 6px 12px;
  border-radius: 5px;
  color: var(--ed-text);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

.ide-menu__list a:hover,
.ide-menu__list a:focus-visible {
  background: var(--teal);
  color: var(--white);
  outline: none;
}

.ide-menu__path {
  color: var(--ed-gutter);
  font-family: var(--ed-mono);
  font-size: 11.5px;
}

.ide-menu__list a:hover .ide-menu__path,
.ide-menu__list a:focus-visible .ide-menu__path {
  color: var(--primary-light);
}

.ide-menu__list hr {
  margin: 5px 8px;
  border: 0;
  border-top: 1px solid var(--ed-rule);
  opacity: 1;
}

.ide-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--ed-muted);
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ide-titlebar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.ide-login {
  color: var(--ed-muted);
  font-size: 14px;
  text-decoration: none;
}

.ide-login:hover {
  color: var(--white);
}

.ide-contact {
  padding: 5px 14px;
  border-radius: 5px;
  background: var(--yellow);
  color: var(--black);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 160ms linear;
}

.ide-contact:hover {
  background: var(--yellow-light);
  color: var(--black);
}

/* Window controls: minimize and close go back to the staff list, maximize toggles full screen */
.ide-window {
  display: flex;
  margin-left: 2px;
}

.ide-window__btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ed-muted);
  text-decoration: none;
  transition: background-color 120ms linear, color 120ms linear;
}

.ide-window__btn[hidden] {
  display: none;
}

.ide-window__btn svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.ide-window__btn:hover {
  background: rgba(191, 221, 218, 0.12);
  color: var(--white);
}

.ide-window__btn--close:hover {
  background: #C42B1C;
}

.ide-window__restore,
.ide-window__btn.is-fullscreen .ide-window__max {
  display: none;
}

.ide-window__btn.is-fullscreen .ide-window__restore {
  display: block;
}

/* ---------- Workbench ---------- */
.ide-workbench {
  display: grid;
  grid-template-columns: 232px minmax(0, 1.3fr) minmax(0, 1fr);
  min-height: 0;
}

.ide-explorer {
  background: var(--ed-side);
  border-right: 1px solid var(--ed-rule);
  font-size: 14px;
}

.ide-pane-title {
  padding: 12px 20px 8px;
  color: var(--ed-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ide-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ide-tree li {
  margin: 0;
  font-size: inherit;
}

.ide-tree__folder,
.ide-tree__file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px;
  color: var(--ed-text);
  text-decoration: none;
  white-space: nowrap;
}

.ide-tree__folder {
  font-weight: 600;
}

.ide-tree__folder i {
  width: 12px;
  font-size: 10px;
  color: var(--ed-muted);
}

.ide-tree__file {
  padding-left: 32px;
  color: var(--ed-muted);
}

a.ide-tree__file:hover,
a.ide-tree__folder:hover {
  background: var(--ed-line-hl);
  color: var(--white);
}

.ide-tree__file.is-active {
  background: rgba(1, 102, 101, 0.55);
  color: var(--white);
  box-shadow: inset 1px 0 0 var(--ed-type);
}

/* Editor groups */
.ide-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--ed-bg);
}

.ide-group + .ide-group {
  border-left: 1px solid var(--ed-rule);
}

.ide-tabs {
  display: flex;
  background: var(--ed-chrome);
  border-bottom: 1px solid var(--ed-rule);
}

.ide-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px 9px;
  border-right: 1px solid var(--ed-rule);
  color: var(--ed-muted);
  font-size: 14px;
}

.ide-tab.is-active {
  background: var(--ed-bg);
  box-shadow: inset 0 2px 0 var(--ed-keyword);
  color: var(--ed-prop);
}

.ide-tab i {
  color: #C5A3E8;
}

.ide-crumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px 0;
  color: var(--ed-muted);
  font-size: 13px;
}

.ide-crumbs .fa-chevron-right {
  font-size: 8px;
  color: var(--ed-gutter);
}

.ide-crumbs .fa-cube {
  color: var(--ed-type);
  font-size: 11px;
}

/* ---------- Code ---------- */
.code {
  counter-reset: line;
  padding: 14px 0 28px;
  font-family: var(--ed-mono);
  font-variant-ligatures: none;
  font-size: 15px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.code .ln {
  white-space: pre-wrap;
}

.code .ln,
.code .doc > * {
  counter-increment: line;
  position: relative;
  margin: 0;
  padding-right: 24px;
  padding-left: calc(var(--ed-gutter-w) + 2ch + var(--i, 0) * 2ch);
  transition: background-color 120ms linear;
}

.code .ln::before,
.code .doc > *::before {
  content: counter(line);
  position: absolute;
  left: 0;
  width: var(--ed-gutter-w);
  text-align: right;
  color: var(--ed-gutter);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.code .ln:hover,
.code .doc > *:hover,
.code .ln:focus-within,
.code .doc > *:focus-within {
  background: var(--ed-line-hl);
}

.code .ln:hover::before,
.code .doc > *:hover::before,
.code .ln:focus-within::before,
.code .doc > *:focus-within::before {
  color: var(--ed-gutter-hl);
}

/* Bio: a multi-line template string, one soft-wrapped line per paragraph */
.code .doc > * {
  padding-left: calc(var(--ed-gutter-w) + 2ch + 4ch);
  color: var(--ed-string);
  font-family: inherit;
  font-size: inherit;
  font-weight: 400;
  line-height: inherit;
}

.code .doc ul,
.code .doc ol {
  list-style: none;
}

.tk-kw { color: var(--ed-keyword); }
.tk-var { color: var(--ed-prop); font-weight: 600; }
.tk-prop { color: var(--ed-prop); }
.tk-str { color: var(--ed-string); }
.tk-type { color: var(--ed-type); }
.tk-p { color: var(--ed-punct); }

.code a,
.term a {
  color: var(--ed-string);
  text-decoration: underline;
  text-decoration-color: rgba(159, 227, 207, 0.4);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 160ms linear, color 160ms linear;
}

.code a:hover,
.term a:hover {
  color: var(--ed-keyword);
  text-decoration-color: currentColor;
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  margin-left: 2px;
  vertical-align: -0.2em;
  background: var(--ed-keyword);
  animation: ide-caret 1.1s steps(1) infinite;
}

@keyframes ide-caret {
  50% { opacity: 0; }
}

/* ---------- Image viewer ---------- */
.ide-viewer {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background-color: var(--ed-bg);
  background-image: conic-gradient(rgba(191, 221, 218, 0.035) 25%, transparent 0 50%, rgba(191, 221, 218, 0.035) 0 75%, transparent 0);
  background-size: 24px 24px;
}

.ide-viewer img {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.ide-viewer__initials {
  display: grid;
  place-items: center;
  width: min(360px, 100%);
  aspect-ratio: 1;
  background: #D2D0D1;
  color: var(--text-muted);
  font-size: 120px;
  font-weight: 600;
}

/* ---------- Terminal (site footer) ---------- */
.ide-panel {
  background: var(--ed-deep);
  border-top: 1px solid var(--ed-rule);
}

.ide-panel__tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.ide-panel__tab {
  padding: 10px 0 7px;
  border-bottom: 1px solid var(--ed-prop);
  color: var(--ed-prop);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ide-panel__shell {
  color: var(--ed-muted);
  font-size: 13px;
}

.ide-panel__shell i {
  margin-right: 6px;
  font-size: 11px;
}

.term {
  padding: 12px 20px 22px;
  font-family: var(--ed-mono);
  font-variant-ligatures: none;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ed-text);
}

.term__cmd {
  color: var(--ed-prop);
}

.term__prompt {
  color: var(--ed-type);
  user-select: none;
}

.term__out {
  margin: 0 0 14px;
  padding: 0;
  color: var(--ed-comment);
}

.term__kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0 3ch;
}

.term__kv dt {
  font-weight: 400;
  color: var(--ed-gutter-hl);
}

.term__kv dd {
  margin: 0;
}

.term__ls {
  display: flex;
  flex-wrap: wrap;
  gap: 0 4ch;
  list-style: none;
}

.term__ls li {
  margin: 0;
  font-size: inherit;
}

.term p.term__prose {
  max-width: 100ch;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: var(--ed-comment);
}

.term__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 3ch;
}

/* ---------- Status bar ---------- */
.ide-status {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 12px;
  background: var(--teal);
  color: var(--white);
  font-size: 12.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.ide-status__group {
  display: flex;
  gap: 18px;
  white-space: nowrap;
}

.ide-status i {
  margin-right: 5px;
}

.ide-status i + i,
.ide-status .fa-exclamation-triangle {
  margin-left: 8px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
  .ide-workbench { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .ide-explorer { display: none; }
  .ide-group--code { border-left: 0; }
  .ide-title { display: none; }
}

@media (max-width: 767px) {
  :root { --ed-gutter-w: 3ch; }
  .ide-titlebar {
    flex-wrap: wrap;
    padding: 4px 8px;
  }
  .ide-titlebar__actions { order: 2; }
  .ide-menubar {
    order: 3;
    width: 100%;
    margin: 0 -4px;
  }
  .ide-menu { position: static; }
  .ide-menu__list {
    left: 8px;
    right: 8px;
    width: auto;
    min-width: 0;
    top: 100%;
  }
  .ide-menu__path { display: none; }
  .ide-menu__list a { white-space: normal; }
  .ide-workbench {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
  }
  .ide-group + .ide-group {
    border-left: 0;
    border-top: 1px solid var(--ed-rule);
  }
  .ide-group--image { order: -1; }
  .ide-viewer { padding: 24px 16px; }
  .ide-viewer img { max-height: 60vh; }
  .code { font-size: 13px; }
  .code .ln,
  .code .doc > * { padding-right: 14px; }
  .term { padding: 10px 14px 18px; font-size: 12.5px; }
  .term__kv { grid-template-columns: minmax(0, 1fr); }
  .term__kv dd { margin-bottom: 6px; }
  .ide-status__extra { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .caret,
  .ide-menu__list { animation: none; }
}
