/* =========================================================
   Found IT! - student phone experience
   Loaded after style.css and polish.css. Additive only: every
   rule is inside a media query, so desktop is untouched.
   Uses the existing colour tokens so dark mode keeps working.
   ========================================================= */

/* The bottom tab bar only exists on phones */
.mobile-tabbar {
  display: none;
}

@media (max-width: 820px) {
  /* ---------- Page rhythm ---------- */
  .student-area {
    --m-gap: 16px;
    --m-radius: 16px;
    --m-tabbar: 64px;
  }
  .student-area .container {
    padding-left: 16px;
    padding-right: 16px;
  }
  .student-area .section,
  .student-area .campus-section {
    padding-top: 14px;
    padding-bottom: 14px;
  }
  .student-area .campus-interior-section {
    padding-top: 18px;
  }
  /* room for the fixed tab bar (signed-in users only) */
  .student-area.has-tabbar {
    padding-bottom: calc(var(--m-tabbar) + env(safe-area-inset-bottom, 0px));
  }

  /* ---------- Header ---------- */
  .student-area .site-header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
    box-shadow: 0 1px 0 var(--line);
  }
  .student-area .campus-ribbon {
    display: none;
  }
  .student-area .campus-nav-row {
    min-height: 58px;
    padding-top: 8px;
    padding-bottom: 8px;
    position: relative;
  }
  .student-area .brand-logo {
    width: 38px;
    height: 38px;
  }
  .student-area .brand-name {
    font-size: 19px;
    line-height: 1.1;
  }
  .student-area .brand-caption {
    font-size: 9.5px;
    letter-spacing: 0.08em;
  }
  .js .nav-toggle {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--lav);
    border-color: transparent;
  }

  /* menu opens as a floating panel under the header */
  .js .student-area .main-nav {
    position: absolute;
    top: calc(100% + 6px);
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
    padding: 10px;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: var(--m-radius);
    background: var(--surface);
    box-shadow: 0 18px 40px rgba(7, 39, 74, 0.18);
  }
  .student-area .main-nav > a:not(.btn) {
    border-radius: 12px;
  }
  .student-area .main-nav .btn {
    margin-top: 6px;
  }
  .student-area .main-nav .nav-profile-link {
    gap: 10px;
    background: var(--lav);
    margin-bottom: 4px;
  }

  /* ---------- Home hero: let the campus photo show ---------- */
  .student-area .campus-hero {
    min-height: 0;
    display: flex;
    align-items: flex-end;
  }
  .student-area .campus-hero-photo {
    background-position: 62% 40%;
  }
  .student-area .campus-hero-shade {
    display: block;
    background: linear-gradient(
      180deg,
      rgba(6, 35, 70, 0.1) 0%,
      rgba(6, 35, 70, 0.62) 38%,
      rgba(5, 29, 58, 0.96) 100%
    );
  }
  .student-area .campus-hero-content {
    grid-template-columns: 1fr;
    gap: 18px;
    padding-top: 150px;
    padding-bottom: 22px;
  }
  .student-area .campus-hero-copy {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .student-area .campus-hero-changing-text {
    margin: 10px 0 8px;
    font-size: clamp(30px, 9vw, 40px);
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.25);
  }
  .student-area .campus-hero-sub {
    font-size: 15px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.92);
  }
  .student-area .campus-greeting {
    margin: 12px 0 0;
    font-size: 14px;
  }
  .student-area .campus-hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 18px;
  }
  .student-area .campus-hero-actions .btn {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
  }
  .student-area .btn-campus-outline {
    background: rgba(255, 255, 255, 0.1);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
  .student-area .campus-hero-note {
    max-width: none;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: none;
    color: #fff;
  }
  .student-area .campus-hero-note strong,
  .student-area .campus-hero-note span {
    color: #fff;
  }
  .student-area .campus-hero-logo {
    width: 40px;
    height: 40px;
  }

  /* inner-page banners */
  .student-area .campus-page-hero {
    min-height: 0;
    padding: 26px 0 22px;
  }
  .student-area .campus-page-hero h1 {
    font-size: 28px;
    line-height: 1.15;
  }

  /* ---------- Search card ---------- */
  .student-area .search-bar {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
    margin-bottom: 16px;
    border-radius: var(--m-radius);
  }
  .student-area .search-intro {
    gap: 10px;
  }
  .student-area .search-intro .icon-circle {
    width: 36px;
    height: 36px;
    flex: none;
  }
  .student-area .search-intro span:not(.icon-circle) {
    display: none; /* the long helper sentence just pushes the form down */
  }
  .student-area .search-intro strong {
    font-size: 16px;
  }
  .student-area .search-form,
  .student-area .campus-content .search-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .student-area .search-form input[type="search"],
  .student-area .campus-content .search-form input {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }
  .student-area .search-form select {
    width: 100%;
    min-width: 0;
  }
  .student-area .search-form select:nth-child(2):nth-last-child(2) {
    grid-column: 1 / -1; /* a lone select takes the full row */
  }
  .student-area .search-form .btn {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 46px;
  }
  .student-area .search-more-grid {
    grid-template-columns: 1fr 1fr;
  }
  .student-area .search-more-grid label:first-child {
    grid-column: 1 / -1;
  }

  /* ---------- Filters / counts ---------- */
  .student-area .filter-pills {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
  }
  .student-area .pill-filter {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 0 18px;
  }
  .student-area .filter-pills .count-note {
    flex: 1 0 100%;
    margin: 2px 0 0;
    font-size: 13px;
  }

  /* ---------- "Online now" becomes one swipeable row ---------- */
  .student-area .online-panel {
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: var(--m-radius);
  }
  .student-area .online-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
  }
  .student-area .online-head h2 {
    font-size: 15px;
    margin: 0;
  }
  .student-area .online-head .muted {
    margin: 0;
    font-size: 12px;
  }
  .student-area .online-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0 -14px;
    padding: 2px 14px 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .student-area .online-list::-webkit-scrollbar {
    display: none;
  }
  .student-area .online-chip {
    flex: none;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  /* ---------- Section headings ---------- */
  .student-area .section-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 14px;
  }
  .student-area .section-head h2 {
    font-size: 22px;
    line-height: 1.2;
  }
  .student-area .section-head .btn-link {
    padding: 0;
    min-height: 0;
    font-weight: 700;
  }

  /* ---------- Item cards: compact "list row" style ---------- */
  .student-area .recent-grid,
  .student-area .lost-found-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .student-area .item-card,
  .student-area .lost-found-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: stretch;
    min-height: 124px;
    border-radius: var(--m-radius);
    overflow: hidden;
  }
  .student-area .item-card .item-visual,
  .student-area .lost-found-card .item-visual {
    position: relative;
    width: 112px;
    height: 100%;
    min-height: 124px;
    padding: 0;
    background: var(--lav);
  }
  .student-area .item-card .item-visual img,
  .student-area .lost-found-card .item-visual img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    border-radius: 0;
  }
  .student-area .item-card .item-type-badge {
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    font-size: 10px;
    letter-spacing: 0.02em;
  }
  .student-area .item-card .item-no-photo {
    font-size: 11px;
    gap: 4px;
    padding: 8px;
    text-align: center;
  }
  .student-area .item-card .item-body,
  .student-area .lost-found-card .lost-found-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    padding: 12px 14px;
  }
  .student-area .item-card .item-card-topline {
    margin: 0;
  }
  .student-area .item-card h3,
  .student-area .lost-found-card .lost-found-body h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .student-area .item-card .item-location {
    font-size: 13px;
    min-width: 0;
  }
  .student-area .item-card .item-location > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .student-area .item-card .item-poster {
    font-size: 12px;
    min-width: 0;
  }
  .student-area .item-card .item-poster > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .student-area .item-card .item-poster-avatar {
    display: none;
  }
  .student-area .item-card .item-card-footer,
  .student-area .item-card .item-view-link {
    display: none; /* the whole card is already a tap target */
  }

  /* ---------- Steps / how it works ---------- */
  .student-area .home-cta {
    padding: 24px 20px;
    border-radius: 20px;
  }
  .student-area .home-cta .btn {
    width: 100%;
  }

  /* ---------- Forms ---------- */
  .student-area form .btn[type="submit"],
  .student-area .form-actions .btn {
    min-height: 48px;
  }
  .student-area .form-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .student-area .form-actions .btn {
    width: 100%;
  }

  /* ---------- Tables that must stay wide scroll sideways ---------- */
  .student-area .table-wrap,
  .student-area .admin-table-wrap,
  .student-area .profile-report-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ---------- Footer ---------- */
  .student-area .site-footer {
    margin-top: 20px;
  }
  .student-area .foot-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding-top: 22px;
    padding-bottom: 22px;
  }
  .student-area .foot-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px 18px;
  }

  /* ---------- Bottom tab bar ---------- */
  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    height: calc(var(--m-tabbar, 64px) + env(safe-area-inset-bottom, 0px));
    padding: 6px 6px env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 24px rgba(7, 39, 74, 0.07);
  }
  .mobile-tabbar a {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 52px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-tabbar a:hover {
    text-decoration: none;
  }
  .mobile-tabbar svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .mobile-tabbar a[aria-current="page"] {
    color: var(--purple);
  }
  .mobile-tabbar a[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: -7px;
    width: 26px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--purple);
  }
  .mobile-tabbar .tab-report {
    color: #fff;
    justify-content: flex-end;
    padding-bottom: 7px;
  }
  .mobile-tabbar .tab-report .tab-fab {
    position: absolute;
    top: -20px;
    left: 50%;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-left: -26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1681cf, #0759a6);
    box-shadow:
      0 8px 18px rgba(7, 89, 166, 0.38),
      0 0 0 4px var(--surface);
  }
  .mobile-tabbar .tab-report .tab-fab svg {
    width: 26px;
    height: 26px;
    stroke-width: 2.2;
  }
  .mobile-tabbar .tab-report .tab-label {
    color: var(--muted);
  }
  .mobile-tabbar .tab-badge {
    position: absolute;
    top: 3px;
    left: calc(50% + 6px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #e11d48;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
  }
}

/* ---------- Small phones ---------- */
@media (max-width: 380px) {
  .student-area .item-card,
  .student-area .lost-found-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }
  .student-area .item-card .item-visual,
  .student-area .lost-found-card .item-visual {
    width: 96px;
  }
  .student-area .brand-caption {
    display: none;
  }
}

/* Larger phones in landscape / small tablets: two columns of rows */
@media (min-width: 600px) and (max-width: 820px) {
  .student-area .recent-grid,
  .student-area .lost-found-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: no-preference) and (max-width: 820px) {
  .student-area .item-card:active {
    transform: scale(0.985);
    transition: transform 0.12s ease;
  }
}