/* Smooth scroll for in-page anchors */
html {
  scroll-behavior: smooth;
}

/* ===== Base ===== */
:root{
  --card-w: 280px;
  --gap: 16px;
  --app-h: 230px;
  --gold: #DDB84B;
  --name-color: #E8C15A;
  --text: #f0e7d5;
  --bg1: #1c1c1c;
  --bg2: #2e2e2e;
  --border: #3a3a3a;
}

*{ box-sizing:border-box; margin:0; padding:0; }

/* ===== Overscroll / bounce fix ===== */
html, body {
  background-color: var(--bg1);
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* Safari bounce fix fallback */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg1);
  z-index: -1;
}

html{ background: linear-gradient(#2a2a29, var(--bg1)) no-repeat fixed; }
body{ font-family: 'OpenSans', Helvetica, Arial, sans-serif; color: var(--text); padding:15px 0 40px; }

/* ===== Identity ===== */
.identity-row{ display:flex; align-items:center; justify-content:flex-start; gap:20px; width: calc(3 * var(--card-w) + 2 * var(--gap)); max-width:none; margin:0 auto; padding:10px 0 0px; }
.identity-photo img#headshot{ height:160px; width:auto; border-radius:8px; object-fit:cover; display:block; }
.identity-meta{ display:flex; flex-direction:column; row-gap:6px; }
/* (removed duplicate .miguel-title) */
.identity-subtitle{ color: var(--gold); font-weight:400; font-size: 24px; }
.identity-subtitle-2{ color: var(--text); font-weight:300; font-size: 16px; opacity: 99%; }
.identity-email{ color:#ddd; text-decoration:none; font-size: 16px; opacity: 97%; }
.identity-email:hover{ color:#fff; text-decoration:underline; }

/* LinkedIn-style compact second line */
.miguel-title{
  font-size: 46px;
  font-weight: 500;
  letter-spacing: .2px;
  line-height: 1.08;
  margin-bottom: 2px;
  color: var(--name-color);
}

.meta-line{ font-size: 17px; line-height: 1.25; }

.meta-line .role {
  font-weight: 550;
  color: var(--text);
}

.meta-line .stack {
  font-weight: 400;
  font-size: 16px;
  color: rgba(240,231,213,.85);
}

.identity-email {
  font-size: 15px;
  color: rgba(240,231,213,.7);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px dotted rgba(255,255,255,.2);
  transition: color .15s ease, border-color .15s ease;
}
.identity-email:hover,
.identity-email:focus {
  color: var(--gold);
  border-bottom-color: var(--gold);
  outline: none;
}

.meta-line .sep {
  opacity: .55;
  margin: 0 6px;
}

/* Tighten on small screens */
@media (max-width:520px){
  .meta-line{ gap:8px; }
  .meta-line .hairline{ display:none; }
}

/* ===== Containers to lock widths ===== */
.container{ margin:0 auto; }
.container--three{ width: calc(3 * var(--card-w) + 2 * var(--gap)); }
.container--four{ width: calc(4 * var(--card-w) + 3 * var(--gap)); }
@media(max-width:900px){
  .identity-row, .container--three, .container--four{ width: calc(100% - 32px); padding-left:16px; padding-right:16px; justify-content: center; align-items: center; }
}

/* ===== Dividers + headings ===== */
.divider{ height:1px; background:rgba(221,184,75,.55); margin:20px 0; }
.section-heading{ font-size:28px; line-height:1; color:var(--gold); text-align:center; font-weight:400; margin: 0 0 0; }
.project-heading{ font-size:20px; line-height:1; color:var(--gold); text-align:center; font-weight:400; margin: 0 0 0; }

/* ===== Grids ===== */
.cards{ display:grid; grid-template-columns:1fr; gap:var(--gap); }
@media(min-width:901px){
  .container--three .cards{ grid-template-columns: repeat(3, var(--card-w)); justify-content:center; }
  .container--four .cards{ grid-template-columns: repeat(4, var(--card-w)); justify-content:center; }
}

/* ===== Cards ===== */
.card{ min-width: var(--card-w); max-width: var(--card-w); background:var(--bg2); border:1px solid var(--border); border-radius:8px; padding:14px; color:inherit; text-decoration:none; display:flex; flex-direction:column; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.card:hover{ transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 4px 16px rgba(247,206,70,.12); }

/* ===== Connect ===== */
.connect-grid .card{ align-items:center; justify-content:center; text-align:center; padding:20px; max-width: var(--card-w);}
.icon-circle{ background:#fff; border-radius:50%; width:115px; height:115px; display:flex; align-items:center; justify-content:center; overflow:hidden; margin-bottom:10px; }
.icon-circle img{ width:67%; height:67%; object-fit:contain; display:block; }

.pdf-circle{ background:#fff; border-radius:50%; width:115px; height:115px; display:flex; align-items:center; justify-content:center; overflow:hidden; margin-bottom:10px; }
.pdf-circle img{ width:75%; height:75%; object-fit:contain; display:block; }

.github-circle{ background:#fff; border-radius:50%; width:115px; height:115px; display:flex; align-items:center; justify-content:center; overflow:hidden; margin-bottom:10px; }
.github-circle img{ width:92%; height:92%; object-fit:contain; display:block; }
.card-title{ color:var(--gold); font-weight:500; margin-top:10px; text-align:center; font-size: 22px;}

/* ===== Apps (Portfolio) ===== */
.apps-grid .card{ display:grid; min-width: var(--card-w); max-width: var(--card-w); grid-template-rows:auto var(--app-h) auto auto; grid-auto-rows:min-content; overflow:visible; }
.app-card-title{ font-size:22px; margin:0 0 12px; line-height:1.15; text-align:center; }
.project-font{ font-size: 18px; }
.screenshot-row{ grid-row:2; display:flex; justify-content:center; align-items:center; gap:8px; line-height:0; overflow:hidden; }
.screenshot-row img{ height:var(--app-h); width:auto; display:block; border-radius:4px; }
.project-blurb{ grid-row:3; margin:10px 10px 0; line-height:1.4; text-align:center; }
.store-badge{ grid-row:4; align-self:end; justify-self:center; width:135px; height:auto; margin-top:12px; }

/* ===== Projects ===== */
.projects-grid .card{ max-width: var(--card-w); display:grid; grid-template-rows:auto auto auto auto; grid-auto-rows:min-content; overflow:auto; }
.bottom-card-title{ color:var(--text); text-align:left; margin-bottom:8px; font-weight:400; }
.project-gif{ width:100%; max-height: 150px; height:auto; object-fit:cover; border-radius:6px; display:block; margin-bottom:12px; }
.source-link{ margin-top:auto; align-self:center; display:flex; align-items:center; justify-content:center; gap:8px; text-align:center; }
.octocat-icon{ width:22px; height:22px; display:block; }
.source-link span{ color:var(--text); }

.source-link a, .source-link a:visited{ color:#f0e7d5 !important; text-decoration:none; font-weight:500; }
.source-link a:hover{ color: var(--gold) !important; text-decoration: underline; }

/* ===== Responsive ===== */
@media(max-width:900px){
  .cards{ grid-template-columns:1fr; justify-items: center;}
}
.page-end-spacer{ height:10px; }
