/* ============================
   aimNana.github.io — style.css
   - Personal palette (Pantone-like)
   - Fluid grids (auto-fit/minmax)
   - Compact cards with spacing
   - Buttons pinned to bottom
   - Dark mode (slider)
   - Projects page layout
   - Mobile polish
============================ */

:root{
  /* Palette (approx HEX) */
  --placid:#A7C6ED;   /* primary */
  --baby:#CFE5F5;     /* bg */
  --greenash:#A8D5BA; /* secondary */
  --lavender:#E7E5F1; /* soft accent */
  --rosewater:#F7E8E3;/* chip bg */
  --silver:#C9CED6;   /* borders */

  /* Semantic */
  --bg:var(--baby);
  --surface:#ffffff;
  --ink:#25313D;
  --muted:#5B6B79;
  --primary:var(--placid);
  --secondary:var(--greenash);
  --accent:var(--rosewater);
  --line:var(--silver);

  --shadow-lg:0 14px 28px rgba(18, 34, 52, .12);
  --shadow:   0 10px 22px rgba(18, 34, 52, .12);
  --shadow-sm:0 6px 14px  rgba(18, 34, 52, .08);

  --radius:20px;
}

*{ box-sizing:border-box }
html,body{ height:100% }
body{
  margin:0; color:var(--ink); background:var(--bg);
  font-family:Poppins, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height:1.5;
}

/* ----------------- HEADER ----------------- */
header{
  background:
    repeating-linear-gradient(90deg, var(--lavender) 0 16px, transparent 16px 32px),
    linear-gradient(180deg, var(--baby) 0%, var(--lavender) 100%);
  border-bottom:6px solid var(--primary);
}
.hero{
  max-width:1100px; margin:0 auto; padding:28px 20px 36px;
  display:flex; gap:18px; align-items:center;
}
.logo{
  height:90px;             /* ↑ più grande */
  width:auto;
  border-radius:50%;
  background:#fff;
  border:3px solid #fff;
  box-shadow:var(--shadow);
  object-fit:cover;
}
h1{ margin:0; font-size:clamp(26px,4vw,40px); }
.hero p{ margin:.4rem 0 0; color:var(--muted); max-width:68ch }
.cta{ margin-left:auto; display:flex; gap:14px; flex-wrap:wrap }
.btn{
  padding:12px 16px; border-radius:999px; border:1px solid var(--line);
  background:var(--primary); color:#0C1D16; font-weight:800; text-decoration:none;
  box-shadow:var(--shadow);
}
.btn.secondary{ background:var(--secondary) }
.btn:hover{ transform:translateY(-1px) }
.btn.ghost{
  background:transparent; color:var(--ink);
  border:1px dashed var(--line);
  box-shadow:none;
}
.btn.ghost:hover{ transform:translateY(-1px) }

/* ----------------- WRAP + FLUID GRID ----------------- */
.wrap{
  max-width:1100px;
  margin:22px auto 60px;
  padding:0 20px;
}
.grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: clamp(12px, 2.5vw, 20px);
}

/* ----------------- CARD ----------------- */
.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow:var(--shadow-sm);
  padding: clamp(10px, 2.2vw, 14px);
  max-width:900px;
  margin-inline:auto;
  margin-bottom:20px; /* spazio extra tra le card */
}
.card h2{ margin:0 0 10px }
.lead{ color:var(--muted) }

/* ----------------- BADGES (Shields nella About) ----------------- */
.badges img{ height:22px; margin:6px 6px 0 0 }

/* ----------------- CONTACT ----------------- */
.contact .row{ display:flex; gap:12px; flex-wrap:wrap }

/* ----------------- PROJECTS (homepage) ----------------- */
#projects{ grid-column:1/-1 }
.projects{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(10px, 2vw, 16px);
}
.project{
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  padding: clamp(10px, 2vw, 12px);
  border:1px solid var(--line);
  border-radius:12px;
  background:linear-gradient(180deg,#fff 0%, rgba(231,229,241,.5) 100%);
  margin-bottom:20px;
}
.project h3{ margin:0 0 6px }
.project p{ margin:0 0 12px; color:#425364; flex-grow:1; }
.project .links{ display:flex; gap:10px; flex-wrap:wrap; margin-top:auto; }
.chip{
  display:inline-block; padding:6px 12px; border-radius:999px;
  background:var(--rosewater); color:#6a3f3a; font-weight:800; margin-bottom:8px;
}

/* ----------------- SKILLS ----------------- */
#skills{ grid-column:1/-1 }
.skills{ display:grid; gap:12px }
.skill{
  background:#fff; border:1px solid var(--line); border-radius:16px; padding:10px;
  margin-bottom:20px;
}
.skill b{
  display:inline-block; background:var(--lavender);
  padding:4px 10px; border-radius:999px; margin-bottom:6px
}
.bar{ height:10px; background:var(--silver); border-radius:999px; overflow:hidden }
.bar span{ display:block; height:100%; background:var(--secondary) }

/* ----------------- TIMELINE ----------------- */
#experience{ grid-column:1/-1 }
.timeline{
  position:relative; padding-left:22px; border-left:3px solid var(--silver)
}
.timeline-item{ margin-bottom:16px }
.timeline-item h4{ margin:0 0 4px }
.timeline-item small{ color:var(--muted) }

/* ----------------- LATEST REPOS ----------------- */
#latest{ grid-column:1/-1 }
.repo-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(10px, 2vw, 16px);
}
.repo{
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  padding: clamp(10px, 2vw, 12px);
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  margin-bottom:20px;
}
.repo h3{ margin:0 0 6px; font-size:18px }
.repo p{ margin:0 0 10px; color:#4b5d6c; min-height:42px; flex-grow:1; }
.repo .meta{ display:flex; gap:10px; flex-wrap:wrap; align-items:center;
  font-size:13px; color:#516171 }
.badge{ display:inline-block; padding:4px 8px; border-radius:999px;
  background:var(--greenash); font-weight:800; color:#1f3a30 }

/* ----------------- FOOTER ----------------- */
footer{
  opacity:.85; text-align:center; padding:30px 0 50px;
  font-size:14px; color:#3b4856
}

/* ============================
   Theme slider
============================ */
.theme-switch{ display:inline-block; line-height:0; }
.theme-switch input{ position:absolute; opacity:0; pointer-events:none; }
.theme-switch .track{
  position:relative; display:inline-flex; align-items:center; justify-content:space-between;
  width:70px; height:36px; padding:0 10px; border-radius:999px;
  background:var(--surface); border:1px solid var(--line); box-shadow:var(--shadow-sm); color:var(--muted);
  transition:background .2s ease, border-color .2s ease;
}
.theme-switch .thumb{
  position:absolute; left:4px; top:50%; transform:translateY(-50%); width:28px; height:28px; border-radius:50%;
  background:var(--primary); box-shadow:0 6px 14px rgba(18,34,52,.18); transition:transform .25s ease;
}
.theme-switch .icon{ opacity:.7; transition:opacity .2s ease; }
.theme-switch .sun{ margin-right:0; }
.theme-switch .moon{ margin-left:0; opacity:.35; } /* centrata meglio */
.theme-switch input:checked + .track .thumb{ transform:translate(34px, -50%); }
.theme-switch input:checked + .track .sun{ opacity:.35; }
.theme-switch input:checked + .track .moon{ opacity:.8; }
html[data-theme="dark"] .theme-switch .track{ background:var(--surface); color:var(--muted); }

/* ============================
   Detailed Projects page layout
============================ */
.project-detail { max-width: 1100px; }
.pd-head{
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: clamp(12px, 2.5vw, 20px);
  align-items: start;
}
.pd-shot{
  width: 100%; height: 260px; object-fit: cover; border-radius: 14px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); background:#fff;
}
.pd-meta{ display:flex; flex-direction:column; min-width:0; }
.pd-badges{ display:flex; gap:8px; flex-wrap:wrap; margin:8px 0 10px; }
.pd-links{ display:flex; gap:10px; flex-wrap:wrap; margin-top:auto; }
.pd-body{
  margin-top: 14px; display:grid; grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 2.5vw, 20px);
}
.pd-list{ margin:8px 0 0; padding-left:18px; }
.pd-list li{ margin:4px 0; color:var(--muted); }

/* ---- Subtle tags in Projects page ---- */
.project-detail .pd-badges { gap: 6px; margin-bottom: 10px; }
.project-detail .pd-badges .badge{
  background: transparent;           /* no fill */
  color: var(--muted);               /* testo tenue */
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
  letter-spacing: .2px;
}
html[data-theme="dark"] .project-detail .pd-badges .badge{
  color: #b7c0cc;
  border-color: #324055;
  background: transparent;
}

/* ============================
   Dark theme overrides
============================ */
html[data-theme="dark"] {
  --bg:#0f1520;
  --surface:#111827;
  --ink:#e5e7eb;
  --muted:#9aa3af;
  --primary:#7aa3e6;
  --secondary:#82c9aa;
  --accent:#3b2f36;
  --line:#273244;
  --shadow-lg:0 14px 28px rgba(0,0,0,.45);
  --shadow:   0 10px 22px rgba(0,0,0,.35);
  --shadow-sm:0 6px 14px  rgba(0,0,0,.28);
}
html[data-theme="dark"] header {
  background:
    repeating-linear-gradient(90deg, #1e2633 0 16px, transparent 16px 32px),
    linear-gradient(180deg, #0f1520 0%, #1b2330 100%);
  border-bottom-color: var(--primary);
}
html[data-theme="dark"] .card {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] .project,
html[data-theme="dark"] .repo { background:#0f1520; }
html[data-theme="dark"] .chip { background: var(--accent); color:#f0d5d6; }

/* ============================
   MOBILE POLISH PACK
============================ */

/* Skip link (usato in index) */
.visually-hidden-focusable {
  position:absolute; left:-9999px; top:auto; width:1px; height:1px; overflow:hidden;
}
.visually-hidden-focusable:focus {
  position:static; width:auto; height:auto; padding:8px 12px; margin:6px;
  background:#fff; border:2px solid var(--primary); border-radius:10px; z-index:1000;
}

/* ---------- Tablet (<= 900px) ---------- */
@media (max-width: 900px) {
  .hero { padding: 18px 16px 24px; gap: 12px; }
  .logo { height: 78px; }
  h1 { font-size: clamp(22px, 5vw, 30px); }
  .wrap { padding: 0 16px; }

  .projects,
  .repo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skills { grid-template-columns: 1fr; }
}

/* ---------- Phone (<= 640px) ---------- */
@media (max-width: 640px) {
  header { border-bottom-width: 4px; }
  .hero {
    padding: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .logo { height: 64px; }
  h1 { font-size: 22px; line-height: 1.2; }
  .hero p { font-size: 14px; max-width: 100%; }

  .cta {
    margin-left: 0; width: 100%; gap: 8px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .btn { padding: 10px 12px; font-weight: 700; white-space: nowrap; }
  .theme-switch .track { height: 34px; width: 66px; }

  .wrap { padding: 0 12px; margin: 16px auto 36px; }
  .card { padding: 12px; border-radius: 14px; box-shadow: var(--shadow); max-width: 100%; }
  .card h2 { font-size: 20px; margin-bottom: 8px; }

  .projects,
  .repo-grid { grid-template-columns: 1fr; gap: 12px; }

  .project { min-height: 0; }
  .project p { flex-grow: 1; }
  .project .links { gap: 8px; }
  .project .links .btn { min-height: 44px; }

  .repo { min-height: 0; }
  .repo p { flex-grow: 1; }
  .repo .meta { gap: 8px; }
  .repo .meta .btn { padding: 6px 10px; min-height: 40px; }

  .skill { padding: 10px; }
  .bar { height: 8px; }

  .timeline { padding-left: 14px; border-left-width: 2px; }
}

/* ---------- Small phones (<= 400px) ---------- */
@media (max-width: 400px) {
  .logo { height: 56px; }
  .btn { padding: 9px 10px; }
  .theme-switch .track { width: 64px; height: 32px; }
  .theme-switch .thumb { width: 26px; height: 26px; }
}

/* ---------- Projects page specific ---------- */
@media (max-width: 900px) {
  .pd-head { grid-template-columns: 1fr; }
  .pd-shot { height: 220px; }
  .pd-body { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .pd-shot { height: 180px; }
  .pd-badges { gap: 6px; }
  .pd-links { gap: 8px; }
  .pd-links .btn { min-height: 44px; }
  .project-detail .pd-badges .badge { font-size: 11.5px; padding: 3px 9px; }
}
/* ---------- Font scaling for mobile ---------- */
@media (max-width: 640px) {
  body {
    font-size: 15px;        /* più piccolo rispetto al default (16–17px) */
    line-height: 1.45;
  }

  h1 {
    font-size: 20px;        /* titolo principale */
  }

  h2 {
    font-size: 18px;        /* titoli sezioni */
  }

  h3 {
    font-size: 16px;        /* sottotitoli / card */
  }

  p, .lead, small, li {
    font-size: 14px;        /* testo normale */
  }

  .btn {
    font-size: 14px;        /* bottoni coerenti */
    padding: 9px 12px;
  }
}
