/* =========================================
   Pang Siang Lian Portfolio — Clean CSS v2
   Fixes: Story cards overlap / “Intelligence” blocked
   Notes:
   - Uses a single .container width
   - Uses a dedicated .nav-container for wider navbar
   - Story cards use .story-card and a .story-badge (NOT .step)
   ========================================= */

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

:root {
  --brand: #0b3d91;
  --text: #333;
  --muted: #6b7280;
  --bg: #fdfdfd;
  --surface: #ffffff;
  --border: #eee;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --radius: 12px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

/* ---------- Layout Containers ---------- */
.container {
  width: 90%;
  max-width: 900px; /* slightly wider for nicer layout */
  margin: 0 auto;
  padding: 2rem 0;
}

.nav-container {
  width: 92%;
  max-width: 1100px; /* navbar can be wider than content */
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

/* ---------- Header ---------- */
header {
  background: var(--brand);
  color: #fff;
  text-align: center;
  padding: 2.2rem 0;
}

header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.7rem);
  letter-spacing: -0.02em;
}

header p {
  margin: 0.6rem 0 0;
  font-size: clamp(1rem, 2vw, 1.2rem);
  opacity: 0.95;
}

/* Optional subheader for inner pages */
.subheader {
  background: var(--brand);
  color: #fff;
  text-align: center;
  padding: 2.2rem 0;
}

.subheader h1,
.subheader h2 {
  margin: 0;
}

/* ---------- Sections ---------- */
section {
  border-bottom: 1px solid var(--border);
  padding: 3rem 0;
}

section h2 {
  color: var(--brand);
  font-size: 1.9rem;
  margin: 0 0 1rem;
  letter-spacing: -0.01em;
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 2rem 0;
  background: #f4f4f4;
}

footer a {
  color: var(--brand);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ---------- Navbar (slim + centered) ---------- */
.navbar{
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.navbar .container{
  /* slim height */
  padding: 0.7rem 0;
  display: flex;
  justify-content: center;     /* centered links */
  align-items: center;
  gap: 1.4rem;
}


.navbar a {
  text-decoration: none;
  color: var(--brand);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.35rem 0.25rem;
  border-radius: 8px;
}

.navbar a:hover {
  text-decoration: underline;
}

.navbar a.active {
  text-decoration: underline;
}

/* ---------- Links (Connect section) ---------- */
.connect a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
}

.connect a:hover {
  text-decoration: underline;
}

/* ---------- Diagram Image ---------- */
.diagram {
  margin: 2rem auto;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

/* ---------- Generic Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 0.5rem;
  color: var(--brand);
}

/* ---------- 2-Column Grid ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* =========================================
   Story (4 Steps) — NEW CLEAN LAYOUT
   Fixes blocking issue by:
   - Reserving space for badge using padding-top
   - Badge positioned safely, not covering title
   - No class name collision with .step
   ========================================= */

.story-steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.75rem;
}

@media (min-width: 900px) {
  .story-steps {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
  }
}

.story-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  padding-top: 2.6rem; /* space for badge */
  box-shadow: var(--shadow);
  min-height: 220px; /* keeps cards aligned */
  overflow: hidden;
}

.story-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  box-shadow: 0 6px 16px rgba(11, 61, 145, 0.25);
}

.story-card h3 {
  margin: 0;
  color: var(--brand);
  font-size: 1.35rem;
  line-height: 1.2;
  padding-right: 3.2rem; /* prevents overlap with badge */
}

.story-card p {
  margin: 0.75rem 0 0;
  font-size: 0.98rem;
  color: var(--text);
}

/* Optional “flow” hint under title */
.story-kicker {
  margin-top: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* =========================================
   Optional: Flow row with arrows (if you use it elsewhere)
   Keep this separate from story cards
   ========================================= */

.flow {
  display: grid;
  gap: 0.75rem;
  align-items: stretch;
}

@media (min-width: 900px) {
  .flow {
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    align-items: center;
  }
}

.flow-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.flow-badge {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.arrow {
  text-align: center;
  font-size: 1.6rem;
  color: var(--brand);
  display: none;
}

@media (min-width: 900px) {
  .arrow {
    display: block;
  }
}
