/* ===== Theme (Finance/Quant, sober) ===== */
:root {
  --bg: #fafaf9;
  --card: #ffffff;
  --text: #0b1220;
  --muted: #667085;
  --accent: #004b87; /* primary navy */
  --accent-ink: #062440; /* dark ink text */
  --ring: #e7e5e4;
  --ring-strong: #d6d3d1;
  --shadow: 0 8px 24px rgba(2, 6, 23, 0.06);
  --radius: 14px;

  /* uniform tile height (you asked for consistent size) */
  --tile-uniform-h: 200px;
}

/* ===== Base ===== */
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(
    1600px 800px at 50% -10%,
    #ffffff 0%,
    #fafaf9 50%,
    #f7f7f7 100%
  );
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, Segoe UI,
    Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px;
}

h1,
h2,
h3 {
  letter-spacing: 0.2px;
}
h1 {
  font-weight: 800;
}
h2 {
  font-weight: 700;
}

.card {
  background: var(--card);
  border: 1px solid var(--ring);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.muted {
  color: var(--muted);
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}
a:hover {
  text-decoration: underline;
}

/* ===== Hero ===== */
.hero {
  padding-top: 42px;
  padding-bottom: 8px;
  text-align: center;
}
.hero-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
  justify-content: center;
}
.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #f3f4f6;
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  border: 1px solid var(--ring);
}
.hero-name {
  margin: 0;
  font-size: clamp(28px, 3.6vw, 42px);
  font-weight: 800;
  color: var(--accent-ink);
}
.hero-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: clamp(14px, 1.8vw, 16px);
}
.hero-blurb {
  margin-top: 12px;
  color: #2b3445;
  font-family: "Source Serif 4", ui-serif, Georgia, Cambria, "Times New Roman",
    serif;
  font-size: clamp(16px, 2.1vw, 18px);
  text-align: center;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Buttons ===== */
.btn {
  background: var(--accent);
  color: #fff;
  border: 1px solid #003b6c;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: filter 0.12s ease, transform 0.06s ease;
}
.btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}
.btn.ghost {
  background: #fff;
  color: var(--accent-ink);
  border: 1px solid var(--ring);
}
.btn.ghost:hover {
  background: #f6f7f9;
}

/* ===== Section header ===== */
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 10px;
}
.section-head h2 {
  margin: 0;
  font-size: 20px;
  color: var(--accent-ink);
}
.section-head .muted {
  margin: 0;
}

/* ===== Tiles (homepage cards) ===== */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 14px;

  /* your request: center the grid + each tile in its cell */
  justify-content: center;
  justify-items: center;
}
.tile {
  background: linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(145deg, #eeedeb, #e6e4e1) border-box;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 18px;
  min-height: var(--tile-uniform-h); /* uniform height */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease, box-shadow 0.15s ease,
    border-color 0.15s ease;
}
.tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.1);
  border-color: var(--ring-strong);
}
.tile .tile-top {
  display: flex;
  align-items: center;
  gap: 14px;
}
.tile .icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: #f4f5f7;
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 800;
  border: 1px solid var(--ring);
}
.tile .title {
  font-weight: 800;
  margin: 0;
  line-height: 1.25;
  word-break: break-word;
  font-size: 17px;
}
.tile .meta {
  color: var(--muted);
  font-size: 0.95em;
  margin-top: 4px;
}
.tile .desc {
  color: #2b3445;
  font-size: 0.97em;
  margin-top: 10px;
  line-height: 1.5;
  font-family: "Source Serif 4", ui-serif, Georgia, Cambria, "Times New Roman",
    serif;
  flex: 1 1 auto; /* lets actions sit at bottom for equal heights */
}
.tile .tile-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
  justify-content: center; /* your request: center the Open button row */
}
.badge.btnlike {
  background: #fff;
  border: 1px solid var(--ring);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  transition: background-color 0.12s ease, transform 0.06s ease;
}
.badge.btnlike:hover {
  background: #f7fafc;
  transform: translateY(-1px);
}

/* ===== Project card w/ cover (inner pages) ===== */
.cover {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--ring);
  box-shadow: var(--shadow);
  background: #eef2f5;
  margin-bottom: 14px;
}
.cover img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}
.card-cover {
  padding: 0;
  overflow: hidden;
}
.card-cover .cover-head {
  position: relative;
  height: 220px;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--ring);
}
.card-cover .cover-head::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.45) 100%
  );
}
.card-cover .head-content {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  z-index: 1;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 14px;
}
.card-cover .head-content .title {
  margin: 0;
  font-weight: 800;
  font-size: 20px;
}
.card-cover .head-content .meta {
  opacity: 0.9;
  font-size: 0.95em;
}
.card-cover .head-content .icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(2px);
}
.card-cover .card-body {
  padding: 18px;
}

/* ===== Footer ===== */
.foot {
  color: var(--muted);
  text-align: center;
  margin-bottom: 26px;
}

/* ===== Responsive ===== */
@media (max-width: 520px) {
  .hero-top {
    align-items: flex-start;
  }
  .hero-name {
    font-size: 26px;
  }
  .cover img {
    height: 160px;
  }
  .card-cover .cover-head {
    height: 170px;
  }
  .tiles {
    grid-template-columns: 1fr;
  }
}

/* === Uniform card height + centered actions (non-breaking) === */
:root {
  --tile-h: 300px; /* tweak if you want taller/shorter cards */
  --tile-desc-lines: 4; /* how many lines of description to show */
}

.tile {
  height: var(--tile-h); /* force same height for all tiles */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Make description take the extra space but clamp lines so heights stay equal */
.tile .desc {
  flex: 1 1 auto;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: var(--tile-desc-lines);
  -webkit-box-orient: vertical;
}

/* Keep buttons centered at the bottom (you already asked for this) */
.tile .tile-actions {
  justify-content: center;
}

/* === Center the tile grid without changing your base styles === */
:root {
  --tile-w: 320px;
} /* adjust to taste; matches your current card size */
.tiles--center {
  /* fixed-width columns so the grid no longer stretches to 1fr */
  grid-template-columns: repeat(auto-fit, minmax(var(--tile-w), var(--tile-w)));

  /* shrink-wrap the grid to its content and center it */
  width: fit-content;
  margin-left: auto;
  margin-right: auto;

  /* keep gaps & centering consistent */
  justify-content: center;
  justify-items: stretch;
}

/* responsive: allow 2 per row on tablets, 1 per row on phones */
@media (max-width: 860px) {
  .tiles--center {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
}
@media (max-width: 520px) {
  .tiles--center {
    grid-template-columns: 1fr;
  }
}

/* keep the Open button centered (already done, but just in case) */
.tile .tile-actions {
  justify-content: center;
}

/* === Force 3 centered columns (desktop), 2 (tablet), 1 (mobile) === */
.tiles.centered {
  display: grid;
  grid-template-columns: repeat(3, 320px); /* 3 cards per row */
  gap: 18px;
  justify-content: center; /* center the whole grid block */
  justify-items: stretch; /* tiles fill their column */
}

.tile.narrow {
  width: 320px;
  max-width: 320px;
} /* equal widths */

/* Tablet: 2 per row */
@media (max-width: 1060px) {
  .tiles.centered {
    grid-template-columns: repeat(2, 320px);
  }
}

/* Mobile: 1 per row */
@media (max-width: 700px) {
  .tiles.centered {
    grid-template-columns: 1fr;
  }
  .tile.narrow {
    width: 100%;
    max-width: 520px;
  }
}

/* === FLEX TILES: max 3 per row, centered === */
.tiles.centered {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;

  /* cap container width so >3 never fits */
  max-width: calc(3 * 340px + 2 * 16px); /* 3 tiles + 2 gaps */
  margin-left: auto;
  margin-right: auto;
}

.tile.narrow {
  width: 340px;
  flex: 0 0 340px; /* fixed basis so wrapping is clean */
  max-width: 90vw; /* prevent overflow on tiny screens */
}

/* optional: single-column on very small screens */
@media (max-width: 560px) {
  .tile.narrow {
    width: 100%;
    flex: 0 0 100%;
    max-width: 360px;
  }
}
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}
body {
  background: linear-gradient(180deg, #f9fafc 0%, #f1f3f8 100%);
  color: #111;
  font-family: system-ui, sans-serif;
}
section {
  background: white;
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 32px;
}
section h3::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  background: var(--accent, #2b67f6);
  margin: 8px auto 16px;
  border-radius: 2px;
}
