/* ONCC Home Live Mobile v1.0
   Mobile-first card conversion for the homepage latest-records table.
   Desktop layout is unchanged.
*/

@media(max-width:760px){

  /* Latest records: remove horizontal scrolling completely. */
  #latest-records .onccf-home-table-ref-wrap{
    overflow:visible!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
  }

  #latest-records .onccf-home-table-ref{
    display:block!important;
    width:100%!important;
    min-width:0!important;
    table-layout:auto!important;
  }

  #latest-records .onccf-home-table-ref thead{
    position:absolute!important;
    width:1px!important;
    height:1px!important;
    overflow:hidden!important;
    clip:rect(0 0 0 0)!important;
    clip-path:inset(50%)!important;
    white-space:nowrap!important;
  }

  #latest-records .onccf-home-table-ref tbody{
    display:grid!important;
    gap:9px!important;
  }

  #latest-records .onccf-home-table-ref tbody tr{
    display:grid!important;
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
    grid-template-areas:
      "date date fb fb settle settle"
      "match match match match match match"
      "market market market selection selection selection"
      "odds odds result result evidence evidence"!important;
    overflow:hidden!important;
    border:1px solid #d7e0e7!important;
    border-radius:10px!important;
    background:#fff!important;
    box-shadow:0 2px 9px rgba(7,20,31,.04)!important;
  }

  #latest-records .onccf-home-table-ref td{
    display:block!important;
    width:auto!important;
    min-width:0!important;
    min-height:48px!important;
    padding:8px 9px!important;
    border:0!important;
    border-right:1px solid #e5eaee!important;
    border-bottom:1px solid #e5eaee!important;
    background:#fff!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
    font-size:11px!important;
    line-height:1.35!important;
  }

  #latest-records .onccf-home-table-ref td::before{
    content:attr(data-label);
    display:block;
    margin-bottom:2px;
    color:#82909b;
    font-size:8px;
    font-weight:900;
    letter-spacing:.05em;
    text-transform:uppercase;
  }

  #latest-records .onccf-home-table-ref td[data-col="date"]{grid-area:date}
  #latest-records .onccf-home-table-ref td[data-col="fb"]{grid-area:fb}
  #latest-records .onccf-home-table-ref td[data-col="settlement"]{
    grid-area:settle;
    border-right:0!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="match"]{
    grid-area:match;
    border-right:0!important;
    font-size:12px!important;
    font-weight:850!important;
    color:#102a43!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="market"]{grid-area:market}
  #latest-records .onccf-home-table-ref td[data-col="selection"]{
    grid-area:selection;
    border-right:0!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="odds"]{
    grid-area:odds;
    border-bottom:0!important;
  }
  #latest-records .onccf-home-table-ref td[data-col="result"]{
    grid-area:result;
    border-bottom:0!important;
  }
  #latest-records .onccf-home-table-ref td[data-col="evidence"]{
    grid-area:evidence;
    border-right:0!important;
    border-bottom:0!important;
    color:#647787!important;
    font-size:9.5px!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="date"],
  #latest-records .onccf-home-table-ref td[data-col="fb"],
  #latest-records .onccf-home-table-ref td[data-col="settlement"]{
    background:#f7f9fb!important;
  }

  #latest-records .onccf-home-settle-ref{
    min-width:0!important;
    width:max-content!important;
    padding:4px 8px!important;
    font-size:10px!important;
  }

  /* Section heading: link stays visible without squeezing the title. */
  #latest-records .onccf-home-section-ref__head{
    align-items:flex-start!important;
    gap:5px!important;
  }

  #latest-records .onccf-home-section-ref__head h2{
    font-size:23px!important;
  }

  #latest-records .onccf-home-section-ref__head>a{
    font-size:10.5px!important;
  }

  /* Monthly trend table uses the same mobile no-drag principle. */
  #monthly-trend .onccf-home-table-ref-wrap{
    overflow:visible!important;
  }

  #monthly-trend .onccf-home-table-ref{
    min-width:0!important;
  }

  /* Market cards: one clean column on phones. */
  #market-performance .onccf-home-market-ref-grid{
    grid-template-columns:1fr!important;
    gap:9px!important;
  }

  #market-performance .onccf-home-market-ref{
    width:100%!important;
  }

  #market-performance .onccf-home-market-ref__media{
    height:145px!important;
  }

  /* Hero/KPI already collapse in site CSS; keep numbers readable. */
  .onccf-home-kpi-ref{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  .onccf-home-kpi-ref__lead{
    grid-column:1/-1!important;
  }
}

@media(max-width:430px){
  #latest-records .onccf-home-table-ref tbody tr{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-template-areas:
      "date settle"
      "fb fb"
      "match match"
      "market selection"
      "odds result"
      "evidence evidence"!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="date"]{
    border-right:1px solid #e5eaee!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="fb"]{
    border-right:0!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="market"]{
    border-right:1px solid #e5eaee!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="odds"]{
    border-right:1px solid #e5eaee!important;
  }
}


/* =========================================================
   Home mobile readability v1.1
   Increase type size while keeping the compact card layout.
   ========================================================= */
@media(max-width:760px){
  #latest-records .onccf-home-table-ref td{
    font-size:13px!important;
    line-height:1.5!important;
    min-height:54px!important;
    padding:9px 10px!important;
  }

  #latest-records .onccf-home-table-ref td::before{
    margin-bottom:3px!important;
    font-size:9.5px!important;
    line-height:1.2!important;
    letter-spacing:.04em!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="match"]{
    font-size:14px!important;
    line-height:1.45!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="fb"]{
    font-size:13.5px!important;
    font-weight:850!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="date"],
  #latest-records .onccf-home-table-ref td[data-col="odds"],
  #latest-records .onccf-home-table-ref td[data-col="result"]{
    font-variant-numeric:tabular-nums;
  }

  #latest-records .onccf-home-table-ref td[data-col="evidence"]{
    font-size:11px!important;
    line-height:1.4!important;
  }

  #latest-records .onccf-home-settle-ref{
    padding:5px 9px!important;
    font-size:11.5px!important;
  }

  #latest-records .onccf-home-section-ref__head h2{
    font-size:25px!important;
    line-height:1.15!important;
  }

  #latest-records .onccf-home-section-ref__head>a{
    font-size:12px!important;
  }

  /* Trend: compact but readable on phones. */
  #monthly-trend .onccf-period-grid{
    grid-template-columns:1fr!important;
    gap:8px!important;
  }

  #monthly-trend .onccf-period-grid article{
    padding:13px 14px!important;
  }

  #monthly-trend .onccf-period-grid span{
    font-size:12px!important;
  }

  #monthly-trend .onccf-period-grid strong{
    font-size:25px!important;
  }

  #monthly-trend .onccf-period-grid small{
    font-size:11.5px!important;
    line-height:1.55!important;
  }

  /* Trend table must not require horizontal dragging. */
  #monthly-trend .onccf-home-table-ref-wrap{
    overflow:visible!important;
    border:0!important;
    box-shadow:none!important;
  }

  #monthly-trend .onccf-home-table-ref{
    display:block!important;
    width:100%!important;
    min-width:0!important;
  }

  #monthly-trend .onccf-home-table-ref thead{
    position:absolute!important;
    width:1px!important;
    height:1px!important;
    overflow:hidden!important;
    clip:rect(0 0 0 0)!important;
    clip-path:inset(50%)!important;
  }

  #monthly-trend .onccf-home-table-ref tbody{
    display:grid!important;
    gap:7px!important;
  }

  #monthly-trend .onccf-home-table-ref tbody tr{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    overflow:hidden!important;
    border:1px solid #d7e0e7!important;
    border-radius:9px!important;
    background:#fff!important;
  }

  #monthly-trend .onccf-home-table-ref td{
    display:block!important;
    width:auto!important;
    min-height:48px!important;
    padding:8px 9px!important;
    border:0!important;
    border-right:1px solid #e5eaee!important;
    border-bottom:1px solid #e5eaee!important;
    background:#fff!important;
    white-space:normal!important;
    font-size:12.5px!important;
    line-height:1.4!important;
  }

  #monthly-trend .onccf-home-table-ref td:nth-child(even){
    border-right:0!important;
  }

  #monthly-trend .onccf-home-table-ref td:last-child{
    grid-column:1/-1!important;
    border-right:0!important;
    border-bottom:0!important;
    font-weight:850!important;
  }
}

@media(max-width:430px){
  #latest-records .onccf-home-table-ref td{
    font-size:13.5px!important;
  }

  #latest-records .onccf-home-table-ref td::before{
    font-size:10px!important;
  }

  #latest-records .onccf-home-table-ref td[data-col="match"]{
    font-size:14.5px!important;
  }
}
