/* About desk — text in the right column, folders floating on the left. */

.aboutDesk {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  background: var(--bg);
  --folder-w: clamp(108px, 11vw, 150px);
  --tab-w: max(3.4rem, calc(var(--folder-w) * 0.42));
  --tab-h: max(1.05rem, calc(var(--folder-w) * 0.16));
  --tab-overlap: 4px;
  --folder-h: calc(var(--folder-w) + var(--tab-h) - var(--tab-overlap));
  --icon-w: calc(var(--folder-w) + 1.25rem);
  --folder-pad: clamp(5px, 0.6vw, 10px);
  --folder-border: clamp(2px, 0.22vw, 3px);
  --label-size: clamp(12px, 1.05vw, 14px);
  --icon-gap: 10px;
  --drop: 6px;
}

.aboutGrid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.72;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: clamp(28px, 4vw, 42px) clamp(28px, 4vw, 42px);
}

.aboutFolders {
  position: relative;
  z-index: 2;
}

.aboutIcon {
  position: relative;
  width: var(--icon-w);
  z-index: 1;
}

html.about-boot .aboutCopy > :not(.is-in) {
  display: none;
}

html.about-boot .aboutCopy > .aboutTerminal {
  display: block;
}

html.about-boot .aboutCopy > .is-in {
  animation: aboutLineIn 650ms ease;
}

@keyframes aboutLineIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html.about-boot .aboutCopy > :not(.is-in) {
    display: revert;
  }

  html.about-boot .aboutCopy > .is-in {
    animation: none;
  }
}

.aboutCopy {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: min(42rem, calc(100vw - 56px));
  margin: 0;
  padding: 28px 28px 96px;
  color: var(--fg);
  font-size: clamp(15px, 1.15vw, 17px);
  font-weight: 500;
  line-height: 1.55;
  user-select: text;
}

/* Right column, left-aligned. Left field stays clear for the folders. */
@media (min-width: 641px) {
  .aboutFolders {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 44vw;
    height: auto;
    pointer-events: none;
  }

  .aboutIcon {
    position: absolute;
    pointer-events: auto;
  }

  .aboutIcon--letter {
    left: 32px;
    top: 28px;
  }

  .aboutIcon--studies {
    left: 112px;
    top: min(228px, 34vh);
  }

  .aboutCopy {
    width: min(42rem, calc(54vw - 48px));
    margin-left: 46vw;
    margin-right: 0;
    padding: 36px 40px 120px 0;
  }
}

.aboutTerminal {
  margin: 0 0 22px;
  font-size: clamp(14px, 1.35vw, 16px);
  font-weight: 400;
  line-height: 1.75;
  white-space: pre-wrap;
}

.aboutCopy .aboutTerminal .line {
  margin: 0;
  font-weight: 400;
  letter-spacing: 0;
  text-align: left;
  text-align-last: auto;
}

.aboutCopy .aboutTerminal .line.belowAsciiSystem {
  color: var(--green);
}

.aboutMeta {
  margin: 0 0 14px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.03em;
  white-space: pre-line;
}

.aboutCopy h1 {
  margin: 0 0 20px;
  color: var(--fg);
  font-size: clamp(28px, 2.7vw, 38px);
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.15;
}

.aboutLead {
  margin: 0 0 0.2em;
  font-size: inherit;
  line-height: inherit;
}

.aboutCopy h2 {
  margin: 1.15em 0 0.35em;
  color: var(--fg);
  font-size: clamp(24px, 2.3vw, 32px);
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.15;
}

.aboutCopy p {
  margin: 0 0 0.85em;
}

.aboutCopy p:not(.aboutMeta) {
  color: var(--dim);
  text-align: justify;
  text-align-last: left;
}

.aboutCopy a {
  color: var(--green);
}

/* Folders — same green desk icon as the studies directory, at a smaller size. */
.studyIconLink {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--icon-gap);
  color: inherit;
  text-decoration: none;
}

.studyIconLink:hover {
  text-decoration: none;
}

.studyFolder {
  position: relative;
  display: block;
  width: var(--folder-w);
  height: var(--folder-h);
  filter: drop-shadow(var(--drop) var(--drop) 0 rgba(0, 0, 0, 0.45));
  transition:
    transform 0.18s ease,
    filter 0.18s ease;
}

.studyIconLink:hover .studyFolder,
.studyIconLink:focus-visible .studyFolder {
  transform: translateY(-8px) scale(1.03);
  filter:
    brightness(1.04)
    drop-shadow(0 12px 10px rgba(0, 0, 0, 0.55))
    drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.35));
}

.studyIconLink:focus-visible {
  outline: 1px solid var(--green);
  outline-offset: 6px;
}

.studyFolderTab {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tab-w);
  height: var(--tab-h);
  padding: 0 0.4em;
  background: var(--green);
  border: var(--folder-border) solid #000;
  color: #000;
  font-size: clamp(9px, 0.9vw, 11px);
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: lowercase;
  white-space: nowrap;
  overflow: hidden;
}

.studyFolderFace {
  position: absolute;
  top: calc(var(--tab-h) - var(--tab-overlap));
  left: 0;
  z-index: 1;
  display: flex;
  width: var(--folder-w);
  height: var(--folder-w);
  padding: var(--folder-pad);
  background: var(--green);
  border: var(--folder-border) solid #000;
  overflow: hidden;
}

.studyFolderFace--cycle {
  padding: 0;
  background: #111;
}

.aboutCover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 36%;
  pointer-events: none;
}

.studyFolderFace--cycle.is-glitching .aboutCover {
  animation: aboutCoverGlitch 0.42s steps(2, end);
}

@keyframes aboutCoverGlitch {
  0%,
  100% {
    transform: none;
    filter: none;
    clip-path: none;
  }
  20% {
    transform: translate(6px, -3px) skewX(-1.4deg);
    filter: contrast(1.8) saturate(1.35);
    clip-path: inset(10% 0 16% 0);
  }
  48% {
    transform: translate(-7px, 4px) skewX(1.6deg);
    filter: contrast(1.5) hue-rotate(16deg);
    clip-path: inset(0 10% 8% 4%);
  }
  72% {
    transform: translate(3px, 1px);
    filter: contrast(1.3);
    clip-path: inset(14% 2% 0 8%);
  }
}

.studyFolderFace--letter {
  display: grid;
  place-items: center;
  background: #0a0a0a;
}

.studyFolderFace--letter .studyFolderLines {
  position: absolute;
  inset: 18% 16%;
  align-items: flex-start;
  justify-content: center;
  opacity: 1;
}

.studyFolderFace--letter .studyFolderLine {
  background: var(--green);
}

.studyFolderFace--letter .studyFolderLine:nth-child(1) {
  width: 100%;
}

.studyFolderFace--letter .studyFolderLine:nth-child(2) {
  width: 74%;
}

.studyFolderFace--letter .studyFolderLine:nth-child(3) {
  width: 42%;
}

.studyFolderLines {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: calc(var(--folder-pad) + 2px);
  padding: calc(var(--folder-pad) * 1.4);
}

.studyFolderLine {
  display: block;
  height: clamp(3px, 0.35vw, 5px);
  background: #000;
}

.studyIconCaption {
  display: flex;
  max-width: calc(var(--icon-w) + 2.5rem);
}

.studyIconLabel {
  color: #fff;
  font-size: var(--label-size);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9);
}

html.mode-invert .studyIconLabel {
  color: #000;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

html.mode-invert .studyFolderFace--letter {
  background: #f2f2f2;
}

html.mode-invert .studyFolderFace--letter .studyFolderLine {
  background: #000;
}

@media (prefers-reduced-motion: reduce) {
  .studyFolderFace--cycle.is-glitching .aboutCover {
    animation: none;
  }

  .studyFolder {
    transition: none;
  }

  .studyIconLink:hover .studyFolder,
  .studyIconLink:focus-visible .studyFolder {
    transform: none;
  }
}

@media (max-width: 640px) {
  .aboutFolders {
    display: flex;
    gap: 22px;
    align-items: flex-start;
    padding: 54px 18px 4px;
  }

  .aboutDesk {
    --folder-w: 92px;
    --label-size: 12px;
  }

  .aboutCopy {
    width: auto;
    margin: 0;
    padding: 16px 18px 96px;
    font-size: 16px;
  }

  .aboutCopy h1 {
    font-size: 28px;
  }

  .aboutCopy h2 {
    font-size: 24px;
  }

  .aboutCopy p:not(.aboutMeta) {
    text-align: left;
    text-align-last: auto;
  }

  body.studies-open .aboutCopy,
  body.studies-open .aboutGrid,
  body.studies-open .aboutFolders {
    opacity: 0;
    pointer-events: none;
  }
}
