/* Modern playful theme for Posty */
:root {
  --bg: #0f0f17;
  --bg-alt: #191b24;
  --bg-accent: linear-gradient(135deg,#5d2ee6,#9d4edd,#ff6ec7);
  --text: #f5f7fb;
  --text-dim: #a6adbb;
  --brand: #9d4edd;
  --brand-accent: #ffb347;
  --radius-sm: 3px;
  --radius: 3px;
  --radius-lg: 5px;
  --shadow: 0 4px 12px -2px rgba(0,0,0,.4),0 2px 4px -1px rgba(0,0,0,.3);
  --shadow-focus: 0 0 0 3px rgba(255,110,199,.4);
  --font-stack: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
  --code: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  --ease: cubic-bezier(.16,.8,.24,1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-stack);
  background: radial-gradient(circle at 20% 20%, #1f2230, #0f1016 70%) fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.02) 0 2px, transparent 2px 6px);
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 0;
}

main { width: 95%; max-width: 1440px; margin: 0 auto; padding: clamp(1rem,2vw,2rem); flex: 1; }
header, footer { width: 100%; }

header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px) saturate(160%);
  background: rgba(15,16,23,0.72);
  border-bottom: 1px solid #232530;
}

.navbar { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: .85rem clamp(1rem,2vw,2rem); }
.brand a { text-decoration: none; font-size: 1.35rem; font-weight: 650; letter-spacing: .5px; background: var(--bg-accent); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav-links { list-style: none; display: flex; gap: 1rem; padding: 0; margin: 0; }
.nav-links a { position: relative; color: var(--text-dim); text-decoration: none; font-weight: 500; padding: .35rem .75rem; border-radius: var(--radius-sm); transition: color .3s var(--ease); }
.nav-links a:hover, .nav-links a:focus { color: var(--text); }
.nav-links a::after { content: ''; position: absolute; inset: auto 10% 0 10%; height: 2px; background: linear-gradient(90deg,var(--brand),var(--brand-accent)); border-radius: 2px; scale: 0 1; transform-origin: left; transition: scale .4s var(--ease); }
.nav-links a:hover::after, .nav-links a:focus::after, .nav-links a.active::after { scale: 1 1; }

.grid { display: grid; gap: 1.4rem; grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); margin-top: 1.2rem; }
.card { position: relative; display: flex; flex-direction: column; gap: .65rem; padding: 1rem 1.05rem 1.15rem; background: linear-gradient(145deg,#191b24,#13141c); border: 1px solid #242732; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 20% 15%, rgba(255,110,199,.18), transparent 55%); opacity: .9; pointer-events: none; }
.card h3 { margin: 0; font-size: 1.05rem; letter-spacing: .3px; }
.card small { color: var(--text-dim); }
.card a.stretched { position: absolute; inset: 0; z-index: 20; }
.card:hover { border-color: #303543; }
.card:focus-within { outline: none; box-shadow: var(--shadow-focus); }

.empty { opacity: .6; font-style: italic; }

h1,h2,h3,h4 { line-height: 1.2; }

.hero { margin: 1.4rem 0 2rem; display: flex; flex-direction: column; gap: .9rem; }
.hero h1 { font-size: clamp(2rem,5vw,3.3rem); background: linear-gradient(90deg,#ff6ec7,#9d4edd,#5d2ee6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: clamp(1.05rem,1.5vw,1.25rem); max-width: 55ch; color: var(--text-dim); }

article { background: linear-gradient(145deg,#191b24,#13141c); border: 1px solid #242732; border-radius: var(--radius-lg); padding: clamp(1.2rem,2vw,2.2rem); box-shadow: var(--shadow); position: relative; overflow: hidden; }
article::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 15% 10%, rgba(157,78,221,.18), transparent 55%); pointer-events: none; }

/* 
clamp(min, preferito, max) dice al browser: la dimensione del font deve stare tra min e max, ma preferibilmente usare preferito.
1.9rem = dimensione minima (legata al font-size di html, tipicamente 16px → quindi ~30px).
3.1vw = dimensione preferita in funzione della larghezza viewport (responsive).
2.4rem = dimensione massima (~38px). */
/* article h2 { margin-top: 0; font-size: clamp(1.9rem,3.1vw,2.4rem); } */

article > p:first-of-type small { color: var(--text-dim); }
article img { max-width: 100%; border-radius: var(--radius-sm); }

form { display: flex; flex-direction: column; gap: 1rem; }
label { display: flex; flex-direction: column; gap: .4rem; font-weight: 500; }
input, textarea { background: #11131a; color: var(--text); border: 1px solid #2a2d37; padding: .65rem .75rem; font: inherit; border-radius: var(--radius-sm); transition: border-color .25s var(--ease), background .35s var(--ease); }
input:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--shadow-focus); }
textarea { min-height: 260px; font-family: var(--code); line-height: 1.45; }
button { --btn-bg: linear-gradient(90deg,#5d2ee6,#9d4edd,#ff6ec7); --btn-bg-hover: linear-gradient(90deg,#5d2ee6 0%,#9d4edd 25%,#ff6ec7 55%,#ffb347 100%); font: inherit; font-weight: 600; letter-spacing: .5px; background: var(--btn-bg); color: #fff; border: none; padding: .75rem 1.2rem; border-radius: var(--radius-sm); cursor: pointer; position: relative; overflow: hidden; transition: filter .35s var(--ease), transform .35s var(--ease), background .6s linear; }
button:hover { filter: brightness(1.08) saturate(1.1); transform: translateY(-2px); background: var(--btn-bg-hover); }
button:active { transform: translateY(0); }

.actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.actions a { text-decoration: none; font-weight: 500; color: var(--text); background: #1e212b; border: 1px solid #292c37; padding: .55rem .9rem; border-radius: var(--radius-sm); transition: background .3s var(--ease), border-color .3s var(--ease); }
.actions a:hover { background: #262a35; border-color: #343947; }

footer { padding: 2.4rem 1rem 3rem; text-align: center; font-size: .8rem; color: var(--text-dim); }
footer a { color: var(--text-dim); text-decoration: none; }
footer a:hover { color: var(--text); }

pre, code { font-family: var(--code); font-size: .95rem; }
pre { background: #11131a; padding: 1rem; border-radius: var(--radius); border: 1px solid #242732; overflow-x: auto; position: relative; }
pre::-webkit-scrollbar { height: 10px; }
pre::-webkit-scrollbar-track { background: #11131a; }
pre::-webkit-scrollbar-thumb { background: #272b35; border-radius: 6px; }

blockquote { margin: 1.2rem 0; padding: .9rem 1.1rem; background: #181b24; border-left: 4px solid var(--brand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-dim); }
hr { border: none; height: 1px; background: #242732; margin: 2.2rem 0; }

/* Animations */
.fade-in { animation: fade .7s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: translateY(0);} }

/* Responsive refinements */
@media (max-width: 640px) {
  .navbar { flex-wrap: wrap; }
  .nav-links { width: 100%; justify-content: flex-end; }
  .grid { grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); }
  article { border-radius: var(--radius); }
}
