/* ============================================================
   TSIA2 Summer Bridge Slideshow — style.css
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg:       #fffaf3;
  --ink:      #2f2b28;
  --muted:    #685d56;
  --accent:   #d9825b;
  --accent-2: #f0b36b;
  --accent-3: #c96454;
  --card:     #ffffff;
  --border:   #d8b894;
  --green:    #234a3a;
  --shadow:   rgba(71, 45, 25, 0.16);
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Georgia, "Times New Roman", serif;
  background: radial-gradient(circle at top left, #fff6e8, var(--bg));
  color: var(--ink);
}

body { overflow: hidden; }

/* ---------- Deck shell ---------- */
.deck {
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

/* ---------- Slide ---------- */
.slide {
  display: none;
  height: calc(100dvh - 78px);
  padding: clamp(16px, 4vw, 54px);
  position: relative;
  overflow: auto;
}

.slide.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: fade 220ms ease-in-out;
}

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Frame card ---------- */
.frame {
  border: 3px double var(--border);
  background: rgba(255, 255, 255, 0.74);
  min-height: min(82dvh, 760px);
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: clamp(24px, 4vw, 52px);

  /* Room for the pill that sits at the top-left corner */
  padding-top: clamp(54px, 6vw, 72px);

  position: relative;
  box-shadow: 0 14px 36px var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---------- Pill — always top-left of the frame ---------- */
.pill {
  position: absolute;
  top: clamp(14px, 2vw, 20px);
  left: clamp(18px, 2.5vw, 28px);

  background: #fff0df;
  border: 1px solid var(--border);
  color: var(--accent-3);
  padding: 7px 14px;
  border-radius: 999px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: clamp(.78rem, 1.1vw, .95rem);
  white-space: nowrap;

  /* Override any inherited display/inline-block that could shift layout */
  display: inline-block;
  width: fit-content;
}

/* ---------- Typography ---------- */
h1, h2 {
  margin: 0 0 clamp(14px, 2.5vw, 24px);
  font-weight: 500;
  line-height: 1.05;
  color: #3f3936;
}
h1 { font-size: clamp(2.6rem, 7.2vw, 6.2rem); }
h2 { font-size: clamp(2rem, 5vw, 4.2rem); }

p, li, td, th, a {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1rem, 1.55vw, 1.45rem);
  line-height: 1.38;
}

p { margin: 0 0 16px; color: var(--muted); }

a {
  color: #9c3f31;
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}
a:hover { text-decoration: underline; }

.big {
  font-size: clamp(1.28rem, 2.2vw, 2.05rem);
  color: var(--ink);
}

.subtitle {
  font-size: clamp(1.1rem, 2vw, 1.75rem);
  max-width: 980px;
  color: var(--muted);
}

.max { max-width: 1050px; }
.center { text-align: center; }

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 18px);
  margin-top: 14px;
}

.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid #ead2b4;
  border-radius: 18px;
  padding: clamp(16px, 2.2vw, 22px);
  box-shadow: 0 8px 20px rgba(71, 45, 25, .08);
}
.card strong { color: var(--accent-3); }

/* ---------- Flow diagram ---------- */
.flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 20px;
}

.flow-step {
  border: 1px solid #e2c39f;
  background: white;
  border-radius: 16px;
  padding: 18px;
  text-align: center;
  position: relative;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1rem, 1.5vw, 1.35rem);
}

.flow-step:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-3);
  font-weight: 900;
  font-size: 1.6rem;
  z-index: 2;
}

/* ---------- Table ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(71, 45, 25, .08);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

th {
  background: #f5dcc0;
  text-align: left;
  color: #3f3936;
  font-weight: 800;
}

th, td {
  padding: clamp(10px, 1.5vw, 16px);
  border-bottom: 1px solid #ecd9c3;
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }

/* ---------- List ---------- */
ul {
  margin: 12px 0 0;
  padding-left: 1.35em;
}

/* ---------- Blockquote style ---------- */
.quote {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 3vw, 2.8rem);
  line-height: 1.15;
  color: #3f3936;
  border-left: 8px solid var(--accent);
  padding-left: 22px;
  margin: 22px 0;
}

.tiny {
  font-size: clamp(.8rem, 1.1vw, .95rem);
  color: #82756d;
}

/* ---------- Link grid ---------- */
.link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.link-card {
  background: #ffffff;
  border: 1px solid #ead2b4;
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: 0 8px 20px rgba(71, 45, 25, .08);
}

.link-card .label {
  display: block;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 900;
  color: var(--accent-3);
  margin-bottom: 4px;
  font-size: clamp(1rem, 1.4vw, 1.25rem);
}

/* ---------- Teacher grid ---------- */
.teacher-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 24px;
  align-items: center;
}

.portrait-box {
  min-height: 300px;
  border: 2px dashed #d8b894;
  border-radius: 22px;
  background: #fff8ef;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: center;
  font-weight: 700;
}

/* ---------- Decorative leaves ---------- */
.leaf {
  position: absolute;
  width: 112px;
  height: 112px;
  opacity: .85;
  pointer-events: none;
}
.leaf.top    { right: 20px; top: 14px; }
.leaf.bottom { left: 20px; bottom: 14px; transform: rotate(180deg); }

.leaf::before,
.leaf::after {
  content: "";
  position: absolute;
  border-radius: 60% 5% 60% 5%;
  background: var(--green);
  width: 58px;
  height: 36px;
  transform: rotate(45deg);
}
.leaf::before { left: 0; top: 18px; }
.leaf::after  { right: 0; bottom: 24px; }

.flower {
  position: absolute;
  width: 44px;
  height: 44px;
  background: var(--accent-3);
  border-radius: 50%;
  left: 40px;
  top: 46px;
  box-shadow: 23px 8px 0 #d65345, 9px 25px 0 #cf6b54;
}

/* ---------- Controls bar ---------- */
.controls {
  height: 78px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border-top: 1px solid #e2c39f;
  background: rgba(255, 250, 243, .96);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ctrl-left { display: flex; gap: 10px; }

button {
  border: 1px solid var(--border);
  background: white;
  color: var(--ink);
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(71, 45, 25, .08);
  width: 110px;        /* uniform width so Prev and Next match */
  text-align: center;
}
button:hover    { background: #fff0df; }
button:disabled { opacity: .45; cursor: not-allowed; }

.progress {
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.hint {
  text-align: right;
  color: var(--muted);
  font-size: .95rem;
}

/* ---------- Slide number badge (bottom-right of frame) ---------- */
.slide-num {
  position: absolute;
  bottom: clamp(12px, 1.8vw, 18px);
  right: clamp(18px, 2.5vw, 28px);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(.75rem, 1vw, .9rem);
  color: #b0a095;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  /* Solid warm white — no transparency bleeding on dark OS themes */
  html, body {
    background: #fffaf3;
  }

  body { overflow: auto; }
  .deck { min-height: 100dvh; }

  .slide {
    height: auto;
    min-height: calc(100dvh - 68px);
    padding: 10px 10px 16px;
  }
  .slide.active { justify-content: flex-start; }

  /* Fully opaque frame, tighter padding */
  .frame {
    background: #ffffff;
    min-height: unset;
    padding: 14px 16px 20px;
    padding-top: 52px;
    border-radius: 16px;
    /* Softer shadow on mobile */
    box-shadow: 0 6px 18px rgba(71, 45, 25, .10);
  }

  /* Tighter headings */
  h1 { font-size: clamp(1.9rem, 8vw, 3rem); }
  h2 { font-size: clamp(1.5rem, 6vw, 2.2rem); }

  /* Smaller body text */
  p, li, td, th, a {
    font-size: clamp(.9rem, 3.8vw, 1.1rem);
    line-height: 1.45;
  }

  .big {
    font-size: clamp(1rem, 4.2vw, 1.25rem);
  }

  .subtitle {
    font-size: clamp(.95rem, 3.8vw, 1.1rem);
  }

  .quote {
    font-size: clamp(1.1rem, 5vw, 1.6rem);
    border-left-width: 5px;
    padding-left: 14px;
    margin: 14px 0;
  }

  /* Single-col cards with less padding */
  .cards, .three, .link-grid, .teacher-grid { grid-template-columns: 1fr; }
  .cards { gap: 10px; margin-top: 10px; }

  .card { padding: 12px 14px; border-radius: 14px; }

  /* Flow diagram vertical */
  .flow { grid-template-columns: 1fr; gap: 28px; }
  .flow-step { padding: 12px 16px; }
  .flow-step:not(:last-child)::after {
    content: "↓";
    right: 50%;
    top: auto;
    bottom: -25px;
    transform: translateX(50%);
  }

  /* Link cards */
  .link-card { padding: 12px 14px; border-radius: 14px; }

  /* Controls — compact and safe above browser chrome */
  .controls {
    height: 68px;
    padding: 8px 14px;
    grid-template-columns: auto 1fr;
    gap: 10px;
  }

  .ctrl-left { gap: 8px; }

  button {
    padding: 9px 14px;
    font-size: .9rem;
    width: 88px;
  }

  .progress {
    text-align: right;
    font-size: .9rem;
  }

  .hint { display: none; }
  .leaf { display: none; }

  table { display: block; overflow-x: auto; font-size: .85rem; }
  th, td { padding: 8px 10px; }

  /* Pill slightly smaller */
  .pill {
    font-size: .72rem;
    padding: 5px 11px;
    top: 12px;
    left: 14px;
  }
}

/* ---------- Print ---------- */
@media print {
  body { overflow: visible; background: white; }
  .controls { display: none; }
  .slide {
    display: block !important;
    page-break-after: always;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .frame { box-shadow: none; }
}