/* ═══════════════════════════════════════════════════════════════════════════
   Portfolio · escritorio estilo macOS
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --accent: #0a7aff;
  --accent-soft: rgba(10, 122, 255, .12);
  --green: #28c840;

  /* Ventanas (modo claro) */
  --win-bg: #ffffff;
  --win-sidebar: rgba(236, 236, 240, .82);
  --win-toolbar: rgba(250, 250, 252, .92);
  --win-border: rgba(0, 0, 0, .16);
  --win-divider: rgba(0, 0, 0, .09);
  --win-shadow: 0 22px 70px rgba(0, 0, 0, .34), 0 0 0 .5px rgba(0, 0, 0, .22);
  --text: #1d1d1f;
  --text-2: #55555c;
  --text-3: #86868b;
  --hover: rgba(0, 0, 0, .05);
  --chip: #f1f1f4;
  --row-alt: #f6f6f8;

  /* Barras de cristal */
  --menubar-bg: rgba(246, 240, 236, .42);
  --menubar-text: #1d1d1f;
  --menu-panel: rgba(246, 246, 248, .86);
  --dock-bg: rgba(255, 255, 255, .26);
  --dock-border: rgba(255, 255, 255, .42);

  --menubar-h: 28px;
  --dock-h: 78px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, .2);
    --win-bg: #1e1e20;
    --win-sidebar: rgba(44, 44, 48, .84);
    --win-toolbar: rgba(40, 40, 43, .94);
    --win-border: rgba(255, 255, 255, .14);
    --win-divider: rgba(255, 255, 255, .09);
    --win-shadow: 0 22px 70px rgba(0, 0, 0, .6), 0 0 0 .5px rgba(0, 0, 0, .7);
    --text: #f5f5f7;
    --text-2: #c7c7cc;
    --text-3: #8e8e93;
    --hover: rgba(255, 255, 255, .07);
    --chip: #2c2c30;
    --row-alt: #252528;
    --menu-panel: rgba(40, 40, 44, .86);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: #6b5446 url("../assets/img/fondo.webp") center 62% / cover no-repeat fixed;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: default; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ─── Barra de menú ───────────────────────────────────────────────────────── */

.menubar {
  position: fixed; inset: 0 0 auto 0; z-index: 9000;
  height: var(--menubar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px;
  background: var(--menubar-bg);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  color: var(--menubar-text);
  font-size: 13px;
  box-shadow: 0 .5px 0 rgba(0, 0, 0, .12);
}
.menubar-left, .menubar-right { display: flex; align-items: center; gap: 2px; height: 100%; }
.menu { position: relative; height: 100%; display: flex; align-items: center; }
.menu-title {
  height: 22px; padding: 0 9px; border-radius: 5px;
  font-weight: 500; white-space: nowrap;
}
.menu-title:hover, .menu.open .menu-title { background: rgba(0, 0, 0, .1); }
.menu-logo { padding: 0 8px; }
.monogram {
  display: grid; place-items: center;
  width: 17px; height: 17px; border-radius: 5px;
  background: var(--menubar-text); color: #f4ede8;
  font-weight: 700; font-size: 11px; letter-spacing: -.02em;
}
.menu-app { font-weight: 700; padding: 0 9px 0 4px; white-space: nowrap; }
.lang-title { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12px; letter-spacing: .03em; }
.lang-title svg { width: 14px; height: 14px; }
.status-icon { width: 17px; height: 17px; margin: 0 6px; }
.status-icon.battery { width: 26px; height: 13px; }
.menu-clock { padding: 0 6px 0 8px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }

.menu-panel {
  position: absolute; top: calc(100% + 2px); left: 0;
  min-width: 230px; padding: 5px;
  background: var(--menu-panel);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-radius: 10px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .26), 0 0 0 .5px rgba(0, 0, 0, .2);
  color: var(--text);
  display: none;
}
.menu-right .menu-panel { left: auto; right: 0; min-width: 160px; }
.menu.open .menu-panel { display: block; }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 4px 10px; border-radius: 5px; text-align: left; text-decoration: none;
  white-space: nowrap;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--accent); color: #fff; outline: none; }
.menu-item[aria-disabled="true"] { color: var(--text-3); pointer-events: none; }
.menu-item .check { width: 12px; font-size: 11px; }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--win-divider); }

/* ─── Escritorio e iconos ─────────────────────────────────────────────────── */

.desktop {
  position: fixed; inset: var(--menubar-h) 0 0 0;
}
.desktop-icons {
  position: absolute; top: 14px; right: 14px; bottom: calc(var(--dock-h) + 18px);
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 112px);
  grid-auto-columns: 98px;
  direction: rtl;
  gap: 4px 6px;
}
.desk-icon {
  direction: ltr;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 98px; padding: 4px 2px;
  border-radius: 6px;
}
.desk-icon .folder-svg {
  width: 72px; height: 60px; padding: 3px 4px; border-radius: 6px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .22));
  transition: transform .12s ease;
}
.desk-icon:active .folder-svg { transform: scale(.96); }
.desk-icon-label {
  max-width: 100%;
  padding: 1px 6px; border-radius: 4px;
  color: #fff; font-size: 12px; font-weight: 600; line-height: 1.25; text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .75), 0 0 1px rgba(0, 0, 0, .6);
}
.desk-icon.selected .folder-svg { background: rgba(0, 0, 0, .22); }
.desk-icon.selected .desk-icon-label { background: #1a64d6; text-shadow: none; }

.widget { display: none; }

/* ─── Ventanas ────────────────────────────────────────────────────────────── */

.windows { position: absolute; inset: 0; pointer-events: none; }
.window {
  position: absolute;
  display: grid; grid-template-columns: 188px 1fr;
  min-width: 420px; min-height: 280px;
  background: var(--win-bg);
  border-radius: 12px;
  box-shadow: var(--win-shadow);
  overflow: hidden;
  pointer-events: auto;
  user-select: text; -webkit-user-select: text;
  animation: win-open .22s cubic-bezier(.2, .9, .3, 1.1);
}
.window.no-sidebar { grid-template-columns: 1fr; }
.window[hidden] { display: none; }
.window.closing { animation: win-close .16s ease-in forwards; }
.window.minimizing { transition: transform .32s cubic-bezier(.5, 0, .9, .5), opacity .32s; opacity: 0; pointer-events: none; }
.window.maximized { border-radius: 0; }
.window.dragging { transition: none; }
.window.resizable { resize: both; }

@keyframes win-open { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes win-close { to { opacity: 0; transform: scale(.95); } }

/* Barra lateral */
.win-sidebar {
  display: flex; flex-direction: column;
  background: var(--win-sidebar);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  border-right: .5px solid var(--win-divider);
  overflow-y: auto;
  user-select: none; -webkit-user-select: none;
}
.win-sidebar-top { height: 52px; flex: none; display: flex; align-items: center; padding: 0 16px; }
.side-group { padding: 4px 10px 10px; }
.side-heading { margin: 6px 8px 3px; font-size: 11px; font-weight: 600; color: var(--text-3); }
.side-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 4px 8px; border-radius: 6px; text-align: left; text-decoration: none;
  font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-item:hover { background: var(--hover); }
.side-item.active { background: rgba(0, 0, 0, .08); font-weight: 500; }
@media (prefers-color-scheme: dark) { .side-item.active { background: rgba(255, 255, 255, .1); } }
.side-item svg { width: 16px; height: 16px; flex: none; color: var(--accent); }

/* Semáforo */
.traffic { display: flex; gap: 8px; }
.traffic button {
  width: 12px; height: 12px; border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .18);
}
.traffic .t-close { background: #ff5f57; }
.traffic .t-min { background: #febc2e; }
.traffic .t-zoom { background: #28c840; }
.traffic svg { width: 8px; height: 8px; opacity: 0; color: rgba(0, 0, 0, .55); }
.traffic:hover svg { opacity: 1; }
.window:not(.focused) .traffic button { background: #d0d0d3; }
@media (prefers-color-scheme: dark) { .window:not(.focused) .traffic button { background: #4a4a4e; } }
.window:not(.focused) .traffic:hover .t-close { background: #ff5f57; }
.window:not(.focused) .traffic:hover .t-min { background: #febc2e; }
.window:not(.focused) .traffic:hover .t-zoom { background: #28c840; }

/* Zona principal */
.win-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.win-toolbar {
  height: 52px; flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: var(--win-toolbar);
  border-bottom: .5px solid var(--win-divider);
  user-select: none; -webkit-user-select: none;
}
.win-nav { display: flex; gap: 2px; }
.icon-btn {
  width: 28px; height: 26px; border-radius: 6px;
  display: grid; place-items: center; color: var(--text-2);
}
.icon-btn:hover:not(:disabled) { background: var(--hover); }
.icon-btn:disabled { opacity: .3; }
.icon-btn svg { width: 16px; height: 16px; }
.win-title {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win-title svg { width: 18px; height: 15px; flex: none; }
.win-tools { display: flex; align-items: center; gap: 6px; }
.win-home { display: none; }
.lang-switch { display: flex; align-items: center; gap: 8px; color: var(--text-3); }
.lang-switch > svg { width: 16px; height: 16px; flex: none; }
.lang-switch .segmented button { min-width: 34px; padding: 3px 9px; font-weight: 600; letter-spacing: .02em; }
.lang-switch .segmented button[aria-pressed="true"] { color: var(--accent); }

.win-content { flex: 1; overflow: auto; overscroll-behavior: contain; }
.win-status {
  flex: none; height: 26px; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-3);
  border-top: .5px solid var(--win-divider);
  user-select: none; -webkit-user-select: none;
}

/* Control segmentado (filtros de proyectos) */
.segmented {
  display: inline-flex; padding: 2px; border-radius: 7px;
  background: rgba(0, 0, 0, .06);
}
@media (prefers-color-scheme: dark) { .segmented { background: rgba(255, 255, 255, .08); } }
.segmented button { padding: 3px 11px; border-radius: 5px; font-size: 12px; font-weight: 500; color: var(--text-2); }
.segmented button[aria-pressed="true"] { background: var(--win-bg); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 7px;
  font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
  background: var(--chip); color: var(--text);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .12);
  cursor: pointer;
}
.btn:hover { filter: brightness(.96); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: none; }
.btn svg { width: 14px; height: 14px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ─── Contenido de las carpetas ───────────────────────────────────────────── */

.pane { padding: 26px 30px 30px; max-width: 880px; }
.pane-title {
  margin: 0 0 18px;
  font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15;
}
.pane-title em { font-style: normal; color: var(--accent); }
.pane-sub { margin: 28px 0 10px; font-size: 15px; font-weight: 700; }
.pane p { line-height: 1.6; font-size: 14px; color: var(--text-2); margin: 0 0 12px; }

/* Sobre mí */
.about-hero { display: flex; gap: 26px; align-items: center; }
.about-photo {
  width: 150px; height: 190px; flex: none;
  border-radius: 14px; object-fit: cover;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px; border-radius: 999px;
  background: rgba(40, 200, 64, .13); color: #1a8a2e;
  font-size: 12px; font-weight: 600;
}
@media (prefers-color-scheme: dark) { .badge { color: #4cd964; } }
.badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(40, 200, 64, .6); animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(40, 200, 64, 0); } 100% { box-shadow: 0 0 0 0 rgba(40, 200, 64, 0); } }
.about-name { margin: 10px 0 8px; font-size: 34px; font-weight: 700; letter-spacing: -.03em; line-height: 1.05; }
.about-hero p { font-size: 14.5px; }
.about-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.about-body { margin-top: 26px; padding-top: 22px; border-top: .5px solid var(--win-divider); }
.about-body .pane-title { font-size: 22px; }
.about-body .lead { font-size: 15.5px; color: var(--text); }

/* Proyectos */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.project {
  display: flex; flex-direction: column;
  border-radius: 12px; overflow: hidden;
  background: var(--row-alt);
  box-shadow: 0 0 0 .5px var(--win-divider);
}
.project-thumb { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; background: var(--chip); }
.project-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.project-name { margin: 0; font-size: 15px; font-weight: 700; }
.project-body p { margin: 0; font-size: 13px; line-height: 1.5; }
.project-note { font-size: 12px !important; color: var(--text-3) !important; font-style: italic; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 600;
}
.project-links { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; }

/* Listas tipo Finder */
.list { border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 .5px var(--win-divider); }
.row {
  display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start;
  padding: 13px 16px;
}
.row:nth-child(even) { background: var(--row-alt); }
.row-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.row-icon svg { width: 18px; height: 18px; }
.row-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.35; }
.row-meta { margin: 2px 0 0; font-size: 12px; color: var(--text-3); }
.row-desc { margin: 6px 0 0 !important; font-size: 13px !important; }

.lang-table { display: grid; grid-template-columns: max-content 1fr; }
.lang-table > div { padding: 9px 16px; font-size: 13.5px; }
.lang-table > div:nth-child(4n+1), .lang-table > div:nth-child(4n+2) { background: var(--row-alt); }
.lang-name { font-weight: 600; }
.lang-level { color: var(--text-2); }

/* Certificaciones */
.cert-head, .cert-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 170px 86px 78px;
  gap: 12px; align-items: center; padding: 8px 14px;
}
.cert-head { font-size: 11px; font-weight: 600; color: var(--text-3); border-bottom: .5px solid var(--win-divider); }
.cert-row { width: 100%; text-align: left; font-size: 13px; border-radius: 0; cursor: pointer; }
.cert-row:nth-child(odd) { background: var(--row-alt); }
.cert-row:hover { background: var(--accent-soft); }
.cert-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 500; color: var(--text); }
.cert-name span { overflow: hidden; text-overflow: ellipsis; }
.cert-name svg { width: 22px; height: 28px; flex: none; }
.cert-issuer, .cert-date { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cert-desc { grid-column: 1 / -1; margin: -2px 0 2px 32px !important; font-size: 12px !important; color: var(--text-3) !important; }
.cert-more { padding: 3px 8px; border-radius: 6px; color: var(--accent); font-size: 12px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.cert-more:hover { background: var(--accent-soft); }
.cert-static { cursor: default; }
.cert-static:hover { background: transparent; }
.cert-static:nth-child(odd):hover { background: var(--row-alt); }

/* Herramientas */
.tool-group + .tool-group { margin-top: 22px; }
.tool-group h3 { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 13px; border-radius: 9px;
  background: var(--row-alt); box-shadow: 0 0 0 .5px var(--win-divider);
  font-size: 13.5px; font-weight: 500; color: var(--text);
}

/* Papelera */
.empty { height: 100%; min-height: 220px; display: grid; place-content: center; text-align: center; gap: 4px; padding: 30px; }
.empty strong { font-size: 15px; }
.empty span { color: var(--text-3); }

/* Vista Previa */
.preview-frame { width: 100%; height: 100%; border: 0; display: block; background: #525659; }
.preview-fallback { height: 100%; display: grid; place-content: center; gap: 14px; text-align: center; padding: 30px; }
.preview-fallback svg { width: 54px; height: 68px; margin: 0 auto; }

/* Mail */
.mail { display: flex; flex-direction: column; height: 100%; }
.mail-intro { padding: 20px 22px 14px; border-bottom: .5px solid var(--win-divider); }
.mail-intro .pane-title { font-size: 21px; margin-bottom: 8px; }
.mail-intro p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.mail-field {
  display: flex; align-items: center; gap: 8px;
  padding: 0 22px; min-height: 38px;
  border-bottom: .5px solid var(--win-divider);
}
.mail-field label, .mail-field .lbl { flex: none; width: 70px; color: var(--text-3); font-size: 13px; }
.mail-field input {
  flex: 1; min-width: 0; height: 36px; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 13.5px; color: var(--text);
}
.mail-to { display: inline-flex; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 500; }
.mail textarea {
  flex: 1; min-height: 120px; resize: none; border: 0; outline: 0; background: transparent;
  padding: 14px 22px; font: inherit; font-size: 14px; line-height: 1.55; color: var(--text);
}
.mail-honey { position: absolute; left: -9999px; }
.mail-status { padding: 0 22px 14px; font-size: 12.5px; color: var(--text-3); }
.mail-status.ok { color: #1a8a2e; }
.mail-status.err { color: #d70015; }

/* ─── Dock ────────────────────────────────────────────────────────────────── */

.dock-wrap {
  position: fixed; left: 0; right: 0; bottom: 6px; z-index: 8000;
  display: flex; justify-content: center;
  pointer-events: none;
}
.dock {
  display: flex; align-items: flex-end; gap: 4px;
  padding: 5px 6px 5px;
  background: var(--dock-bg);
  border: .5px solid var(--dock-border);
  border-radius: 22px;
  backdrop-filter: blur(26px) saturate(170%);
  -webkit-backdrop-filter: blur(26px) saturate(170%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25), inset 0 .5px 0 rgba(255, 255, 255, .35);
  pointer-events: auto;
}
.dock-item {
  --size: 54px;
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  width: var(--size);
  text-decoration: none; cursor: default;
  transition: width .14s ease-out;
}
.dock-icon {
  display: block; width: var(--size); height: var(--size);
  transition: width .14s ease-out, height .14s ease-out;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .22));
}
.dock-icon svg, .dock-icon img { width: 100%; height: 100%; display: block; }
.dock-label {
  position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%);
  padding: 4px 10px; border-radius: 6px;
  background: rgba(30, 30, 32, .82); color: #fff;
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .12s;
  backdrop-filter: blur(10px);
}
.dock-item:hover .dock-label, .dock-item:focus-visible .dock-label { opacity: 1; }
.dock-dot {
  position: absolute; bottom: -4px; width: 4px; height: 4px; border-radius: 50%;
  background: rgba(30, 30, 32, .75); opacity: 0;
}
.dock-item.running .dock-dot { opacity: 1; }
.dock-sep { width: 1px; align-self: stretch; margin: 6px 5px; background: rgba(255, 255, 255, .45); }
.dock-minimized { display: contents; }
.dock-min-item .dock-icon {
  border-radius: 10px; background: rgba(255, 255, 255, .55);
  display: grid; place-items: center;
}
.dock-min-item .dock-icon svg { width: 74%; height: 74%; }

.dock-item.bounce .dock-icon { animation: bounce .7s ease; }
@keyframes bounce { 0%, 100% { transform: none; } 30% { transform: translateY(-18px); } 55% { transform: none; } 75% { transform: translateY(-6px); } }

/* Aviso flotante */
.toast {
  position: fixed; left: 50%; top: 44px; z-index: 9500;
  transform: translate(-50%, -12px);
  padding: 10px 16px; border-radius: 12px;
  background: var(--menu-panel); color: var(--text);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25), 0 0 0 .5px rgba(0, 0, 0, .15);
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript {
  position: fixed; inset: 60px 20px auto; z-index: 9999; max-width: 560px; margin: 0 auto;
  padding: 24px; border-radius: 14px; background: #fff; color: #1d1d1f; font-size: 15px; line-height: 1.5;
}

/* Elementos que solo existen en el móvil */
.app-icon, .widgets, .search-pill, .spotlight, .home-indicator, .btn-ico { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Móvil · estilo iPhone
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  :root { --menubar-h: 44px; --dock-h: 92px; }

  body { background-color: #2a221c; background-image: url("../assets/img/fondo-movil.webp"); background-position: center; background-attachment: scroll; }

  /* Barra de estado */
  .menubar {
    background: transparent; box-shadow: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    color: #fff; padding: env(safe-area-inset-top) 22px 0;
    height: calc(var(--menubar-h) + env(safe-area-inset-top));
    text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
  .menu[data-menu="main"], .menu-app, .menu[data-menu="go"], .menu[data-menu="window"] { display: none; }
  .menubar-left { order: 0; }
  .menubar-left::before { content: attr(data-time); font-weight: 600; font-size: 16px; }
  .menu-clock { display: none; }
  .status-icon { color: #fff; }
  .lang-title { background: rgba(255, 255, 255, .22); color: #fff; height: 24px; border-radius: 999px; padding: 0 10px; }
  .menu-title:hover, .menu.open .menu-title { background: rgba(255, 255, 255, .32); }
  .desktop { inset: calc(var(--menubar-h) + env(safe-area-inset-top)) 0 0 0; }

  /* Widgets: perfil y calendario, como en la pantalla de inicio de un iPhone */
  .widgets {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    width: min(100% - 32px, 400px);
  }
  .widget {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-end;
    aspect-ratio: 1; padding: 14px; border-radius: 22px; text-align: left;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .16);
  }
  .widget-profile { background: linear-gradient(160deg, #5f9df2 0%, #2f62c8 100%); color: #fff; gap: 3px; }
  .widget-profile img {
    position: absolute; top: 14px; left: 14px; width: 46px; height: 46px;
    border-radius: 50%; object-fit: cover; object-position: center 22%;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .55);
  }
  .widget-name { font-size: 18px; font-weight: 700; line-height: 1.12; letter-spacing: -.01em; }
  .widget-sub { font-size: 12.5px; font-weight: 500; opacity: .92; line-height: 1.25; }
  .widget-cal { background: rgba(255, 255, 255, .93); color: #1d1d1f; justify-content: flex-start; }
  .cal-day { font-size: 12px; font-weight: 700; color: #ff3b30; text-transform: uppercase; letter-spacing: .02em; }
  .cal-num { font-size: 42px; font-weight: 300; line-height: 1.05; letter-spacing: -.02em; }
  .cal-text { margin-top: auto; font-size: 13px; font-weight: 500; line-height: 1.3; color: #3a3a3c; }

  /* Iconos de app, con el nombre debajo */
  .desktop-icons {
    top: calc(12px + (min(100vw - 32px, 400px) - 14px) / 2 + 30px);
    left: 50%; right: auto; bottom: auto; transform: translateX(-50%);
    width: min(100% - 32px, 400px);
    direction: ltr; grid-auto-flow: row;
    grid-template-rows: none; grid-template-columns: repeat(4, 1fr); grid-auto-columns: auto;
    gap: 22px 0;
  }
  .desk-icon { width: auto; padding: 0; gap: 6px; }
  .desk-icon .folder-svg { display: none; }
  .app-icon {
    display: grid; place-items: center;
    width: 62px; height: 62px; border-radius: 14.5px;
    background: linear-gradient(180deg, var(--g1), var(--g2));
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .22), inset 0 .5px 0 rgba(255, 255, 255, .45);
    transition: transform .1s;
  }
  .app-icon svg { width: 34px; height: 34px; stroke-width: 1.7; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .18)); }
  .desk-icon:active .app-icon { transform: scale(.93); }
  .desk-icon.selected .desk-icon-label { background: none; }
  .desk-icon-label { font-size: 11.5px; font-weight: 500; padding: 0; letter-spacing: -.01em; text-shadow: 0 1px 3px rgba(0, 0, 0, .55); }

  /* Píldora de búsqueda sobre el dock */
  .search-pill {
    display: inline-flex; align-items: center; gap: 6px;
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(108px + env(safe-area-inset-bottom)); z-index: 7500;
    padding: 6px 16px; border-radius: 999px;
    background: rgba(255, 255, 255, .28); color: #fff;
    font-size: 13px; font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow: inset 0 .5px 0 rgba(255, 255, 255, .4);
  }
  .search-pill svg { width: 12px; height: 12px; }
  body.win-open .search-pill { display: none; }

  /* Buscador */
  .spotlight {
    position: fixed; inset: 0; z-index: 9400;
    display: flex; justify-content: center; align-items: flex-start;
    padding: calc(var(--menubar-h) + env(safe-area-inset-top)) 0 0;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  }
  .spotlight[hidden] { display: none; }
  .spotlight-box { width: 100%; max-width: 480px; padding: 8px 14px; }
  .spotlight-field {
    display: flex; align-items: center; gap: 10px;
    height: 38px; padding: 0 12px; border-radius: 12px;
    background: rgba(255, 255, 255, .22); color: #fff;
  }
  .spotlight-field svg { width: 16px; height: 16px; flex: none; opacity: .85; }
  .spotlight-field input {
    flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
    color: #fff; font: inherit; font-size: 16px;
  }
  .spotlight-field input::placeholder { color: rgba(255, 255, 255, .7); }
  .spotlight-field button { color: #fff; font-size: 15px; padding-left: 4px; cursor: pointer; }
  .spotlight-results { margin-top: 12px; max-height: calc(100dvh - 160px); overflow-y: auto; }
  .spotlight-results h3 { margin: 14px 8px 6px; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .78); }
  .spot-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 9px 12px; margin-bottom: 6px; border-radius: 12px;
    background: rgba(255, 255, 255, .2); color: #fff;
    font-size: 16px; text-align: left; text-decoration: none; cursor: pointer;
  }
  .spot-item .app-icon { width: 34px; height: 34px; border-radius: 8px; flex: none; }
  .spot-item .app-icon svg { width: 20px; height: 20px; }
  .spot-none { padding: 30px 0; text-align: center; color: rgba(255, 255, 255, .85); }

  /* Barra de inicio: cierra la app abierta */
  .home-indicator {
    display: block; position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(6px + env(safe-area-inset-bottom)); z-index: 9300;
    width: 136px; height: 22px; padding: 0; background: none;
    opacity: 0; pointer-events: none; cursor: pointer;
  }
  .home-indicator::after {
    content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 5px;
    border-radius: 3px; background: var(--text); opacity: .55;
  }
  body.win-open .home-indicator { opacity: 1; pointer-events: auto; }

  /* Ventanas a pantalla completa */
  .window, .window.no-sidebar {
    position: fixed !important;
    inset: 0 !important; width: auto !important; height: auto !important;
    min-width: 0; min-height: 0;
    grid-template-columns: 1fr;
    border-radius: 0; resize: none !important;
    z-index: 9100 !important;
    will-change: transform;
    animation: app-in .4s cubic-bezier(.2, .85, .25, 1);
  }
  .window.closing { animation: app-out .3s cubic-bezier(.5, 0, .8, .4) forwards; }
  /* La app crece desde su icono y vuelve a él al cerrarse */
  @keyframes app-in {
    from { transform: scale(.14); opacity: 0; border-radius: 46px; }
    30% { opacity: 1; }
    to { transform: none; opacity: 1; border-radius: 0; }
  }
  @keyframes app-out {
    from { transform: none; opacity: 1; border-radius: 0; }
    to { transform: scale(.14); opacity: 0; border-radius: 46px; }
  }
  .win-sidebar { display: none; }
  .win-toolbar {
    height: auto; min-height: 52px;
    padding: calc(var(--menubar-h) + env(safe-area-inset-top) + 2px) 12px 8px;
    flex-wrap: wrap;
    background: var(--win-bg);
  }

  /* Con una ventana abierta: barra de estado oscura sobre la cabecera y sin dock */
  body.win-open .menubar { z-index: 9200; color: var(--text); text-shadow: none; }
  body.win-open .status-icon { color: var(--text); }
  body.win-open .lang-title { background: var(--chip); color: var(--text); }
  body.win-open .dock-wrap { display: none; }
  .traffic, .win-nav { display: none; }
  .win-home {
    display: inline-flex; align-items: center; gap: 2px;
    color: var(--accent); font-size: 16px; font-weight: 500; padding: 4px 2px;
  }
  .win-home svg { width: 20px; height: 20px; }
  .win-title { justify-content: center; font-size: 16px; }
  .win-tools { min-width: 60px; justify-content: flex-end; }
  .win-tools .segmented { order: 5; }
  .window[data-folder="projects"] .win-tools { flex-basis: 100%; justify-content: center; order: 5; }
  .win-status { display: none; }
  .win-content { padding-bottom: calc(env(safe-area-inset-bottom) + 26px); }

  .pane { padding: 20px 18px 40px; }
  .scroll-section { margin-top: 6px; border-top: .5px solid var(--win-divider); }
  .scroll-section .pane { padding-top: 26px; }
  .win-content { scroll-behavior: smooth; }
  .pane-title { font-size: 23px; }
  .about-hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .about-photo { width: 110px; height: 140px; }
  .about-name { font-size: 30px; }
  .projects-grid { grid-template-columns: 1fr; }

  .cert-head { display: none; }
  .cert-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
  .cert-issuer { grid-column: 1; padding-left: 32px; font-size: 12px; }
  .cert-date { grid-column: 2; grid-row: 2; text-align: right; font-size: 12px; }
  .cert-more { grid-column: 2; grid-row: 1; }
  .cert-desc { grid-row: 3; }

  .mail-field label, .mail-field .lbl { width: 62px; }

  /* Dock de iPhone */
  .dock-wrap { bottom: calc(10px + env(safe-area-inset-bottom)); padding: 0 14px; }
  .dock { gap: 0; justify-content: space-around; width: 100%; max-width: 400px; padding: 12px 14px; border-radius: 32px; }
  .dock-item { --size: 58px !important; }
  .dock-label, .dock-sep, .dock-minimized, .dock-item[data-dock="trash"], .dock-dot { display: none; }

  .toast { top: calc(56px + env(safe-area-inset-top)); }

  /* ─── Aspecto de app nativa de iOS ─────────────────────────────────────── */

  :root {
    --ios-bg: #f2f2f7;
    --ios-card: #ffffff;
    --ios-bar: rgba(242, 242, 247, .86);
    --ios-sep: rgba(60, 60, 67, .2);
    --ios-fill: rgba(120, 120, 128, .12);
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --ios-bg: #000000;
      --ios-card: #1c1c1e;
      --ios-bar: rgba(22, 22, 24, .82);
      --ios-sep: rgba(84, 84, 88, .65);
      --ios-fill: rgba(120, 120, 128, .24);
    }
  }

  .window, .window.no-sidebar { background: var(--ios-bg); }

  /* Barra de navegación translúcida: «‹ Volver», título centrado y acciones */
  .win-toolbar {
    position: relative; z-index: 2;
    flex-wrap: nowrap; align-items: center; gap: 6px;
    padding: calc(var(--menubar-h) + env(safe-area-inset-top) + 2px) 10px 8px;
    min-height: 0;
    background: var(--ios-bar);
    backdrop-filter: blur(22px) saturate(180%); -webkit-backdrop-filter: blur(22px) saturate(180%);
    border-bottom: .5px solid transparent;
    transition: border-color .2s;
  }
  .window.scrolled .win-toolbar { border-bottom-color: var(--ios-sep); }
  .win-home { flex: none; font-size: 17px; padding: 6px 4px 6px 0; }
  .win-home svg { width: 22px; height: 22px; margin-left: -4px; }
  .win-title { flex: 1; justify-content: center; font-size: 17px; font-weight: 600; min-width: 0; }
  .win-title svg { width: 20px; height: 17px; }
  .win-tools { flex: none; min-width: 0; }
  .window[data-folder="projects"] .win-tools { flex-basis: auto; order: 0; }
  .window[data-folder="projects"] .win-toolbar { flex-wrap: wrap; }
  .window[data-folder="projects"] .win-tools { flex-basis: 100%; justify-content: center; order: 5; padding-top: 6px; }

  .lang-switch > svg { display: none; }
  .lang-switch .segmented { background: var(--ios-fill); border-radius: 9px; padding: 2px; }
  .lang-switch .segmented button { min-width: 32px; padding: 4px 8px; font-size: 12.5px; border-radius: 7px; }
  .lang-switch .segmented button[aria-pressed="true"] { background: var(--ios-card); color: var(--text); }

  /* Contenido: fondo gris agrupado y tarjetas blancas redondeadas */
  .win-content { background: var(--ios-bg); }
  .pane { max-width: none; padding: 6px 16px 30px; }
  .pane-title { margin: 8px 2px 14px; font-size: 30px; font-weight: 700; letter-spacing: -.025em; line-height: 1.12; }
  .pane-title em { color: inherit; }
  .pane-sub { margin: 24px 16px 8px; font-size: 13px; font-weight: 400; color: var(--text-3); text-transform: uppercase; letter-spacing: .01em; }
  .scroll-section { margin-top: 10px; border-top: 0; }
  .scroll-section .pane { padding-top: 14px; }

  .list { background: var(--ios-card); border-radius: 12px; box-shadow: none; }
  .row { position: relative; padding: 12px 16px; }
  .row:nth-child(even) { background: transparent; }
  .row + .row::before { content: ""; position: absolute; top: 0; left: 62px; right: 0; height: .5px; background: var(--ios-sep); }
  .row-title { font-size: 16px; }
  .row-meta { font-size: 13px; }
  .row-desc { font-size: 14px !important; }

  .lang-table > div { background: transparent !important; padding: 12px 16px; }
  .lang-table > div:nth-child(n+3) { border-top: .5px solid var(--ios-sep); }

  .cert-row:nth-child(odd) { background: transparent; }
  .cert-row:hover { background: transparent; }
  .cert-row { padding: 11px 16px; }
  .cert-row + .cert-row { border-top: .5px solid var(--ios-sep); }
  .cert-row:active { background: var(--ios-fill); }
  .cert-more { color: var(--accent); }

  .chip { background: var(--ios-card); box-shadow: none; border-radius: 10px; }
  .tool-group h3 { margin-left: 4px; font-weight: 400; }

  /* Proyectos: tarjetas estilo App Store */
  .projects-grid { gap: 16px; }
  .project { background: var(--ios-card); border-radius: 16px; box-shadow: none; }
  .project-body { padding: 14px 16px 16px; }
  .project-name { font-size: 18px; letter-spacing: -.01em; }
  .btn { background: var(--accent-soft); color: var(--accent); box-shadow: none; border-radius: 999px; font-weight: 600; }
  .btn-primary { background: var(--accent); color: #fff; }

  /* Sobre mí: tarjeta de perfil como en Contactos */
  .about-hero { flex-direction: column; align-items: center; text-align: center; gap: 4px; padding-top: 6px; }
  .about-photo { width: 112px; height: 112px; border-radius: 50%; object-position: center 18%; box-shadow: none; margin-bottom: 6px; }
  .about-name { margin: 8px 0 8px; font-size: 28px; letter-spacing: -.02em; }
  .about-hero p { font-size: 15px; line-height: 1.5; }
  .about-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; margin-top: 16px; }
  .about-actions .btn, .about-actions .btn-primary {
    flex-direction: column; justify-content: center; gap: 5px;
    padding: 11px 4px 10px; border-radius: 12px;
    background: var(--ios-card); color: var(--accent);
    font-size: 12px; font-weight: 500; white-space: normal; line-height: 1.15;
  }
  .btn-ico { display: grid; place-items: center; width: 26px; height: 26px; }
  .btn-ico svg { width: 24px; height: 24px; }
  .about-body { margin-top: 18px; padding: 16px; border-top: 0; background: var(--ios-card); border-radius: 12px; }
  .about-body .lead { font-size: 16px; }
  .about-body p:last-child { margin-bottom: 0; }

  /* Correo y Vista Previa también sobre fondo agrupado */
  .mail, .mail-intro { background: var(--ios-card); }
  .mail { border-radius: 0; }
}
