/* ============================================================
   Tutol · Web Estudiante On-demand
   Shared design tokens + components
   ============================================================ */

:root {
  /* surfaces */
  --bg:        #E7E3DA;
  --surface:   #F4EFE5;
  --surface-2: #EDE8DE;
  --white:     #ffffff;

  /* ink */
  --ink:       #1C1A16;
  --ink-2:     #4A453D;
  --ink-3:     #6B655B;
  --muted:     #8A8377;
  --muted-2:   #9A9486;
  --faint:     #C2BBAD;

  /* blue */
  --blue:      #1C7CF6;
  --blue-2:    #2D6CDF;
  --blue-deep: #1356A8;
  --blue-tint: #E4F0FF;
  --blue-tint2:#EFF6FF;
  --blue-line: #CFE3FF;

  /* green */
  --green:     #103D2E;
  --green-2:   #0F3526;
  --mint:      #5ED39A;
  --mint-soft: #9FE8C2;
  --green-tint:#EEF3EC;
  --green-line:#D5E6D7;

  /* amber + red */
  --amber:     #EBA63B;
  --amber-2:   #E0A02A;
  --amber-tint:#FFF8EA;
  --amber-line:#F2DFB0;
  --red:       #E5392B;

  /* lines */
  --line:      #E7E0D2;
  --line-2:    #D8D0BF;
  --line-3:    #EFEADF;

  /* dark screens */
  --dark:      #14130F;
  --dark-2:    #0D0C0A;

  --font-display: 'Bricolage Grotesque', sans-serif;
  --font-body:    'Hanken Grotesk', sans-serif;
  --font-hand:    'Gloria Hallelujah', cursive;

  --radius: 16px;
  --shadow-card: 0 14px 34px -18px rgba(28,26,22,0.25);
  --shadow-pop:  0 50px 100px -30px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
svg { display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }
.display { font-family: var(--font-display); }
.hand    { font-family: var(--font-hand); }

/* ---- full-bleed screen base ---- */
.screen {
  width: 100%;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}
/* center the wide app layouts so they don't stretch infinitely */
.screen-inner { width: 100%; }

/* ---- interactive feedback ---- */
.click {
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease, background .15s ease, border-color .15s ease;
}
.click:hover   { transform: translateY(-1px); filter: brightness(1.02); }
.click:active  { transform: translateY(0); filter: brightness(0.98); }
.click:focus-visible { outline: 3px solid rgba(28,124,246,0.45); outline-offset: 2px; }

/* ---- modal-style screens (panel over dimmed backdrop) ---- */
.modal-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  position: relative;
}
.modal-dim {
  position: fixed; inset: 0;
  background: rgba(20,19,15,0.45);
  z-index: 0;
}
.modal-panel {
  position: relative;
  z-index: 1;
  max-width: 94vw;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
  animation: tutolPop .42s cubic-bezier(.2,.9,.25,1) both;
}

/* ---- toast ---- */
.toast-wrap {
  position: fixed; left: 50%; bottom: 30px;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  font-size: 14px; font-weight: 600;
  padding: 13px 20px;
  border-radius: 13px;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,0.55);
  display: flex; align-items: center; gap: 10px;
  animation: tutolToast .3s ease both;
}
.toast svg { flex: none; }

/* ---- page switcher FAB + overlay ---- */
.ps-fab {
  position: fixed; right: 22px; bottom: 22px;
  z-index: 9000;
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--ink); color: #fff;
  padding: 12px 16px; border: none; border-radius: 14px;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 700;
  box-shadow: 0 16px 34px -14px rgba(0,0,0,0.55);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease;
}
.ps-fab:hover { transform: translateY(-2px); }
.ps-fab .ps-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); }

.ps-overlay {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(15,14,11,0.72);
  backdrop-filter: blur(6px);
  display: none;
  padding: 5vh 4vw;
  overflow: auto;
}
.ps-overlay.open { display: block; animation: tutolFade .2s ease both; }
.ps-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  max-width: 1100px; margin: 0 auto 26px;
  color: #fff;
}
.ps-head h2 { font-family: var(--font-display); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; margin: 0; }
.ps-head p  { margin: 4px 0 0; font-size: 14px; color: #B9B3A6; }
.ps-close {
  background: rgba(255,255,255,0.12); color: #fff; border: none;
  width: 42px; height: 42px; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ps-close:hover { background: rgba(255,255,255,0.2); }
.ps-grid {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.ps-card {
  background: #fff; border-radius: 16px; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column;
  border: 1px solid rgba(0,0,0,0.05);
  transition: transform .14s ease, box-shadow .14s ease;
  text-align: left;
}
.ps-card:hover { transform: translateY(-3px); box-shadow: 0 24px 44px -22px rgba(0,0,0,0.6); }
.ps-card.current { outline: 3px solid var(--blue); }
.ps-thumb {
  height: 96px; position: relative;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 30px;
}
.ps-meta { padding: 13px 15px; }
.ps-meta .n { font-family: var(--font-display); font-weight: 800; font-size: 14px; color: var(--ink); }
.ps-meta .t { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.ps-meta .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }

/* ---- prev/next floating arrows ---- */
.flow-nav {
  position: fixed; bottom: 24px; left: 22px; z-index: 9000;
  display: flex; gap: 8px;
}
.flow-nav button {
  width: 42px; height: 42px; border-radius: 12px; border: none; cursor: pointer;
  background: rgba(255,255,255,0.9); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 24px -12px rgba(0,0,0,0.5);
  transition: transform .12s ease, background .12s ease;
}
.flow-nav button:hover { transform: translateY(-2px); background:#fff; }
.flow-nav button:disabled { opacity: 0.35; cursor: default; transform: none; }

/* ---- image-slot replacement ---- */
.image-slot {
  position: relative;
  background:
    linear-gradient(135deg, rgba(28,124,246,0.10), rgba(16,61,46,0.10)),
    repeating-linear-gradient(45deg, rgba(0,0,0,0.025) 0 12px, rgba(0,0,0,0) 12px 24px),
    var(--surface);
  border: 1.5px dashed var(--line-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center;
  color: var(--muted); font-size: 12.5px; font-weight: 600;
  overflow: hidden;
}
.image-slot.rounded { border-radius: 18px; }
.image-slot.circle  { border-radius: 50%; }
.image-slot.rect    { border-radius: 14px; }
.image-slot .is-ico { opacity: 0.7; }
.image-slot.video {
  border: none;
  background: linear-gradient(150deg, #2A3340, #14181F);
  color: #C9D2DE;
}
.image-slot.video::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.10), transparent 60%);
}

/* avatar (monogram + illustrated) */
.avatar {
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; flex: none;
  overflow: hidden; background-size: cover; background-position: center;
}
.avatar svg { width: 100%; height: 100%; }

/* segmented control helpers */
.seg { display: flex; gap: 6px; background: #EAE4D8; padding: 5px; border-radius: 14px; }
.seg span {
  flex: 1; text-align: center; font-size: 13px; font-weight: 600; color: var(--ink-3);
  padding: 9px 0; border-radius: 10px; cursor: pointer; transition: all .14s ease;
}
.seg span.on { font-weight: 700; color: var(--ink); background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* generic pill toggle (chips) */
.is-selected { background: var(--ink) !important; color: #fff !important; border-color: var(--ink) !important; }

/* keyframes (from source) */
@keyframes tutolRadar { 0% { transform: scale(0.3); opacity: 0.85; } 100% { transform: scale(2.1); opacity: 0; } }
@keyframes tutolSpin  { to { transform: rotate(360deg); } }
@keyframes tutolPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@keyframes tutolBlink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes tutolPop   { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes tutolFade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes tutolToast { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes tutolRise  { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.rise { animation: tutolRise .5s cubic-bezier(.2,.9,.25,1) both; }

/* ---- responsive: keep desktop fidelity, degrade gracefully ---- */
@media (max-width: 1320px) {
  .fluid-1280 { transform-origin: top center; }
}
@media (max-width: 900px) {
  .modal-panel { flex-direction: column !important; }
  .modal-panel > * { border-left: none !important; }
  .ps-grid { grid-template-columns: repeat(2, 1fr); }
  .hide-sm { display: none !important; }
  .stack-sm { flex-direction: column !important; }
}
@media (max-width: 560px) {
  .ps-grid { grid-template-columns: 1fr; }
}
