/* ============================================================
   GABRIEL LEAL PORTFOLIO
   Interactive desktop, faithful to nrthview.com:
   paper-grey canvas, watermark collage type, draggable folders,
   retro OS windows, marquee top bar, status bottom bar.
   ============================================================ */

:root {
  --paper: #949595;
  --paper-2: #8a8b8b;
  --ink: #131313;
  --ink-soft: rgba(19, 19, 19, 0.5);
  --ink-ghost: rgba(19, 19, 19, 0.2);
  --white: #f4f4f4;
  --win-bg: #efefef;
  --win-title: #1a1a1a;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Geist", "Inter", system-ui, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, monospace;
  --font-hand: "Caveat", cursive;
  --font-script: "Homemade Apple", cursive;
  --font-serif: "Playfair Display", serif;
  --bar-h: 34px;
  --sysbar-h: 30px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  /* Neutral grey newsprint: even base with subtle uneven light and edge shading */
  background:
    radial-gradient(ellipse 85% 65% at 48% 42%, rgba(255, 255, 255, 0.07), transparent 72%),
    radial-gradient(ellipse 70% 55% at 8% 92%, rgba(0, 0, 0, 0.07), transparent 68%),
    radial-gradient(ellipse 65% 50% at 94% 6%, rgba(0, 0, 0, 0.06), transparent 68%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

::selection { background: var(--ink); color: var(--paper); }

.mono {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Old newsprint grain: dense fine noise over coarse stains and fibers */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2000;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1999;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='b'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.008 0.02' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23b)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* ============ SYSTEM BAR (layer 1, macOS style) ============ */

.sysbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--sysbar-h);
  background: #0c0c0c;
  color: #f2f2f0;
  z-index: 910;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.9rem;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

.sysbar__left, .sysbar__right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.sysbar__battery {
  width: 20px;
  height: 10px;
  border: 1.2px solid #f2f2f0;
  border-radius: 2.5px;
  position: relative;
  display: inline-block;
}

.sysbar__battery::after {
  content: "";
  position: absolute;
  right: -3.5px;
  top: 2.5px;
  width: 2px;
  height: 3.5px;
  background: #f2f2f0;
  border-radius: 0 1px 1px 0;
}

.sysbar__battery-fill {
  position: absolute;
  inset: 1.5px;
  right: 30%;
  background: #f2f2f0;
  border-radius: 1px;
}

.sysbar__wifi svg { width: 14px; height: 11px; display: block; }

.sysbar__lang {
  font-weight: 800;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  background: rgba(242, 242, 240, 0.14);
}

.sysbar__key { font-weight: 500; opacity: 0.85; }

.sysbar__loc svg { width: 9px; height: 11px; display: block; }

.sysbar__right span { white-space: nowrap; }

/* ============ TOP MARQUEE BAR (layer 2) ============ */

.topbar {
  position: fixed;
  top: var(--sysbar-h); left: 0; right: 0;
  height: var(--bar-h);
  background: #f2f2f0;
  border-bottom: 1px solid var(--ink);
  overflow: hidden;
  z-index: 900;
  display: flex;
  align-items: center;
}

.topbar__inner {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  animation: marquee 72s linear infinite;
}

.topbar__inner span {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 2.2rem;
  color: #101010;
  display: inline-flex;
  align-items: center;
}

.topbar__inner span::before {
  content: "\2039";
  font-weight: 500;
  font-size: 1rem;
  opacity: 0.85;
  margin-right: 2.2rem;
  transform: translateY(-1px);
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ============ DESKTOP CANVAS ============ */

.desktop {
  position: fixed;
  inset: calc(var(--sysbar-h) + var(--bar-h)) 0 var(--bar-h) 0;
  overflow: hidden;
  cursor: default;
}

/* ---- Watermark collage ---- */

.collage { position: absolute; inset: 0; pointer-events: none; z-index: 0; }

/* LAYER 0: manuscript fragments scattered across the whole canvas */
.manuscript {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.ms-frag {
  position: absolute;
  white-space: nowrap;
  will-change: transform;
}

/* Manuscript voices (size and opacity are randomized inline by JS) */
.ms-hand { font-family: var(--font-hand); }

.ms-script { font-family: var(--font-script); }

.ms-serif { font-family: var(--font-serif); font-style: italic; }

.ms-mono {
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.collage__block { position: absolute; display: flex; flex-direction: column; }

.collage__big {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 6.5vw, 5.2rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ink-soft);
}

.collage__ghost { color: var(--ink-ghost); }

.collage__small {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--ink-soft);
}

.collage__hero {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.4rem, 9vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.collage__name {
  top: 50%;
  right: 3%;
  transform: translateY(-50%);
  text-align: right;
  align-items: flex-end;
  gap: 0.4rem;
}

@media (max-width: 900px) {
  .collage__name { top: 30%; right: 4%; transform: none; }
}

.collage__name .collage__big {
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 600;
  color: var(--ink-ghost);
}

.collage__loc { bottom: 16%; left: 3%; }

.collage__rev { bottom: 4%; left: 3%; }

.collage__rev .collage__big { font-size: clamp(2rem, 5vw, 4rem); color: var(--ink-ghost); }

/* ---- Profile chip ---- */

.profile {
  position: absolute;
  top: 1.1rem;
  left: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  z-index: 10;
}

.profile__pic {
  width: clamp(150px, 17vw, 210px);
  height: clamp(150px, 17vw, 210px);
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--ink);
  filter: grayscale(1) contrast(1.05);
  box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.18);
}

.profile__pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 74% 32%;
}

/* ============ FOLDERS ============ */

.folder {
  position: absolute;
  width: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  cursor: grab;
  z-index: 20;
  touch-action: none;
}

.folder:active { cursor: grabbing; }

.folder__icon {
  width: 76px;
  height: 58px;
  position: relative;
  filter: drop-shadow(1px 3px 0 rgba(0,0,0,0.25));
  transition: transform 0.15s ease;
}

.folder:hover .folder__icon { transform: translateY(-3px); }

.folder__icon::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 46%;
  height: 12px;
  background: #161616;
  border-radius: 3px 4px 0 0;
}

.folder__icon::after {
  content: "";
  position: absolute;
  top: 8px; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #2a2a2a, #101010);
  border-radius: 3px;
}

.folder__label {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: 0.86rem;
  text-align: center;
  line-height: 1.25;
  color: var(--ink);
}

.folder--dragging { z-index: 300; }

/* ============ RETRO WINDOWS ============ */

.window {
  position: absolute;
  background: var(--win-bg);
  border: 1px solid var(--ink);
  box-shadow: 4px 5px 0 rgba(0, 0, 0, 0.28);
  min-width: 280px;
  max-width: min(480px, 92vw);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.window--focus { z-index: 200; }

.window__title {
  background: var(--win-title);
  color: var(--white);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.74rem;
  padding: 0.4rem 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  gap: 1rem;
}

.window__title:active { cursor: grabbing; }

.window__close {
  background: none;
  border: 1px solid var(--white);
  color: var(--white);
  width: 16px;
  height: 16px;
  font-size: 0.6rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
}

.window__close:hover { background: var(--white); color: var(--ink); }

.window__tags {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.7rem 0;
}

.window__tags .foldermini {
  width: 22px; height: 16px;
  background: #161616;
  border-radius: 1px;
  position: relative;
}

.window__tags .foldermini::before {
  content: "";
  position: absolute;
  top: -3px; left: 0;
  width: 45%; height: 3px;
  background: #161616;
}

.window__tag {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.62rem;
  border: 1px solid var(--ink);
  padding: 0.12rem 0.4rem;
  background: var(--white);
}

.window__body {
  padding: 0.7rem;
  overflow-y: auto;
  max-height: min(52vh, 460px);
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
}

.window__body p {
  font-size: 0.78rem;
  line-height: 1.55;
  color: #1c1c1c;
  margin-bottom: 0.8rem;
}

.window__credits { border-top: 1px solid rgba(0,0,0,0.15); padding-top: 0.6rem; margin-bottom: 0.8rem; }

.window__credit {
  display: flex;
  gap: 0.6rem;
  font-size: 0.68rem;
  padding: 0.18rem 0;
}

.window__credit dt { color: rgba(0,0,0,0.45); flex: 0 0 34%; font-weight: 400; }

.window__credit dd { font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }

.window__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.window__grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  filter: grayscale(1) contrast(1.06);
  cursor: zoom-in;
  transition: filter 0.25s ease;
}

.window__grid img:hover { filter: grayscale(0); }

.window__count {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(0,0,0,0.45);
  padding-top: 0.55rem;
}

/* ============ BOTTOM BAR ============ */

.bottombar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bar-h);
  background: #f2f2f0;
  border-top: 1px solid var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.1rem;
  z-index: 900;
  overflow: hidden;
}

/* Handwritten scrawl crossing the bar, like the reference */
.bottombar__scrawl {
  position: absolute;
  left: 12%;
  right: 30%;
  top: 50%;
  transform: translateY(-52%) rotate(-1.2deg);
  font-family: var(--font-script);
  font-size: 1.05rem;
  color: rgba(17, 17, 17, 0.3);
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
}

@media (max-width: 800px) { .bottombar__scrawl { display: none; } }

.bottombar__start {
  position: relative;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.84rem;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: #f2f2f0;
  padding-right: 0.6rem;
}

.bottombar__start:hover { opacity: 0.55; }

.blink { animation: blink 1.2s steps(2) infinite; display: inline-block; font-size: 1.05rem; font-weight: 500; }

@keyframes blink { 50% { opacity: 0; } }

.bottombar__links {
  position: relative;
  display: flex;
  gap: 1.9rem;
  background: #f2f2f0;
  padding-left: 0.8rem;
}

.bottombar__links a {
  color: #101010;
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  display: inline-flex;
  gap: 0.55rem;
  transition: opacity 0.2s ease;
}

.bottombar__links a:hover { opacity: 0.4; }

/* ============ LIGHTBOX ============ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(10, 10, 10, 0.93);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
}

.lightbox.is-open { display: flex; }

.lightbox img { max-width: 92vw; max-height: 86vh; object-fit: contain; }

.lightbox__caption {
  position: absolute;
  bottom: 1.1rem;
  left: 50%;
  transform: translateX(-50%);
  color: #cfcfcf;
}
