/* =========================================================
   INNOVA — Liceo Corradino d'Ascanio — archivio appunti
   Foglio di stile condiviso
   ========================================================= */

:root{
  --paper:      #F5F0E5;
  --paper-dim:  #EFE8D9;
  --ink:        #241F1B;
  --ink-soft:   #5B5348;
  --ink-faint:  #948C7C;
  --crimson:    #7A2019;
  --crimson-dk: #591712;
  --brass:      #A2803C;
  --brass-dim:  #C9B383;
  --card:       #ECE5D5;
  --card-border:#D9CEB6;
  --line:       #D9CEB6;
  --shadow:     0 1px 2px rgba(36,31,27,.06), 0 6px 18px rgba(36,31,27,.07);
  --shadow-lift:0 4px 10px rgba(36,31,27,.10), 0 14px 30px rgba(36,31,27,.12);
  --radius-s: 6px;
  --radius-m: 10px;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", serif;
  --sans:  "Public Sans", "Helvetica Neue", Arial, sans-serif;
  --mono:  "IBM Plex Mono", "Courier New", monospace;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--paper-dim);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a{ color: inherit; }

.page{
  max-width: 900px;
  margin: 0 auto;
  background: var(--paper);
  min-height: 100vh;
  box-shadow: 0 0 0 1px rgba(36,31,27,.05);
  display: flex;
  flex-direction: column;
}

/* ---------- Header / letterhead ---------- */
.site-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px 18px;
  border-bottom: 2px solid var(--ink);
  position: relative;
}
.site-header::after{
  content:"";
  position:absolute;
  left:0; right:0; bottom:-6px;
  height:1px;
  background: var(--brass-dim);
}
.site-header .school{
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .01em;
  text-decoration: none;
  color: var(--ink);
}
.site-header .brand{
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .18em;
  color: var(--crimson);
  text-decoration: none;
}

/* ---------- Footer ---------- */
.site-footer{
  margin-top: auto;
  background: var(--ink);
  color: var(--paper);
  padding: 26px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer p{
  margin: 0;
  font-style: italic;
  font-family: var(--serif);
  font-size: 15px;
  color: #E7DFCE;
}
.site-footer a{
  font-family: var(--sans);
  font-weight: 700;
  text-decoration: none;
  color: var(--brass-dim);
  white-space: nowrap;
}
.site-footer a:hover{ color: var(--paper); }

/* ---------- Hero / titles ---------- */
.hero{
  padding: 46px 40px 8px;
  text-align: center;
}
.hero h1{
  font-family: var(--serif);
  font-weight: 600;
  font-size: 40px;
  margin: 0 0 10px;
  letter-spacing: -.01em;
}
.hero .sub{
  font-size: 15.5px;
  color: var(--ink-soft);
  margin: 0;
}
.hero .sub a{
  color: var(--crimson);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}
.hero .sub a:hover{ color: var(--crimson-dk); }

/* ---------- Subject grid (index) ---------- */
.subject-section{ padding: 28px 40px 12px; }
.subject-section h2{
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 16px;
  padding-left: 2px;
}
.subject-grid{
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
}
@media (max-width: 760px){
  .subject-grid{ grid-template-columns: repeat(2, 1fr); }
}

.subject-card{
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  aspect-ratio: 3 / 4;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-m);
  padding: 14px 14px 16px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
  overflow: hidden;
}
.subject-card::before{
  /* perforated top edge, like an exam booklet cover */
  content:"";
  position: absolute;
  top: 10px; left: 12px; right: 12px;
  height: 0;
  border-top: 2px dashed var(--brass-dim);
  opacity: .7;
}
.subject-card .monogram{
  position: absolute;
  top: 18px; right: 14px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 46px;
  color: var(--ink);
  opacity: .08;
  line-height: 1;
  pointer-events: none;
}
.subject-card .name{
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  position: relative;
  z-index: 1;
}
.subject-card:hover{
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--brass);
}

/* ---------- Materia page ---------- */
.materia-title{
  text-align: center;
  padding: 40px 40px 6px;
}
.materia-title h1{
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 36px;
  margin: 0;
}

.search-wrap{
  display: flex;
  justify-content: center;
  padding: 18px 40px 8px;
}
.search-wrap input{
  width: 100%;
  max-width: 420px;
  padding: 11px 16px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-wrap input:focus{
  border-color: var(--crimson);
  box-shadow: 0 0 0 3px rgba(122,32,25,.12);
}
.search-wrap input::placeholder{ color: var(--ink-faint); font-style: italic; }

.filter-hint{
  text-align: center;
  font-size: 15px;
  color: var(--ink-soft);
  margin: 14px 0 6px;
}

.prof-row{
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 12px 40px 28px;
  scrollbar-width: thin;
}
.prof-chip{
  flex: 0 0 auto;
  min-width: 128px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-s) var(--radius-s) 3px 3px;
  padding: 16px 14px 12px;
  text-align: center;
  cursor: pointer;
  font-family: var(--sans);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
  position: relative;
}
.prof-chip::before{
  content:"";
  position:absolute; top:0; left:14px; right:14px; height:3px;
  background: var(--brass-dim);
  border-radius: 0 0 3px 3px;
  opacity:.8;
}
.prof-chip .pname{
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 14px;
}
.prof-chip .pcount{
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-soft);
}
.prof-chip .pcount b{
  display: inline-flex;
  align-items:center; justify-content:center;
  min-width: 20px; height: 20px;
  padding: 0 4px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  margin-left: 4px;
  font-size: 11px;
}
.prof-chip:hover{ transform: translateY(-2px); box-shadow: var(--shadow); }
.prof-chip.active{
  border-color: var(--crimson);
  background: #F4E4DF;
}
.prof-chip.active::before{ background: var(--crimson); }

.notes-section{ padding: 8px 40px 40px; }
.notes-section h2{
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 24px;
  text-align: center;
  margin: 10px 0 22px;
}

.note-card{
  display: flex;
  gap: 18px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-m);
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  position: relative;
}
.note-card .doc-icon{
  flex: 0 0 auto;
  width: 46px; height: 58px;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--card-border);
  position: relative;
  overflow: hidden;
}
.note-card .doc-icon span{
  position:absolute; left:8px; right:8px; height:2px;
  background: var(--ink-faint);
}
.note-card .doc-icon span:nth-child(1){ top:12px; }
.note-card .doc-icon span:nth-child(2){ top:20px; }
.note-card .doc-icon span:nth-child(3){ top:28px; }
.note-card .doc-icon span:nth-child(4){ top:36px; width: 55%; }

.note-card .seal{
  position: absolute;
  top: 14px; right: 18px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid var(--crimson);
  color: var(--crimson);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  line-height: 1.1;
  transform: rotate(-8deg);
  opacity: .85;
}
.note-card .seal small{ display:block; font-size:8px; font-weight:600; }

.note-card .body{ flex: 1; padding-right: 46px; }
.note-card .row{ font-size: 14.5px; margin: 3px 0; }
.note-card .row b{ font-weight: 700; }
.note-card .row.arg{ font-size: 15.5px; }
.note-card .nota{ font-style: italic; color: var(--ink-soft); }
.note-card .autore{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 8px;
}

.empty-state{
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
  font-style: italic;
  font-family: var(--serif);
}

/* ---------- Pubblica page ---------- */
.publish-wrap{ padding: 40px; }
.publish-panel{
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-m);
  padding: 30px;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 26px;
  box-shadow: var(--shadow);
}
@media (max-width: 640px){
  .publish-panel{ grid-template-columns: 1fr; }
}

.upload-box{
  background: var(--paper);
  border: 2px dashed var(--card-border);
  border-radius: var(--radius-s);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
  min-height: 200px;
}
.upload-box:hover, .upload-box.drag{
  border-color: var(--crimson);
  background: #F7EFE8;
}
.upload-box svg{ width: 30px; height: 30px; color: var(--ink-soft); }
.upload-box .label{ font-size: 13px; color: var(--ink-soft); }
.upload-box .filename{ font-size: 12.5px; font-weight: 700; color: var(--crimson); word-break: break-all; }
.upload-box input[type=file]{ display:none; }

.form-grid{ display:flex; flex-direction:column; gap:14px; }
.form-note{
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: .04em;
}
.field label{
  display:block;
  font-weight: 700;
  font-style: italic;
  font-family: var(--serif);
  font-size: 15px;
  margin-bottom: 6px;
}
.field input[type=text], .field textarea{
  width: 100%;
  border: none;
  border-bottom: 1.5px solid var(--ink-faint);
  background: transparent;
  padding: 6px 2px;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease;
}
.field input[type=text]:focus, .field textarea:focus{ border-color: var(--crimson); }
.field textarea{
  border: 1px solid var(--card-border);
  border-radius: var(--radius-s);
  background: var(--paper);
  padding: 10px 12px;
  min-height: 70px;
  resize: vertical;
}

.year-picker{ display:flex; gap:8px; }
.year-picker button{
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-faint);
  background: var(--paper);
  font-family: var(--mono);
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.year-picker button.selected{
  background: var(--crimson);
  border-color: var(--crimson);
  color: var(--paper);
}
.year-picker button:hover{ border-color: var(--crimson); }

.publish-actions{ display:flex; justify-content:flex-end; margin-top: 22px; }
.btn{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: var(--radius-s);
  border: 1.5px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}
.btn:hover{ background: var(--crimson); border-color: var(--crimson); transform: translateY(-1px); }
.btn.ghost{
  background: transparent;
  color: var(--ink);
}
.btn.ghost:hover{ background: var(--ink); color: var(--paper); }

/* ---------- Success state ---------- */
.success-wrap{
  text-align: center;
  padding: 70px 40px;
}
.success-wrap .stamp{
  width: 84px; height: 84px;
  margin: 0 auto 22px;
  border-radius: 50%;
  border: 3px solid var(--crimson);
  color: var(--crimson);
  display:flex; align-items:center; justify-content:center;
  transform: rotate(-6deg);
}
.success-wrap .stamp svg{ width: 38px; height:38px; }
.success-wrap h1{
  font-family: var(--serif);
  font-size: 30px;
  margin: 0 0 12px;
}
.success-wrap p{
  color: var(--ink-soft);
  font-size: 15px;
  max-width: 460px;
  margin: 0 auto 28px;
  line-height: 1.5;
}

.hidden{ display: none !important; }

/* focus visibility for a11y */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible{
  outline: 2px solid var(--crimson);
  outline-offset: 2px;
}

@media (max-width: 600px){
  .site-header, .hero, .subject-section, .notes-section, .publish-wrap, .site-footer{ padding-left: 20px; padding-right: 20px; }
  .hero h1{ font-size: 30px; }
  .subject-grid{ grid-template-columns: repeat(2,1fr); }
  .prof-row{ padding-left: 20px; padding-right: 20px; }
}
