/* Home: David's jacket-yellow dossier on the left, Lucy's hair as a desktop on the right with two floating windows.
   From 1180px the windows float: drag by the title bar, resize from the bottom-right corner, enlarge with the bar button.
   Below that they stack in the page flow, slightly staggered; below 760px everything is one column. */

.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  min-height: 100dvh;
}

/* ---------- dossier: David ---------- */

.dossier {
  --fg: var(--ink);
  --fg-2: var(--ink-soft);
  --rule: var(--ink-rule);
  --surface: var(--yellow);
  --link: var(--ink);
  --link-hover: var(--ink);
  --focus: var(--ink);
  --split-1: var(--dossier-split-1);
  --split-2: var(--dossier-split-2);
  position: sticky;
  top: 0;
  z-index: 2;
  align-self: start;
  height: 100dvh;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  background: var(--yellow);
  color: var(--fg);
  box-shadow: 6px 0 0 var(--trim); /* the jacket's dark trim */
}

.spine {
  width: calc(30px + env(safe-area-inset-left, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  padding-block: calc(20px + env(safe-area-inset-top, 0px)) 20px;
  display: flex;
  justify-content: center;
  background: var(--ink);
  color: var(--yellow);
}
.spine span {
  writing-mode: vertical-rl;
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dossier__inner {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
  overflow-y: auto;
  padding-block: calc(22px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-bottom, 0px));
  padding-inline: 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-rule) transparent;
}

.dossier__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dossier__head { display: flex; flex-direction: column; gap: 20px; }

.avatar { position: relative; width: 112px; max-width: 100%; aspect-ratio: 1; }
.avatar::before { content: ""; position: absolute; inset: 7px -7px -7px 7px; border: 2px solid var(--ink); }
.avatar img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--ink);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
}

.dossier__who { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.handle { font-family: var(--font-mono); font-size: var(--t-sm); font-weight: 500; color: var(--fg-2); }
.name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-3xl);
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.role { font-size: var(--t-lg); font-weight: 600; line-height: 1.45; }
.loc { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.06em; color: var(--fg-2); }
.loc__dot { width: 6px; height: 6px; flex: none; background: var(--ink); box-shadow: 0 0 0 3px var(--ink-rule); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }

.dossier__bio { display: flex; flex-direction: column; gap: 12px; line-height: 1.75; }

.block { display: flex; flex-direction: column; gap: 10px; }
.block--now p::after { content: "_"; margin-left: 2px; font-family: var(--font-mono); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.block--msg blockquote { padding-left: 14px; border-left: 3px solid var(--ink); }
.block--msg blockquote p { font-size: var(--t-lg); font-weight: 500; line-height: 1.6; }

.block--links ul { display: flex; flex-wrap: wrap; gap: 8px; }
.block--links a {
  display: inline-flex;
  padding: 5px 10px;
  border: 1.5px solid var(--ink);
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.block--links a:hover { background: var(--ink); color: var(--yellow); }

.clock { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.clock__time { font-family: var(--font-mono); font-size: var(--t-sm); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- desk: Lucy ---------- */

.desk {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 28px;
  padding-block: calc(32px + env(safe-area-inset-top, 0px)) calc(40px + env(safe-area-inset-bottom, 0px));
  padding-left: 40px;
  padding-right: max(32px, env(safe-area-inset-right, 0px));
}

.win__bar { min-height: 42px; }
.win__btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
}
.win__btn span { display: block; width: 11px; height: 9px; border: 1.5px solid currentColor; border-top-width: 3px; }
.win__btn:hover, .win__btn[aria-pressed="true"] { background: var(--ink); color: var(--acc-1); }
.win__btn[aria-pressed="true"] span { width: 8px; height: 7px; }

.win__body {
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-hi) transparent;
}
.win__body:focus-visible { outline-offset: -3px; }
.empty { padding: 28px 18px; color: var(--fg-2); }

/* posts */
.post { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--rule); transition: background-color 0.15s; }
.post:last-child { border-bottom: 0; }
.post:hover { background: var(--raised); }
.post__link { display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.post__link:hover { color: inherit; }
.post__link::after { content: ""; position: absolute; inset: 0; }
.post__link:focus-visible { outline: none; }
.post:has(.post__link:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.post__meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-family: var(--font-mono); font-size: var(--t-xs); color: var(--fg-2); font-variant-numeric: tabular-nums; }
.post__meta time { color: var(--acc-1); }
.post__title {
  align-self: flex-start;
  font-family: var(--font-display);
  font-size: var(--t-xl);
  font-weight: 700;
  line-height: 1.3;
  text-wrap: balance;
}
.post:hover .post__title {
  background: var(--bar);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.post__sum { max-width: 62ch; font-size: var(--t-sm); line-height: 1.6; color: var(--fg-2); }

/* works */
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 20px; border-bottom: 1px solid var(--rule); }
.filter {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--line-hi);
  font-family: var(--font-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.06em;
  color: var(--fg-2);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.filter:hover { color: var(--fg); border-color: var(--fg-2); }
.filter[aria-pressed="true"] { background: var(--bar); border-color: transparent; color: var(--ink); }

.work { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border-bottom: 1px solid var(--rule); }
.work:last-child { border-bottom: 0; }
.work__head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.kind { padding: 1px 8px; border: 1px solid currentColor; font-family: var(--font-mono); font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase; }
.kind--paper { color: var(--acc-1); }
.kind--project { color: var(--acc-2); }
.kind--talk { color: var(--acc-3); }
.kind--code { color: var(--acc-4); }
.kind--other { color: var(--muted); }
.work__meta { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--fg-2); font-variant-numeric: tabular-nums; }
.work__title { font-family: var(--font-display); font-size: var(--t-lg); font-weight: 700; line-height: 1.35; text-wrap: balance; }
.work__desc { font-size: var(--t-sm); line-height: 1.6; color: var(--fg-2); }
.work__links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.work__links a { display: inline-flex; gap: 4px; font-family: var(--font-mono); font-size: var(--t-sm); text-decoration: none; }
.work__links a:hover { text-decoration: underline; }

/* ---------- hover glow effect ---------- */
.fx-glow .post:hover .post__title { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--acc-2) 70%, transparent)); }
.fx-glow .filter[aria-pressed="true"] { box-shadow: 0 0 14px color-mix(in srgb, var(--acc-4) 55%, transparent); }
.fx-glow .work__links a:hover { text-shadow: 0 0 10px color-mix(in srgb, currentColor 70%, transparent); }
.fx-glow .block--links a:hover { box-shadow: 3px 3px 0 var(--magenta); }

/* ---------- floating windows ---------- */

@media (min-width: 1180px) {
  .shell { height: 100dvh; }
  .desk { display: block; height: 100dvh; overflow: hidden; padding-block: 0; padding-left: 0; padding-right: 0; }
  .win {
    position: absolute;
    min-width: 320px;
    min-height: 260px;
    max-width: calc(100% - 24px);
    max-height: calc(100% - 24px);
    overflow: hidden;
    resize: both;
  }
  /* Positions are custom properties so a layout the visitor dragged never leaks into the stacked layout. */
  .win--posts { left: var(--x, 5%); top: var(--y, 7%); width: var(--w, 53%); height: var(--h, 80%); z-index: var(--z, 3); }
  .win--works { left: var(--x, 56%); top: var(--y, 15%); width: var(--w, 40%); height: var(--h, 78%); z-index: var(--z, 2); }
  .win__bar { cursor: grab; user-select: none; touch-action: none; }
  .win.is-dragging .win__bar { cursor: grabbing; }
  .win.is-dragging { filter: drop-shadow(0 26px 40px var(--shadow)); }
  .win__body { overflow-y: auto; }
  .win.is-max {
    inset: 16px !important;
    width: auto !important;
    height: auto !important;
    max-width: none;
    max-height: none;
    resize: none;
    z-index: 50 !important;
  }
  .win.is-max .win__bar { cursor: default; }
}

/* ---------- stacked windows ---------- */

@media (max-width: 1179px) {
  .win__btn { display: none; }
  .win--posts { margin-right: 6%; }
  .win--works { margin-left: 6%; }
}

@media (max-width: 759px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .dossier { position: static; height: auto; grid-template-columns: minmax(0, 1fr); box-shadow: 0 6px 0 var(--trim); }
  .spine { width: auto; justify-content: flex-start; padding-block: calc(6px + env(safe-area-inset-top, 0px)) 6px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
  .spine span { writing-mode: horizontal-tb; overflow: hidden; text-overflow: ellipsis; }
  .dossier__inner { overflow: visible; gap: 24px; padding-block: 22px 28px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
  .clock { margin-top: 0; }
  .desk { gap: 20px; padding-block: 28px calc(32px + env(safe-area-inset-bottom, 0px)); padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
  .win--posts, .win--works { margin-inline: 0; }
  .win__bar { padding-left: 14px; }
  .filters, .post, .work { padding-inline: 16px; }
  .post__title { font-size: var(--t-lg); }
}
