/* =========================================================
   Fukazuuu Neocities stylesheet (organized + mobile fixes)
   Fixes:
   - Mobile nav labels not cut (About me / Reference)
   - White blank area on scroll/overscroll (iOS)
   - Better mobile background behavior (no fixed-attachment glitches)
   Required assets:
     /images/bg.jpg
     /images/noise.png
   ========================================================= */

/* 0) Theme variables */
:root{
  --panel: rgba(255,255,255,.62);
  --panel2: rgba(255,255,255,.38);
  --border: rgba(255,255,255,.65);
  --shadow: rgba(0,0,0,.14);

  --text: rgba(10,10,10,.92);
  --muted: rgba(10,10,10,.72);

  /* Gray glossy button theme */
  --btn1: rgba(255,255,255,.92);
  --btn2: rgba(225,230,235,.95);
  --btn3: rgba(190,198,206,.95);
  --btnBorder: rgba(255,255,255,.75);
  --btnShadow: rgba(0,0,0,.18);

  --selectBg: rgba(80,190,255,.55);
  --selectFg: #000;
}

/* 1) Reset / base */
*{ box-sizing: border-box; }

html{
  scroll-behavior: smooth;

  /* IMPORTANT: put the background on html to avoid iOS white overscroll */
  background:
    linear-gradient(180deg, rgba(180,240,255,.45), rgba(255,255,255,0) 35%),
    url("images/noise.png"),
    url("images/bg.jpg");
  background-size: cover, 300px 300px, cover;
  background-attachment: fixed, fixed, fixed;
  background-position: center, center, center;
  background-color: #bfefff; /* fallback */
}

body{
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI", Verdana, system-ui, sans-serif;
  line-height: 1.55;

  /* make body transparent so html bg shows during overscroll */
  background: transparent;

  /* prevent accidental horizontal scroll causing layout zoom weirdness */
  overflow-x: hidden;
}

::selection{
  background: var(--selectBg);
  color: var(--selectFg);
}

/* 2) Typography */
h1{
  font-size: 1.8rem;
  margin: 0 0 6px;
  letter-spacing: .2px;
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
}

h2{
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.lead{
  margin: 0;
  color: var(--muted);
}

/* 3) Layout containers */
.container{
  max-width: 980px;
  margin: 14px auto 40px;
  padding: 0 14px;
}

/* 4) Top navigation bar (glass) */
.topbar{
  position: sticky;
  top: 0;
  z-index: 10;

  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;

  padding: 10px 14px;
  margin: 10px auto 0;
  max-width: 980px;

  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 18px;

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow: 0 14px 30px rgba(0,0,0,.12);
}

/* Brand (icon + name) */
.brand{
  display: flex;
  align-items: center;
  gap: 8px;

  flex: 1 1 auto;
  min-width: 0; /* allows ellipsis */
}

.icon{
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;

  box-shadow:
    0 2px 6px rgba(0,0,0,.25),
    inset 0 1px 0 rgba(255,255,255,.6);
}

.brand-name{
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 5) Links (general) */
a{
  text-decoration: none;
  color: inherit;
}

.list a{
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(0,0,0,.25);
  text-underline-offset: 2px;
}

.list a:hover{
  text-decoration-color: rgba(0,0,0,.55);
}

/* 6) Gray glossy buttons (nav + .btn) */
.nav{
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav a,
.btn{
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;

  color: rgba(0,0,0,.88);
  font-weight: 600;
  letter-spacing: .2px;

  background: linear-gradient(
    180deg,
    var(--btn1) 0%,
    var(--btn2) 45%,
    var(--btn3) 100%
  );

  border: 1px solid var(--btnBorder);

  box-shadow:
    0 10px 18px rgba(0,0,0,.12),
    inset 0 1px 0 rgba(255,255,255,.75),
    inset 0 -10px 18px rgba(0,0,0,.08);

  position: relative;
  overflow: hidden;

  /* IMPORTANT: prevent Safari from shrinking & clipping text */
  flex: 0 0 auto;
  flex-shrink: 0;
  white-space: nowrap;
}

.nav a::before,
.btn::before{
  content: "";
  position: absolute;
  inset: 0;
  height: 55%;
  background: linear-gradient(180deg, rgba(255,255,255,.70), rgba(255,255,255,0));
  pointer-events: none;
}

.nav a:hover,
.btn:hover{
  transform: translateY(-1px);
}

.nav a:active,
.btn:active{
  transform: translateY(0px);
  box-shadow:
    0 8px 14px rgba(0,0,0,.14),
    inset 0 1px 0 rgba(255,255,255,.60),
    inset 0 -12px 20px rgba(0,0,0,.12);
}

/* 7) Glass panels (content blocks) */
.panel{
  position: relative;
  margin: 18px 0;
  padding: 18px;

  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  box-shadow:
    0 18px 40px var(--shadow),
    inset 0 1px 0 rgba(255,255,255,.65);
}

/* Glass reflection */
.panel::before{
  content:"";
  position:absolute;
  inset: 1px 1px auto 1px;
  height: 52%;
  border-radius: 17px 17px 12px 12px;

  background: linear-gradient(
    180deg,
    rgba(255,255,255,.85),
    rgba(255,255,255,.35) 35%,
    rgba(255,255,255,0)
  );
  pointer-events:none;
}

/* Edge tint */
.panel::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(120,220,255,.20);
  pointer-events:none;
}

/* 8) Resource cards */
.cards{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.card{
  position: relative;
  display: block;
  padding: 14px;
  border-radius: 16px;

  color: var(--text);

  background: rgba(255,255,255,.52);
  border: 1px solid rgba(255,255,255,.72);

  box-shadow: 0 10px 22px rgba(0,0,0,.12);
  overflow: hidden;
}

.card::before{
  content:"";
  position:absolute;
  inset:0;
  height: 55%;
  background: linear-gradient(180deg, rgba(255,255,255,.75), rgba(255,255,255,0));
  pointer-events:none;
}

.card-title{ font-weight: 700; }
.card-desc{ color: var(--muted); font-size: .95rem; }

/* 9) Footer */
.footer{
  text-align: center;
  padding: 24px 16px;
  color: rgba(0,0,0,0.75);
}

/* 10) Mobile fixes */
@media (max-width: 640px){
  /* iOS/Safari: fixed background can cause weird blank flashes; use scroll */
  html{
    background-attachment: scroll, scroll, scroll;
  }

  .container{
    padding: 0 12px;
  }

  .topbar{
    max-width: none;
    margin: 10px 10px 0;
    padding: 10px 10px;
    gap: 10px;
  }

  /* Keep nav on one row; allow horizontal scroll if needed (no clipping) */
  .nav{
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
  }

  .nav a{
    padding: 6px 10px;
    font-size: 0.92rem;
  }

  h1{ font-size: 1.55rem; }
  h2{ font-size: 1.12rem; }

  .panel{
    padding: 14px;
    border-radius: 16px;
  }
}

@media (max-width: 520px){
  /* Force 1-column cards for readability */
  .cards{
    grid-template-columns: 1fr;
  }
}
