/* The only stylesheet: the site's colours, type and layout reduced to what this page uses,
   then the uploader's own parts. */

/* ---- site look ---------------------------------------------------------------------- */
:root {
  --main: #be1e2d;
  --hover: #d93040;
  --secondary: #fff8f8;
  --main-light: color-mix(in srgb, var(--main) 30%, transparent);
  --background: #ffffff;
  --background-secondary: var(--secondary);
  --background-secondary-border: #cacaca;
  --text: #727272;
  --heading: #222222;
  --link: var(--main);
  --link-hover: var(--hover);
  --nav-background: #ffffffe6;
  --nav-border: #cacaca60;
  --code-background: #262626;
  --code-border: #424242;
  --code-text: #333;
  --code-pre-text: #b4b4b4;
  --ok: #2e7d32; /* success colour; the brand red means error */
}
@media (prefers-color-scheme: dark) {
  :root {
    --main: #ff5c6c;
    --hover: #d93040;
    --secondary: #000;
    --main-light: #be333375;
    --background: #121212;
    --background-secondary: var(--secondary);
    --background-secondary-border: #363636;
    --text: #b1b1b1;
    --heading: #ffffff;
    --link: var(--main);
    --link-hover: var(--hover);
    --nav-background: #111111db;
    --nav-border: #33333380;
    --code-background: #1e1e1e;
    --code-text: #c0c0c0;
    --ok: #66bb6a;
  }
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 17px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
}
h1, h2 { color: var(--heading); margin: 0 0 25px; line-height: 1.1; }
h1 { font-size: 36px; }
p { margin: 0 0 5px; }
a { color: var(--link); font-weight: bold; text-decoration: none; }
a:hover, a:focus { color: var(--link-hover); text-decoration: underline; }
strong { color: var(--heading); font-weight: 700; }
code, pre { font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Consolas, "DejaVu Sans Mono", monospace; color: var(--code-text); }
pre {
  padding: 8px 15px;
  border: 1px solid var(--code-border);
  border-radius: 5px;
  background: var(--code-background);
  color: var(--code-pre-text);
  overflow-x: auto;
}
pre code { color: var(--code-pre-text); }

/* Fixed top bar: logo left, links right. */
.header {
  position: fixed;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  width: 70%;
  padding: 0 15%;
  background: var(--nav-background);
  backdrop-filter: blur(1px);
  border-bottom: 1px var(--nav-border) solid;
}
.header-logo { display: flex; align-items: center; gap: 8px; font-weight: bold; text-transform: uppercase; color: var(--heading); }
.header-logo img { height: 32px; }
.header nav ul { display: flex; margin: 0; padding: 0; list-style: none; }
.header nav a { display: block; padding: 10px; color: var(--heading); }
.header nav a:hover { text-decoration: none; color: var(--link-hover); }

.wrapper, footer { width: 1080px; margin: 0 auto; }
.wrapper { margin-top: 100px; }
.wrapper section { margin: 70px auto; }
section { display: flex; gap: 20px; border-radius: 20px; background: var(--background); }
section.invert { background: var(--background-secondary); border: 1px solid var(--background-secondary-border); }
section.full > div { flex-basis: 100%; }
section.sub { padding: 30px; }
section > div > p { margin-bottom: 20px; }
section > div > p:last-child { margin-bottom: 0; }
footer { padding: 10px 0; font-size: 16px; border-top: 2px var(--main) solid; }
footer section.half > div { flex-basis: 50%; margin: 30px; }
footer .right { text-align: right; }

.button {
  border: none;
  border-radius: 12px;
  color: var(--background);
  background: var(--link);
  transition: all 0.3s ease;
  cursor: pointer;
}
.button.text {
  padding: 6px 16px;
  background: var(--background-secondary);
  color: var(--link);
  border: 1px solid var(--background-secondary-border);
  font: inherit;
}
.button.text:hover { background: var(--main-light); color: var(--link-hover); transform: translateY(-2px); }

@media (max-width: 1200px) {
  .header { width: 90%; padding: 0 5%; }
  .wrapper, footer { width: auto; margin-left: 20px; margin-right: 20px; }
}
@media (max-width: 720px) {
  body { overflow-wrap: break-word; }
  .wrapper { margin: 100px 0 0; }
  .wrapper > section { margin: 10px auto; border-radius: 0; }
  section { display: block; }
  footer { margin: auto; }
  footer .right { text-align: left; }
}

/* ---- uploader ----------------------------------------------------------------------- */

/* Two-language markup: upload.js sets <html lang>, the other language is hidden. */
html[lang="en"] [lang="it"], html[lang="it"] [lang="en"] { display: none; }

.drop {
  padding: 40px;
  border: 2px dashed var(--background-secondary-border);
  border-radius: 20px;
  text-align: center;
}
.drop.over { border-color: var(--main); background: var(--main-light); }
.drop input[type=file] { display: none; }
.drop .hint { margin: 15px 0 0; font-size: 14px; }

/* Progress row: fixed columns so the bar keeps one width while the readout changes. */
.bar {
  display: grid;
  grid-template-columns: 6em 1fr 22em;
  gap: 15px;
  align-items: center;
  margin: 20px 0;
}
.bar progress { width: 100%; height: 14px; accent-color: var(--main); }
.bar span { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.actions { margin-top: 20px; text-align: center; }
@media (max-width: 720px) {
  .bar { grid-template-columns: 6em 1fr; }
  .bar span { grid-column: 1 / -1; text-align: left; white-space: normal; }
}

/* Message component (#notice, and result.html): inline when open without a script, a centred
   modal via showModal(). Class ok/err/big picks icon, accent and which block shows. */
dialog {
  max-width: 480px;
  padding: 30px 40px;
  border: 2px solid var(--main);
  border-radius: 20px;
  background: var(--background);
  color: var(--text);
  text-align: center;
  overflow-wrap: anywhere;
}
dialog:not(:modal) { position: static; margin: 0 auto; }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(2px); }
dialog .icon {
  width: 64px; height: 64px; line-height: 64px; margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--main); color: #fff;
  font-size: 40px; font-weight: bold;
}
dialog .icon::before { content: "✗"; }
dialog.ok { border-color: var(--ok); }
dialog.ok .icon { background: var(--ok); }
dialog.ok .icon::before { content: "✓"; }
dialog code { color: var(--heading); user-select: all; }
dialog form { margin-top: 20px; }
dialog .nojs-form { display: grid; gap: 15px; justify-items: center; }
dialog a.button { display: inline-block; padding: 6px 16px; }
dialog.ok [data-key="error"], dialog.ok [data-key="tooBig"],
dialog.err [data-key="done"], dialog.err [data-key="tooBig"],
dialog.big [data-key="done"], dialog.big [data-key="error"] { display: none; }
