:root {
  --sky: #cfe6f2;
  --blue: #2563eb;
  --blue-deep: #0b3b60;
  --teal: #0fa39a;
  --mint: #34d399;
  --paper: #f4f9fc;
  --grid: rgba(15, 120, 160, .13);
  --ink: #0f1c2b;
  --muted: #5b6b7c;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --script: 'Caveat', cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--sky);
  overflow: hidden; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: var(--teal); }

/* MENU BAR */
.menubar {
  position: fixed; inset: 0 0 auto 0; height: 30px; z-index: 1000;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 14px; font-size: 13px;
  background: rgba(255,255,255,.72); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.menubar .left, .menubar .right { display: flex; align-items: center; gap: 16px; white-space: nowrap; }
.mark { color: var(--teal); font-size: 15px; }
.mb-link { padding: 2px 6px; border-radius: 4px; }
.mb-link:hover { background: rgba(0,0,0,.06); }
.mb-link.strong { font-weight: 600; text-decoration: underline; text-decoration-color: var(--teal); text-underline-offset: 3px; }
.status { color: var(--muted); letter-spacing: .1em; }

/* DESKTOP */
.desktop {
  position: fixed; inset: 30px 0 0 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 15% 0%, rgba(52,211,153,.16), transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(37,99,235,.14), transparent 55%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 22px 22px, 22px 22px;
  overflow: hidden;
}
#cloud { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.welcome {
  z-index: 2;
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none; user-select: none;
}
.welcome p { font-size: clamp(18px, 2vw, 24px); color: #3b4a5a; }
.welcome h1 {
  font-family: 'Fredoka', var(--sans); font-weight: 600;
  font-size: clamp(60px, 10.5vw, 144px); line-height: 1; letter-spacing: .005em;
  color: var(--blue-deep); text-shadow: 0 4px 0 rgba(15,163,154,.18);
  pointer-events: auto; cursor: default; display: inline-block; padding: 34px 10px 0; white-space: nowrap;
}
.welcome .tag {
  margin-top: 14px; font-family: var(--mono); font-size: 12.5px; color: var(--blue-deep);
  display: inline-block; padding: 5px 12px; border-radius: 99px;
  background: rgba(255,255,255,.7); border: 1px solid rgba(15,163,154,.35);
}
.welcome .ltr { display: inline-block; transform-origin: 50% 90%; transition: transform .18s ease-out, margin .18s ease-out, color .25s ease; }

/* STICKY NOTE */
.sticky {
  position: absolute; left: 2.5%; top: 4%; width: 240px; z-index: 5;
  background: #d5f7e6; padding: 14px 16px 18px; font-size: 12.5px; line-height: 1.5;
  box-shadow: 0 6px 16px rgba(0,40,60,.14); border-radius: 2px; cursor: grab;
  transform: rotate(-1.5deg); touch-action: none; user-select: none;
}
.sticky strong { display: block; margin-bottom: 6px; font-family: var(--script); font-size: 20px; color: #0b5e57; }
.sticky ul { list-style: none; }
.sticky li::before { content: "☐ "; color: #0b5e57; }
.sticky .done { text-decoration: line-through; color: #4f7f73; }
.sticky .done::before { content: "☑ "; }

/* ICONS */
.icon {
  position: absolute; width: 124px; z-index: 4;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 6px 4px; border-radius: 6px; touch-action: none; user-select: none;
  transform: translateX(-50%);
}
.icon:hover .label, .icon:focus-visible .label { background: var(--teal); color: #fff; }
.icon:focus-visible { outline: none; }
.icon.dragging { opacity: .85; cursor: grabbing; z-index: 50; }
.ico { width: 58px; height: 48px; filter: drop-shadow(0 2px 3px rgba(0,30,60,.15)); }
.ico.doc { width: 42px; height: 52px; }
.label { font-size: 11.5px; font-weight: 500; text-align: center; line-height: 1.25; padding: 1px 6px; border-radius: 4px; }

/* WINDOWS */
#windows { position: absolute; inset: 0; pointer-events: none; }
.window {
  position: absolute; pointer-events: auto; max-height: calc(100% - 120px);
  display: flex; flex-direction: column;
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(10, 40, 70, .25), 0 0 0 1px rgba(0,0,0,.08);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.titlebar {
  height: 36px; flex: none; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: #eef5f9; border-bottom: 1px solid #dde9f0; cursor: grab; touch-action: none; user-select: none;
}
.lights { position: absolute; left: 12px; display: flex; gap: 8px; }
.lights > * { width: 12px; height: 12px; border-radius: 50%; display: block; }
.lights .close { background: #ff5f57; }
.lights .close:hover::after { content: "×"; font-size: 11px; line-height: 12px; display: block; text-align: center; color: #6b0000; }
.lights i { background: #febc2e; }
.lights .zoom { background: #28c840; padding: 0; }
.lights .zoom:hover::after { content: "⤢"; font-size: 9px; line-height: 12px; display: block; text-align: center; color: #0a5016; }
.window.big { max-height: calc(100% - 104px); }
.window.max { left: 8px !important; top: 8px !important; width: auto !important; right: 8px; max-height: none; bottom: 96px; border-radius: 10px; }
.wtitle { font-size: 13px; font-weight: 600; color: #4a5a6a; }
.wbody { padding: 22px 24px 26px; overflow: auto; font-size: 14.5px; line-height: 1.6; }
.wbody h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.1; margin-bottom: 6px; }
.wbody h3 { font-size: 14px; margin: 16px 0 4px; }
.wbody p + p { margin-top: 10px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--teal); font-weight: 600; margin-bottom: 8px; }
.muted { color: var(--muted); }
.btn {
  display: inline-block; margin-top: 16px; padding: 9px 20px; border-radius: 99px;
  background: var(--blue-deep); color: #fff; text-decoration: none; font-weight: 500; font-size: 14px;
}
.btn:hover { background: var(--teal); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid #cfdde6; }
.btn.ghost:hover { background: #eaf6f4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 99px; background: #e6f4f8; color: var(--blue-deep); border: 1px solid #cfe6ee; }

/* about */
.window.big .wbody { padding: 0 0 32px; }
.about-banner {
  height: 210px; position: relative; overflow: hidden;
  background: linear-gradient(120deg, var(--blue-deep), #0d6e8a 55%, var(--teal));
  display: flex; align-items: flex-end; padding: 22px 32px; color: #fff;
}
.about-banner canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.about-banner .avatar {
  position: relative; width: 84px; height: 84px; border-radius: 50%; flex: none;
  background: #fff; object-fit: cover; border: 3px solid rgba(255,255,255,.7); box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.about-banner .who { position: relative; margin-left: 18px; }
.about-banner .who b { display: block; font-size: 26px; font-family: var(--serif); font-weight: 400; }
.about-banner .who span { font-size: 13px; opacity: .85; }
.about-text { padding: 24px 32px 4px; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.about-card { background: #f3f9fb; border: 1px solid #e0eef3; border-radius: 12px; padding: 14px 16px; }
.about-card h3 { margin: 0 0 4px; font-size: 14px; }
.about-card p { font-size: 13.5px; color: #3b4a5a; }

/* story project */
.story { background: #f5f9fb; }
.story-head { padding: 36px 40px 26px; }
.story-head h2 { font-family: var(--sans); font-weight: 700; font-size: 44px; letter-spacing: -.02em; margin: 2px 0 10px; }
.story .intro { font-size: 16px; line-height: 1.6; max-width: 58ch; color: #2c3a48; }
.story-hero { background: #e4eff5; padding: 32px 40px 36px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: end; }
.pair.n1 { grid-template-columns: 1fr; }
.story blockquote { max-width: 56ch; margin: 28px auto 0; text-align: center; font-size: 18px; line-height: 1.55; font-weight: 500; color: #1c2a38; }
.story figure { margin: 0; }
.story figure img { width: 100%; height: auto; display: block; border-radius: 8px; cursor: zoom-in; box-shadow: 0 4px 14px rgba(0,40,70,.12); }
.story figcaption { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.story-section { padding: 32px 40px 8px; border-top: 1px solid #dde9ef; }
.story-section:first-of-type { border-top: 0; }
.story-section .row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 32px; }
.story-section h3 { font-size: 18px; font-weight: 700; margin: 0; }
.story-section p { font-size: 14.5px; line-height: 1.7; color: #2c3a48; max-width: 64ch; }
.story-section ul { padding-left: 18px; font-size: 14.5px; line-height: 1.7; color: #2c3a48; }
.figs { display: grid; gap: 18px; margin-top: 22px; align-items: start; }
.figs.n2, .figs.n3 { grid-template-columns: 1fr 1fr; }
.figs figure.wide { grid-column: 1 / -1; }
.story > :last-child { padding-bottom: 36px; }
.window.big .wbody:has(.story) { padding-bottom: 0; }
.links { display: flex; gap: 10px; flex-wrap: wrap; }

/* generated cover art (for projects without screenshots) */
.art {
  aspect-ratio: 21 / 9; border-radius: 10px; position: relative; overflow: hidden;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--a, #0b3b60), var(--b, #0fa39a));
  box-shadow: 0 4px 14px rgba(0,40,70,.15);
}
.art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.art .glyph { position: relative; font-size: 64px; line-height: 1; text-shadow: 0 6px 20px rgba(0,0,0,.25); }
.art .art-title { position: absolute; left: 20px; bottom: 16px; font-family: var(--serif); font-style: italic; font-size: 30px; }
.art .art-tag { position: absolute; right: 18px; top: 14px; font-family: var(--mono); font-size: 11px; padding: 3px 8px; border-radius: 99px; background: rgba(255,255,255,.18); }

/* repos window */
.repos-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.repo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.repo {
  display: block; text-decoration: none; color: inherit; border: 1px solid #dfeaf0; border-radius: 12px;
  padding: 14px 16px; background: #fbfdfe; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.repo:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(10,60,90,.1); border-color: var(--teal); }
.repo b { font-size: 14px; display: block; color: var(--blue-deep); word-break: break-word; }
.repo p { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.repo .meta { display: flex; gap: 12px; margin-top: 10px; font-size: 11.5px; color: var(--muted); align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 4px; vertical-align: -1px; }

/* finder */
.finder { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.finder-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border-radius: 8px; font-size: 12px; text-align: center; }
.finder-item:hover { background: #e9f5f8; }

/* terminal */
.window.term .titlebar { background: #16222f; border-color: #0d1620; }
.window.term .wtitle { color: #9fb3c4; }
.window.term .wbody { background: #0d1620; color: #c9e7e2; font-family: var(--mono); font-size: 13px; line-height: 1.65; }
.term .p { color: var(--mint); }
.term .c { color: #7cc4ff; }
.term .k { color: #fbbf24; }
.term-in { display: flex; gap: 8px; margin-top: 6px; }
.term-in input { flex: 1; background: none; border: 0; outline: none; color: inherit; font: inherit; caret-color: var(--mint); }

/* text / contact / secret */
.txt { font-family: var(--mono); font-size: 13px; }
.txt p { margin-bottom: 18px; }
.contact hr { border: 0; border-top: 1px solid #e6eef2; margin: 12px 0; }
.contact-list { display: grid; gap: 10px; margin: 16px 0 4px; }
.contact-list > div { display: grid; grid-template-columns: 90px 1fr; gap: 12px; align-items: baseline; }
.contact-list dt { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.contact-list dd { font-size: 14.5px; }
.cv { padding: 24px 32px 4px; }
.cv-row { display: grid; grid-template-columns: 140px 1fr; gap: 18px; padding: 14px 0; border-top: 1px solid #e6eef2; }
.cv-row:first-of-type { border-top: 0; }
.cv-row dt { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; padding-top: 3px; }
.secret { text-align: center; }
.secret .big { font-size: 48px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center; background: rgba(6, 18, 30, .92); }
.lightbox.on { display: flex; }
.lightbox img { max-width: calc(100% - 140px); max-height: calc(100% - 60px); object-fit: contain; border-radius: 6px; }
.lightbox button { position: absolute; color: #fff; font-size: 40px; width: 56px; height: 56px; border-radius: 50%; }
.lightbox button:hover { background: rgba(255,255,255,.12); }
.lb-close { top: 14px; right: 14px; font-size: 32px !important; }
.lb-prev { left: 14px; } .lb-next { right: 14px; }

/* DOCK */
.dock {
  position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 900;
  display: flex; align-items: flex-end; gap: 8px; padding: 7px 10px;
  background: rgba(255,255,255,.55); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.75); border-radius: 20px; box-shadow: 0 10px 30px rgba(10,40,70,.18);
}
.dock-app { position: relative; transition: transform .15s ease; transform-origin: bottom; }
.dock-app span {
  width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center;
  background: var(--c); font-size: 22px; font-weight: 700; color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.1);
}
.dock-app span.sm { font-size: 13px; }
.dock-app:hover { transform: scale(1.22) translateY(-4px); }
.dock-app::after {
  content: attr(title); position: absolute; bottom: 62px; left: 50%; transform: translateX(-50%);
  background: rgba(15,28,43,.88); color: #fff; font-size: 12px; padding: 3px 9px; border-radius: 6px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.dock-app:hover::after { opacity: 1; }
.open-me::after { opacity: 1; background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.15); animation: bob 2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, -4px); } }
.dock-sep { width: 1px; height: 44px; background: rgba(0,0,0,.15); margin: 0 2px; align-self: center; }

/* voxel trail */
.sparkle-layer { position: fixed; inset: 0; pointer-events: none; z-index: 3000; overflow: hidden; }
.sparkle { position: absolute; line-height: 1; transform: translate(-50%, -50%); text-shadow: 0 0 6px rgba(52,211,153,.8); animation: sparkle-fade .9s ease-out forwards; }
@keyframes sparkle-fade {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.2) rotate(var(--r)); }
}

@media (prefers-reduced-motion: reduce) { *, *::after { animation: none !important; transition: none !important; } }

/* PHONES */
@media (max-width: 700px) {
  .status, .mb-link[data-open="terminal"], .mb-link[data-open="resume"] { display: none; }
  .menubar .left { gap: 6px; }
  .mb-link.strong { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
  #clock { font-size: 12px; }
  .desktop { overflow-y: auto; }
  #cloud { position: fixed; top: 30px; height: 60vh; }
  .sticky, .icon { touch-action: auto; cursor: default; }
  .sticky { position: relative; left: auto; top: auto; width: auto; margin: 16px 16px 0; transform: rotate(-1deg); }
  .welcome { position: relative; left: auto; top: auto; transform: none; margin: 28px 16px 10px; }
  #icons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 6px; padding: 12px 16px 120px; position: relative; }
  .icon { position: static; width: auto; transform: none; }
  .window { left: 8px !important; right: 8px; top: 8px !important; width: auto !important; max-height: calc(100% - 96px); position: fixed; margin-top: 30px; }
  .about-text, .cv { padding: 18px 18px 4px; }
  .about-grid { grid-template-columns: 1fr; }
  .about-banner { padding: 18px; }
  .story-head, .story-hero, .story-section { padding-left: 18px; padding-right: 18px; }
  .story-head h2 { font-size: 32px; }
  .story-section .row, .cv-row { grid-template-columns: 1fr; gap: 8px; }
  .figs.n2, .figs.n3, .pair { grid-template-columns: 1fr; }
  .lightbox img { max-width: 100%; max-height: calc(100% - 140px); }
  .lb-prev, .lb-next { top: auto; bottom: 20px; }
  .dock { gap: 4px; padding: 6px; max-width: calc(100% - 16px); }
  .dock-app span { width: 36px; height: 36px; font-size: 17px; border-radius: 9px; }
  .dock-app span.sm { font-size: 10px; }
  .dock-app::after { display: none; }
  .dock-sep { height: 32px; }
}

/* ===== MODO OSCURO ===== */
body, .desktop, .menubar, .dock, .window, .titlebar { transition: background-color .35s ease, color .35s ease, border-color .35s ease; }
body.dark { --ink: #e2edf5; --muted: #93a8b8; --paper: #07121e; --grid: rgba(56,189,248,.08); background: #050d16; color: var(--ink); }
body.dark .desktop {
  background-image:
    radial-gradient(ellipse at 15% 0%, rgba(52,211,153,.12), transparent 50%),
    radial-gradient(ellipse at 100% 100%, rgba(37,99,235,.18), transparent 55%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
}
body.dark .menubar { background: rgba(8,18,30,.75); border-color: rgba(255,255,255,.06); }
body.dark .mb-link:hover { background: rgba(255,255,255,.08); }
body.dark .welcome p { color: #a9bfd0; }
body.dark .welcome .tag { background: rgba(10,25,40,.7); color: #a7f3d0; border-color: rgba(52,211,153,.35); }
body.dark .label { color: #dbe8f2; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
body.dark .dock { background: rgba(12,24,38,.6); border-color: rgba(255,255,255,.1); }
body.dark .dock-sep { background: rgba(255,255,255,.15); }
body.dark .sticky { background: #134e4a; color: #ccfbf1; }
body.dark .sticky strong, body.dark .sticky li::before { color: #5eead4; }
body.dark .sticky .done { color: #7fb5ad; }
body.dark .window { background: #0d1a28; box-shadow: 0 24px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.08); }
body.dark .titlebar { background: #122234; border-color: #1c3048; }
body.dark .wtitle { color: #a9bfd0; }
body.dark .story, body.dark .photo-page { background: #0d1a28; }
body.dark .story-hero { background: #10202f; }
body.dark .story-section { border-color: #1c3048; }
body.dark .story .intro, body.dark .story-section p, body.dark .story-section ul, body.dark .story blockquote, body.dark .about-card p { color: #c3d4e0; }
body.dark .about-card, body.dark .repo { background: #10202f; border-color: #1c3048; }
body.dark .repo b { color: #7dd3fc; }
body.dark .chip { background: #132a3d; color: #a7f3d0; border-color: #1f3d55; }
body.dark .finder-item:hover { background: #132a3d; }
body.dark .contact hr, body.dark .cv-row { border-color: #1c3048; }
body.dark .btn { background: var(--teal); }
body.dark .btn.ghost { color: var(--ink); border-color: #2a4560; background: transparent; }
body.dark .lightbox { background: rgba(2,8,14,.95); }
body.dark .open-me::after { background: #132a3d; color: #e2edf5; }

body.dark .welcome h1 { color: #e0f2fe; text-shadow: 0 4px 0 rgba(52,211,153,.25); }
.story figure.phone { max-width: 300px; margin: 0 auto; }
.story figure.phone img { border-radius: 22px; }
/* terminal v2 */
.window.term .wbody { position: relative; min-height: 360px; }
.term .res { white-space: pre-wrap; margin-bottom: 6px; }
.term .muted { color: #7d8fa0; }
.term a { color: #7cc4ff; }
.term .lnk { color: #7cc4ff; font: inherit; padding: 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(124,196,255,.35); }
.term .lnk:hover { color: #a7f3d0; }
.term-in .p, .term .p { color: var(--mint); font-weight: 600; }
.term-in { align-items: baseline; }
.ff { display: flex; gap: 26px; align-items: flex-start; margin: 4px 0 8px; }
.ff pre { margin: 0; font: inherit; line-height: 1.3; white-space: pre; }
.ff-logo { font-size: 11.5px; }
.ff-info { color: #c9d1d9; }
.ff-c { display: inline-block; width: 22px; height: 14px; }
.matrix { position: absolute; left: 0; width: 100%; pointer-events: none; }
@media (max-width: 700px) { .ff-logo { display: none; } .ff-info { white-space: pre-wrap; } }
