/* ==========================================================================
   Luca Rinaldi — site-wide design tokens (Eduba design language)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500;600;700;800&display=swap');

@font-face { font-family: 'Diatype'; font-weight: 700; font-display: swap; src: url('../fonts/diatype-bold.woff2') format('woff2'); }
@font-face { font-family: 'Diatype'; font-weight: 500; font-display: swap; src: url('../fonts/diatype-med.woff2') format('woff2'); }
@font-face { font-family: 'Diatype'; font-weight: 300; font-display: swap; src: url('../fonts/diatype-reg.woff2') format('woff2'); }

:root {
  --eb-dark-brown:   #5D3136;
  --eb-white:        #FEFBF6;
  --eb-cream:        #EAD5D6;
  --eb-skin:         #F9ECDF;
  --eb-text-dark:    #4A2C2A;
  --eb-light-brown:  #A2777A;
  --eb-light-pink:   #D8BFC0;
  --eb-subtitle:     #7D5658;
  --eb-deep-wine:    #421D24;
  --eb-medium-brown: #7B5A5C;
  --eb-green-dot:    #25CA58;
  --eb-success:      #1A9C43;

  --primary-color:   #5D3136; /* keep this name so old main.js skip-link inherits it */

  --font-display: 'Diatype', 'Space Grotesk', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --frame-pad: 8px;
  --radius-sm: 4px;

  --ease-settle:    cubic-bezier(.22,.61,.36,1);
  --ease-panel:     cubic-bezier(.16, 1, .3, 1);
  --ease-symmetric: cubic-bezier(.45,.05,.55,.95);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--eb-dark-brown);
  font-family: var(--font-mono);
  color: var(--eb-text-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  isolation: isolate;
  overflow-x: hidden;
}

::selection { background: var(--eb-light-pink); color: var(--eb-dark-brown); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* loader (kept structurally, restyled) */
.loader {
  position: fixed; inset: 0; background: var(--eb-dark-brown);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
  transition: opacity .4s ease, visibility .4s ease;
}
.loader.is-hidden { opacity: 0; visibility: hidden; }
.loader .spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--eb-light-pink); border-top-color: var(--eb-white);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* film grain */
.film-grain {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; opacity: 0.055;
  mix-blend-mode: soft-light; z-index: 9999;
}

/* shell */
.shell {
  position: fixed; inset: 0;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: var(--frame-pad);
  height: 100svh; isolation: isolate;
}

.content-card {
  background: var(--eb-white);
  border-radius: var(--radius-sm);
  overflow-y: auto; overflow-x: hidden;
  position: relative;
  transition: filter .32s var(--ease-settle);
}
.content-card.is-blurred { filter: blur(7px); }

/* For long pages (cv, blog) we use a normal scroll instead of the fixed shell */
.shell--scroll {
  position: relative;
  display: block;
  height: auto;
  min-height: 100svh;
  padding: var(--frame-pad);
}
.shell--scroll .content-card {
  overflow: visible;
  height: auto;
}

/* === TopNav === */
.topnav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 2px 7px 3px; color: var(--eb-cream);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.topnav__home {
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: none; color: inherit; font: inherit; cursor: pointer;
  text-decoration: none;
}
.topnav__monogram {
  width: 22px; height: 22px; border-radius: 3px;
  background: var(--eb-white); color: var(--eb-dark-brown);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  letter-spacing: 0;
}

.topnav__menu {
  display: flex; align-items: center; gap: 14px;
  list-style: none; padding: 0; margin: 0;
}
.topnav__menu a {
  color: var(--eb-cream); text-decoration: none;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 4px 0;
  border-bottom: 1px solid transparent; transition: border-color .2s ease, color .2s ease;
}
.topnav__menu a:hover, .topnav__menu a.active { color: var(--eb-white); border-color: var(--eb-light-pink); }

.topnav__right { display: flex; align-items: center; gap: 14px; }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 12px; border-radius: var(--radius-sm); height: 28px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  text-decoration: none; cursor: pointer; border: none;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.chip--pink  { background: var(--eb-light-pink); color: var(--eb-dark-brown); }
.chip--pink:hover  { background: var(--eb-white); color: var(--eb-dark-brown); transform: scaleX(1.04); }
.chip--black { background: #000; color: #fff; }
.chip--black:hover { transform: scaleX(1.04); }
.chip--wine  { background: var(--eb-dark-brown); color: var(--eb-white); }
.chip--wine:hover  { transform: scaleX(1.04); }

/* language switcher (inherits .lang-btn from old main.js) */
.lang-switch {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px; border-radius: var(--radius-sm);
  background: rgba(254,251,246,0.06);
  border: 1px solid rgba(254,251,246,0.2);
}
.lang-switch .lang-btn {
  background: transparent; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: 3px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; color: var(--eb-cream);
  text-transform: uppercase;
  transition: background .2s ease, color .2s ease;
}
.lang-switch .lang-btn.active { background: var(--eb-white); color: var(--eb-dark-brown); }
.lang-switch .lang-btn:not(.active):hover { color: var(--eb-white); }
.lang-switch .lang-btn img { display: none; }

/* live blink dot */
@keyframes dotBlink { 0%,100% { opacity: 1 } 50% { opacity: 0.15 } }
.dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--eb-green-dot);
  animation: dotBlink 2s ease-in-out infinite;
  flex-shrink: 0; display: inline-block;
}

/* mobile menu toggle (kept ID for main.js) */
.mobile-menu-btn {
  display: none;
  background: rgba(254,251,246,0.06);
  border: 1px solid rgba(254,251,246,0.2);
  color: var(--eb-cream);
  width: 32px; height: 28px; border-radius: var(--radius-sm);
  cursor: pointer; align-items: center; justify-content: center;
  font-size: 14px; padding: 0;
}
.mobile-menu-btn:hover { color: var(--eb-white); }

/* === BottomNav (slide-up contact) === */
.bottomnav { position: relative; height: 0; }
.bottomnav__inner {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 12px; padding: 19px 20px 20px;
  pointer-events: none; z-index: 40;
}
.bn-group { pointer-events: auto; display: flex; align-items: flex-end; gap: 3px; }

.bn-card { background: var(--eb-white); border: 1px solid var(--eb-dark-brown); padding: 5px; }
.bn-inner { background: var(--eb-skin); border: 1px solid var(--eb-light-brown); padding: 2px; }

.bn-panel {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .52s var(--ease-panel);
}
.bn-panel.is-open { grid-template-rows: 1fr; }
.bn-panel__overflow { overflow: hidden; min-height: 0; }
.bn-panel__body {
  padding: 6px 4px;
  border-bottom: 1px dashed rgba(93,49,54,.22);
  margin-bottom: 2px;
}
.bn-panel__title {
  text-align: center; padding: 2px 0 6px;
  border-bottom: 1px dashed rgba(93,49,54,.18);
  margin-bottom: 7px;
}
.bn-panel__title span {
  font-family: var(--font-mono); font-size: 8px; font-weight: 700;
  letter-spacing: 0.12em; color: var(--eb-light-brown);
}

.bn-field {
  padding: 0 2px 6px; border-bottom: 1px dashed rgba(93,49,54,.12);
  margin-bottom: 6px;
}
.bn-field:last-of-type { border-bottom: none; margin-bottom: 0; }
.bn-field label {
  display: block; font-family: var(--font-mono); font-size: 7px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--eb-light-brown);
  margin-bottom: 4px;
}
.bn-field input, .bn-field textarea {
  width: 100%; background: transparent; border: none;
  border-bottom: 1px solid rgba(93,49,54,.2); padding: 2px 0 3px;
  font-family: var(--font-mono); font-size: 9px; color: var(--eb-dark-brown);
  outline: none; resize: none; line-height: 1.5;
}
.bn-field input::placeholder, .bn-field textarea::placeholder { color: rgba(93,49,54,.45); }

.bn-send {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  background: var(--eb-dark-brown); color: var(--eb-white);
  border: none; padding: 5px 7px 5px 8px;
  font-family: var(--font-mono); font-size: 8px; font-weight: 800;
  letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer;
  transition: background .2s ease;
}
.bn-send.is-success { background: var(--eb-success); justify-content: center; }

.bn-toggle {
  background: none; border: 1px solid var(--eb-light-brown);
  padding: 5px 28px 5px 5px; cursor: pointer;
  display: flex; flex-direction: column; text-align: left;
  width: 100%; min-width: 200px; font: inherit;
}
.bn-toggle__title {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  text-transform: uppercase; color: var(--eb-dark-brown);
}
.bn-toggle__sub {
  font-family: var(--font-mono); font-size: 6px; letter-spacing: 1px;
  text-transform: uppercase; color: var(--eb-light-brown); margin-top: 2px;
}

.bn-chevron {
  background: none; border: none; padding: 0; cursor: pointer;
  pointer-events: auto; height: 15px; width: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.bn-chevron svg { display: block; transition: transform .32s var(--ease-symmetric); }
.bn-chevron.is-open svg { transform: rotate(180deg); }

.bn-clock {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  color: var(--eb-cream); text-transform: uppercase; letter-spacing: 0.12em;
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
  pointer-events: none;
}
.bn-clock__time { font-size: 11px; font-variant-numeric: tabular-nums; }

.bn-scrim { position: absolute; inset: 0; z-index: 39; cursor: pointer; }

/* === Section primitives === */
.section {
  padding: 60px 40px;
  border-top: 1px solid var(--eb-cream);
}
.section:first-child { border-top: none; }

.lbl-section {
  font-family: var(--font-mono); font-size: 8px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--eb-light-brown);
  display: block; margin-bottom: 12px;
}
.h-display {
  font-family: var(--font-display); font-size: clamp(28px, 3.4vw, 48px);
  font-weight: 700; line-height: 1.05; letter-spacing: -0.02em;
  color: var(--eb-dark-brown); margin: 0;
}
.h-section {
  font-family: var(--font-display); font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 700; line-height: 1.1; letter-spacing: -0.02em;
  color: var(--eb-dark-brown); margin: 0;
}
.body-copy {
  font-family: var(--font-display); font-weight: 300; font-size: 15px;
  line-height: 1.6; color: var(--eb-subtitle); margin: 0;
}

.lead {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(18px, 1.8vw, 22px); line-height: 1.5;
  color: var(--eb-subtitle); margin: 0;
  max-width: 720px;
}

/* dashed divider helper */
.dashed-rule {
  border: none; border-top: 1px dashed rgba(93,49,54,.22);
  margin: 24px 0;
}

/* mono tag list */
.tag-list {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tag {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--eb-dark-brown);
  padding: 4px 9px; border: 1px solid var(--eb-light-pink); border-radius: 3px;
  background: var(--eb-white);
}
.tag--featured { background: var(--eb-dark-brown); color: var(--eb-white); border-color: var(--eb-dark-brown); }

/* Skip link override (main.js sets inline cssText) */
.skip-link { background: var(--eb-dark-brown) !important; color: var(--eb-white) !important; font-family: var(--font-mono); }

/* responsive */
@media (max-width: 900px) {
  .topnav {
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    letter-spacing: 0.06em;
  }

  .topnav__home {
    min-width: 0;
    color: var(--eb-white);
  }

  .topnav__home > span:last-child {
    max-width: 58vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: .96;
  }

  .topnav__right { margin-left: auto; gap: 8px; }

  .chip--black {
    max-width: 58vw;
    border: 1px solid rgba(254,251,246,.35);
  }

  .chip--black > span:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topnav__menu {
    display: none;
    position: fixed;
    inset: 56px 8px auto 8px;
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    background: var(--eb-deep-wine);
    border-radius: var(--radius-sm);
    z-index: 50;
    gap: 10px;
    border: 1px solid rgba(254,251,246,.2);
    box-shadow: 0 10px 28px rgba(0,0,0,.28);
  }

  .topnav__menu.active { display: flex; }
  .topnav__menu li { width: 100%; }

  .topnav__menu a {
    display: block;
    padding: 10px 12px;
    color: var(--eb-white);
    border-bottom-color: rgba(216,191,192,.35);
  }

  .mobile-menu-btn {
    display: inline-flex;
    width: 36px;
    height: 32px;
    color: var(--eb-white);
  }

  .topnav__right .lang-switch { display: inline-flex; }
  .topnav__right .chip:not(.chip--black) { display: none; }
  .section { padding: 40px 20px; }
}

/* hide visual elements only when reduced motion */
@media (prefers-reduced-motion: reduce) {
  .dot { animation: none; }
  .film-grain { display: none; }
}

/* Fixed back-to-top kept usable but restyled */
.back-to-top {
  position: fixed; right: 28px; bottom: 90px;
  width: 36px; height: 36px;
  background: var(--eb-dark-brown); color: var(--eb-white);
  border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  text-decoration: none; z-index: 35;
  transition: transform .2s ease, opacity .2s ease;
}
.back-to-top.is-visible { display: flex; }
.back-to-top:hover { transform: translateY(-2px); }
