/* ═══════════════════════════════════════════════════════════════════
   Mi Rincón de Sueños — Hoja de estilos principal
   Paleta: Verde claro + Dorado
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tokens de diseño ──────────────────────────────────────────────── */
:root {
  /* Colores */
  --green-100:  #e8f5e9;
  --green-200:  #c8e6c9;
  --green-400:  #66bb6a;
  --green-500:  #4caf50;
  --green-700:  #388e3c;
  --gold-300:   #ffe082;
  --gold-400:   #ffd54f;
  --gold-500:   #ffc107;
  --gold-600:   #ffb300;
  --gold-700:   #ff8f00;

  /* Semánticos — modo claro (por defecto) */
  --bg:         #f4faf4;
  --bg-card:    #ffffff;
  --bg-raised:  #edf7ed;
  --fg:         #1b3a1c;
  --fg-muted:   #4a7a4c;
  --fg-subtle:  #7aab7b;
  --border:     #c8e0c9;
  --accent:     var(--green-500);
  --accent-dim: var(--green-200);
  --gold:       var(--gold-500);
  --gold-dim:   var(--gold-300);
  --shadow-sm:  0 1px 4px rgba(56,142,60,.10);
  --shadow-md:  0 4px 16px rgba(56,142,60,.14);
  --shadow-lg:  0 8px 32px rgba(56,142,60,.18);

  /* Tipografía */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Radio */
  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  18px;
  --r-xl:  24px;

  /* Transición */
  --ease:  .18s ease;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:         #0f1f10;
    --bg-card:    #162617;
    --bg-raised:  #1c3020;
    --fg:         #d8f0d9;
    --fg-muted:   #90c991;
    --fg-subtle:  #5a8f5b;
    --border:     #2a4a2b;
    --accent:     #69c46d;
    --accent-dim: #1e4020;
    --gold:       var(--gold-400);
    --gold-dim:   #3a2800;
    --shadow-sm:  0 1px 4px rgba(0,0,0,.35);
    --shadow-md:  0 4px 16px rgba(0,0,0,.45);
    --shadow-lg:  0 8px 32px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:         #0f1f10;
  --bg-card:    #162617;
  --bg-raised:  #1c3020;
  --fg:         #d8f0d9;
  --fg-muted:   #90c991;
  --fg-subtle:  #5a8f5b;
  --border:     #2a4a2b;
  --accent:     #69c46d;
  --accent-dim: #1e4020;
  --gold:       var(--gold-400);
  --gold-dim:   #3a2800;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.35);
  --shadow-md:  0 4px 16px rgba(0,0,0,.45);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.55);
  color-scheme: dark;
}

/* ── Reset y base ───────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,600;0,700;1,600&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--gold-700); }

code, kbd, pre {
  font-family: var(--font-mono);
  font-size: .88em;
}

code {
  background: var(--accent-dim);
  color: var(--green-700);
  padding: .15em .4em;
  border-radius: 4px;
}

img { max-width: 100%; display: block; }

ul { margin: 0; padding-left: 1.4em; }

/* ── HEADER ─────────────────────────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, var(--green-700) 0%, var(--green-500) 100%);
  color: #fff;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .9rem max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.brand-icon {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.2));
}

.brand-text h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.brand-sub {
  font-size: .75rem;
  color: rgba(255,255,255,.75);
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Nav */
.header-nav {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}

.nav-link {
  color: rgba(255,255,255,.85);
  padding: .4rem .85rem;
  border-radius: 20px;
  font-size: .88rem;
  font-weight: 500;
  transition: background var(--ease), color var(--ease);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,.18);
  color: #fff;
}

.nav-link.active {
  background: var(--gold);
  color: var(--green-700);
}

/* ── HERO ───────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(160deg, var(--green-200) 0%, var(--gold-300) 100%);
  padding: 3.5rem max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero--small { padding-block: 2rem; }

.hero-inner { max-width: 640px; margin: 0 auto; }

.hero-eyebrow {
  margin: 0 0 .5rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--green-700);
}

.hero-title {
  margin: 0 0 .75rem;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 5vw, 2.9rem);
  line-height: 1.15;
  color: var(--fg);
  text-wrap: balance;
}

.hero-title em {
  font-style: italic;
  color: var(--gold-700);
}

.hero-desc {
  margin: 0;
  color: var(--fg-muted);
  font-size: 1.05rem;
}

/* ── MAIN ───────────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ── BREADCRUMB ─────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
  font-size: .88rem;
}

.bc-link {
  color: var(--accent);
  font-weight: 500;
}

.bc-link:hover { color: var(--gold-700); }

.bc-sep { color: var(--fg-subtle); }

.bc-current {
  color: var(--fg-muted);
  font-weight: 500;
}

/* ── TOOLBAR ────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.toolbar-info { display: flex; gap: .5rem; flex-wrap: wrap; }

.stat-pill {
  background: var(--accent-dim);
  color: var(--green-700);
  padding: .3rem .8rem;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.toolbar-actions { display: flex; gap: .4rem; }

.view-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg-muted);
  font-size: 1.1rem;
  transition: all var(--ease);
  cursor: pointer;
}

.view-btn:hover, .view-btn.active {
  background: var(--gold);
  border-color: var(--gold-600);
  color: var(--green-700);
}

/* ── FILE GRID ──────────────────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.file-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1.2rem .9rem .9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  text-align: center;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
  cursor: pointer;
}

.file-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--gold);
  text-decoration: none;
}

.card-icon {
  font-size: 2.5rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.12));
}

.card-name {
  font-size: .82rem;
  font-weight: 500;
  color: var(--fg);
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
  width: 100%;
}

.card-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  width: 100%;
}

/* ── FILE LIST TABLE ────────────────────────────────────────────────── */
.file-table-wrap { overflow-x: auto; }

.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  min-width: 500px;
}

.file-table th {
  background: var(--bg-raised);
  color: var(--fg-muted);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 600;
  padding: .6rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

.file-table td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.file-row:hover td { background: var(--bg-raised); }

.row-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--fg);
  font-weight: 500;
}

.row-link:hover { color: var(--accent); }

.row-icon { font-size: 1.1rem; flex-shrink: 0; }

.col-size, .col-date {
  color: var(--fg-muted);
  font-size: .84rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── TYPE BADGES ────────────────────────────────────────────────────── */
.type-badge {
  display: inline-block;
  padding: .15em .55em;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: var(--accent-dim);
  color: var(--green-700);
}

.size-label {
  font-size: .72rem;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}

/* Colores por tipo */
.type-image  .type-badge { background: #e8f5e9; color: #2e7d32; }
.type-video  .type-badge { background: #e3f2fd; color: #1565c0; }
.type-audio  .type-badge { background: #f3e5f5; color: #6a1b9a; }
.type-pdf    .type-badge { background: #ffebee; color: #b71c1c; }
.type-doc    .type-badge { background: #e3f2fd; color: #0d47a1; }
.type-sheet  .type-badge { background: #e8f5e9; color: #1b5e20; }
.type-ppt    .type-badge { background: #fff3e0; color: #e65100; }
.type-zip    .type-badge { background: #fafafa; color: #424242; }
.type-code   .type-badge { background: #f9fbe7; color: #33691e; }
.type-text   .type-badge { background: var(--accent-dim); color: var(--green-700); }
.type-folder .type-badge { background: var(--gold-dim); color: var(--gold-700); }

/* ── ALERT / EMPTY ──────────────────────────────────────────────────── */
.alert-box {
  background: #fff8e1;
  border: 1px solid var(--gold);
  border-radius: var(--r-md);
  padding: 1.2rem 1.4rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  color: var(--fg);
  margin-bottom: 1.5rem;
}

.alert-icon { font-size: 1.4rem; flex-shrink: 0; }

.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--fg-muted);
}

.empty-icon { font-size: 3.5rem; margin-bottom: .75rem; }

.empty-state h3 {
  margin: 0 0 .5rem;
  font-family: var(--font-display);
  color: var(--fg);
}

.empty-state p { margin: 0; }

/* ── BUTTONS ────────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.3rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: .9rem;
  transition: all var(--ease);
  cursor: pointer;
  border: none;
  line-height: 1;
}

.btn-primary {
  background: var(--gold);
  color: var(--green-700);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--gold-600);
  color: var(--green-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-raised);
  color: var(--fg);
}

/* ── FILE DETAIL ────────────────────────────────────────────────────── */
.file-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.detail-header {
  background: linear-gradient(135deg, var(--green-100) 0%, var(--gold-300) 100%);
  padding: 1.5rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.detail-icon { font-size: 3rem; line-height: 1; }

.detail-title h2 {
  margin: 0 0 .4rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--fg);
  word-break: break-word;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  font-size: .84rem;
  color: var(--fg-muted);
}

.detail-actions {
  padding: 1rem 1.5rem;
  display: flex;
  gap: .75rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── PREVIEW ────────────────────────────────────────────────────────── */
.preview-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.preview-image {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-raised);
}

.preview-image img {
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
}

.preview-video video,
.preview-audio audio {
  width: 100%;
  display: block;
}

.preview-video { background: #000; }

.preview-audio {
  padding: 2rem 1.5rem;
  background: var(--bg-raised);
}

.preview-pdf iframe {
  width: 100%;
  height: 70vh;
  border: none;
  display: block;
}

.preview-text {
  overflow: hidden;
}

.code-toolbar {
  background: var(--bg-raised);
  padding: .5rem 1rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.code-lang {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--fg-muted);
  text-transform: uppercase;
}

.code-block {
  margin: 0;
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  font-size: .84rem;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg-card);
  white-space: pre;
  max-height: 70vh;
}

.no-preview {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--fg-muted);
}

.np-icon { font-size: 3.5rem; margin-bottom: .75rem; }

/* ── GALLERY ────────────────────────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}

.gallery-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
  display: flex;
  flex-direction: column;
}

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--gold);
  text-decoration: none;
}

.gallery-thumb {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--bg-raised);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.gallery-item:hover .gallery-thumb img { transform: scale(1.06); }

.gallery-caption {
  padding: .6rem .8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}

.gallery-name {
  font-size: .8rem;
  font-weight: 500;
  color: var(--fg);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.gallery-size {
  font-size: .72rem;
  color: var(--fg-subtle);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── ACERCA ─────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold-600);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: .82rem;
  color: var(--fg-muted);
  margin-top: .3rem;
}

.about-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.section-title {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--fg);
  padding-bottom: .6rem;
  border-bottom: 2px solid var(--gold);
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.about-block h3 {
  margin: 0 0 .6rem;
  font-size: 1rem;
  color: var(--fg);
}

.about-block p {
  margin: 0 0 .6rem;
  color: var(--fg-muted);
  font-size: .93rem;
}

.tech-list {
  color: var(--fg-muted);
  font-size: .9rem;
  line-height: 2;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.info-table th {
  text-align: left;
  padding: .6rem .8rem;
  background: var(--bg-raised);
  color: var(--fg-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  width: 35%;
}

.info-table td {
  padding: .6rem .8rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}

.info-table tr:last-child th,
.info-table tr:last-child td { border-bottom: none; }

/* ── FOOTER ─────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--green-700);
  color: rgba(255,255,255,.75);
  padding: 1rem max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  font-size: .82rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.footer-sep { opacity: .4; }

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .header-inner { gap: .5rem; }
  .brand-text h1 { font-size: 1.1rem; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .detail-header { padding: 1.1rem; }
  .detail-title h2 { font-size: 1.1rem; }
  .about-grid { grid-template-columns: 1fr; }
  .hero { padding-block: 2rem; }
  .hero-title { font-size: 1.7rem; }
}

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