/* ============================================================
   Responsive overrides — fatihsengul.com
   Loaded after page-specific <style> blocks so these rules
   take precedence over inline <style> at equal specificity.
   ============================================================ */

/* ========================
   Shell Header — Mobile
   ======================== */
@media (max-width: 671px) {
  .shell-header__prefix { display: none; }
  .shell-header__nav    { display: none; }
  .shell-header__name   { flex: 1; border-right: none; justify-content: center; }
}

@media (max-width: 1055px) {
  /* Condense header name padding on smaller viewports */
  .shell-header__prefix { padding: 0 var(--sp-04); }
}

/* ========================
   Tweaks Panel — Mobile
   ======================== */
@media (max-width: 671px) {
  .tweaks-panel {
    width: auto;
    left: var(--sp-05);
    right: var(--sp-05);
  }
}

/* ========================
   Grid Column Reset — Mobile
   Force every direct .grid child to span full width on mobile,
   overriding both col-* classes and inline grid-column styles.
   ======================== */
@media (max-width: 671px) {
  .grid > * {
    grid-column: 1 / -1 !important;
  }
}

/* ========================
   Buttons — Mobile
   ======================== */
@media (max-width: 671px) {
  .btn:not(.btn--ghost) {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
  .case-cta__row  { flex-direction: column; }
  .hero__meta     { flex-direction: column; gap: var(--sp-04); }
}

/* ========================
   Typography — Mobile
   ======================== */
@media (max-width: 671px) {
  /* Index hero name */
  .hero__name   { font-size: var(--type-54) !important; }
  .hero__role   { font-size: var(--type-18); }

  /* Page hero heading (Projects / Publications) */
  .page-hero h1 { font-size: var(--type-42) !important; }

  /* Case study hero heading */
  .case-hero h1 { font-size: var(--type-32) !important; }
  .case-hero__lead { font-size: var(--type-16); }

  /* Section & feature headings */
  .section-head h2   { font-size: var(--type-28) !important; }
  .case-h2           { font-size: var(--type-28) !important; }
  .feature__title    { font-size: var(--type-28) !important; }
  .contact-card h2   { font-size: var(--type-32) !important; }
}

@media (max-width: 1055px) {
  /* Soften hero name on tablet/laptop */
  .hero__name { font-size: var(--type-76) !important; }
}

/* ========================
   Index Hero — Mobile
   ======================== */
@media (max-width: 1055px) {
  /* Remove extreme negative margins that cause overflow on smaller screens */
  .hero__badges-col {
    margin-top: 0;
    margin-right: 0;
    margin-left: 0;
  }
}

@media (max-width: 671px) {
  .hero__badges-col {
    margin-top: var(--sp-07);
    margin-right: 0;
    margin-left: 0;
  }
  .hero__badges-grid {
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  /* Aside: swap left-border for top-border when stacked */
  .hero__aside {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    padding-left: var(--sp-05);
    padding-top: var(--sp-06);
  }
}

/* ========================
   Nav Tiles — Mobile
   ======================== */
@media (max-width: 671px) {
  .nav-tiles { grid-template-columns: 1fr !important; }
  .nav-tile  { min-height: 120px; }
}

/* ========================
   Experience Timeline — Mobile
   ======================== */
@media (max-width: 671px) {
  .timeline-item {
    grid-template-columns: 1fr;
    gap: var(--sp-03);
  }
  /* Re-apply top border that the first-child rule removed */
  .timeline-item:first-child {
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--sp-06);
  }
}

/* ========================
   Contact Card — Mobile
   ======================== */
@media (max-width: 671px) {
  .contact-card { padding: var(--sp-07) var(--sp-06); }
  .contact-card__links a {
    font-size: var(--type-16);
    flex-wrap: wrap;
    gap: var(--sp-03);
  }
}

/* ========================
   Projects — Feature Cards — Mobile
   ======================== */
@media (max-width: 671px) {
  .feature__visual  { min-height: 260px; }
  .feature__content { padding: var(--sp-06); }
  .feature__metrics { grid-template-columns: repeat(3, 1fr); }

  /* Section-title padding */
  .section-title {
    padding-left: var(--sp-05);
    padding-right: var(--sp-05);
  }
}

/* ========================
   Publications — Mobile
   ======================== */
@media (max-width: 671px) {
  /* Collapse publication list items to single column */
  .pub-item {
    grid-template-columns: 1fr !important;
  }
  .pub-item__year {
    display: flex;
    align-items: center;
    gap: var(--sp-05);
  }
  .pub-item__year .num { font-size: var(--type-20); }
  .pub-item__meta {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--sp-03);
  }

  /* Collapse review rows */
  .review-row {
    grid-template-columns: 90px 1fr !important;
  }
  .review-row__journal {
    grid-column: 1 / -1;
  }
}

/* ========================
   Site Footer — Mobile
   ======================== */
@media (max-width: 671px) {
  .site-footer { margin-top: var(--sp-09); }
  .site-footer__row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-03);
  }
}

/* ========================
   Utility — Mobile Overflow Prevention
   ======================== */
@media (max-width: 671px) {
  /* Prevent any single element from breaking horizontal scroll */
  img, svg, table, pre, code {
    max-width: 100%;
  }

  /* data-table: allow horizontal scroll within container */
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
