/* Layout of the shell. Colours and fonts are variables so that brand/marca.css
   can restyle it without touching this file. */

:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --page: #f6f7f9;
  --surface: #ffffff;
  --ink: #1d2433;
  --ink-soft: #5b6475;
  --line: #dfe3ea;
  --accent: #2f5fd0;
  --accent-ink: #ffffff;
  --word: #2b6cd4;
  --cell: #1e9460;
  --slide: #d9622b;
  --danger: #b3261e;
  --radius: 14px;
  color-scheme: light dark;
}

/* Dark: the system's setting, unless the user chose a theme (app/theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #12151c;
    --surface: #1b1f29;
    --ink: #eceff5;
    --ink-soft: #a3acbd;
    --line: #2d3342;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #12151c;
  --surface: #1b1f29;
  --ink: #eceff5;
  --ink-soft: #a3acbd;
  --line: #2d3342;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--font);
  color: var(--ink);
  background: var(--page);
}

a { color: var(--accent); }

.button {
  font: inherit;
  font-weight: 600;
  padding: 0.5em 1.1em;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
.button-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.button:disabled { opacity: 0.5; cursor: default; }
.button:focus-visible, .card:focus-visible, .icon-button:focus-visible, .doc-brand:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }

/* ---------------------------------------------------------------- home */

.home { min-height: 100%; display: flex; flex-direction: column; }
.home main { flex: 1; width: min(100% - 2rem, 60rem); margin: 0 auto; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 2rem, 60rem);
  margin: 0 auto;
  padding: 1.25rem 0;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand img { width: 2rem; height: 2rem; }

/* The other languages of the site: the page's own is not offered. */
.languages { display: flex; gap: 1rem; font-size: 0.95rem; }
.languages a { color: var(--ink-soft); text-decoration: none; }
.languages a:hover, .languages a:focus-visible { color: var(--accent); text-decoration: underline; }
html:lang(es) .languages [hreflang="es"], html:lang(en) .languages [hreflang="en"] { display: none; }

.hero { padding: 2.5rem 0 2rem; text-align: center; }
.hero h1 { margin: 0 0 0.75rem; font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.12; letter-spacing: -0.02em; text-wrap: balance; }
.hero p { margin: 0 auto; max-width: 40rem; font-size: 1.15rem; color: var(--ink-soft); text-wrap: pretty; }

/* A page can be about one way of starting (<html data-focus>, written by
   scripts/pages): that one goes first. */
.start { display: grid; }
[data-focus="open"] .open-zone { order: -1; margin: 0 0 1rem; }
[data-focus="word"] .card-word, [data-focus="cell"] .card-cell, [data-focus="slide"] .card-slide { order: -1; border-color: var(--tone); }
/* A page that opens a document at once (<html data-start>, app/main.js) shows nothing before it. */
[data-start] .home { visibility: hidden; }

.new-documents { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }

.card {
  display: grid;
  justify-items: start;
  gap: 0.15rem;
  padding: 1.25rem;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--tone); box-shadow: 0 8px 24px rgb(0 0 0 / 0.08); }
.card svg { width: 2.75rem; height: 2.75rem; margin-bottom: 0.6rem; fill: color-mix(in srgb, var(--tone) 14%, transparent); stroke: var(--tone); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.card strong { font-size: 1.1rem; }
.card span { color: var(--ink-soft); font-size: 0.95rem; }
.card-word { --tone: var(--word); }
.card-cell { --tone: var(--cell); }
.card-slide { --tone: var(--slide); }

.open-zone {
  margin-top: 1rem;
  padding: 1.75rem 1rem;
  text-align: center;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.open-zone p { margin: 0.6rem 0 0; color: var(--ink-soft); }
.open-zone .formats { font-size: 0.85rem; max-width: 36rem; margin-inline: auto; }
.dragging .open-zone { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

.notice { margin: 1rem 0 0; padding: 0.75rem 1rem; border-radius: 10px; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

.site-footer {
  width: min(100% - 2rem, 60rem);
  margin: 3rem auto 0;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.5rem;
  text-align: center;
  color: var(--ink-soft);
}
.site-footer p { margin: 0 0 0.5rem; }
/* Links in the footer read as plain text; they only show as links on hover or keyboard focus. */
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover, .site-footer a:focus-visible { text-decoration: underline; }

/* ----------------------------------------------------------- workspace */

.workspace { height: 100%; display: flex; flex-direction: column; }

.doc-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.75rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.doc-bar .button { padding: 0.3em 0.9em; }
.icon-button { display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; }
.icon-button:hover { background: var(--page); }
/* The theme button shows where it goes: the moon in light, the sun in dark. */
#theme .icon-sun { display: none; }
.theme-dark #theme .icon-sun { display: block; }
.theme-dark #theme .icon-moon { display: none; }
.icon-button svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* The brand, when there is one: the product the user is in. */
.doc-brand { display: inline-flex; align-items: center; gap: 0.45rem; flex: none; padding: 0 0.8rem 0 0; border: 0; border-right: 1px solid var(--line); background: none; color: inherit; font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.doc-brand:empty { display: none; }
.doc-brand img { width: 1.5rem; height: 1.5rem; }
@media (max-width: 40rem) { .doc-brand > :not(img) { display: none; } }
.doc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Whose editor this is: an "i" whose label appears under it on hover or keyboard focus. */
.doc-credit { position: relative; flex: none; }
.doc-credit::after { content: attr(aria-label); position: absolute; top: calc(100% + 0.4rem); right: 0; z-index: 10; padding: 0.35em 0.7em; border: 1px solid var(--line); border-radius: 0.4rem; background: var(--surface); color: var(--ink); font-size: 0.8rem; white-space: nowrap; box-shadow: 0 2px 8px rgb(0 0 0 / 15%); opacity: 0; visibility: hidden; transition: opacity 0.12s; pointer-events: none; }
.doc-credit:hover::after, .doc-credit:focus-visible::after { opacity: 1; visibility: visible; }
.doc-dirty { flex: none; padding: 0.1em 0.6em; border-radius: 999px; font-size: 0.8rem; color: var(--ink-soft); background: var(--page); }
.status { flex: 1; min-width: 0; text-align: right; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status[data-state="error"] { color: var(--danger); }

.editor-area { flex: 1; min-height: 0; }

@media (max-width: 40rem) {
  .doc-dirty, #save-as { display: none; }
}

/* ------------------------------------------------- feedback (app/report.js, app/rating.js) */

.rating { position: relative; order: -2; width: 100%; margin: 0 auto 1.5rem; padding: 1rem 2.75rem; max-width: 28rem; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.rating-title { margin: 0 0 0.6rem; font-weight: 600; }
.rating-close { position: absolute; top: 0.5rem; right: 0.5rem; }
.faces { display: flex; justify-content: center; gap: 1rem; }
.faces[hidden] { display: none; }
.face { display: grid; place-items: center; width: 3rem; height: 3rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-soft); cursor: pointer; }
.face:hover, .face:focus-visible { color: var(--accent); background: var(--page); }
.face svg { width: 2.25rem; height: 2.25rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.face svg .eye { fill: currentColor; stroke: none; }
.rating-form { display: grid; gap: 0.5rem; text-align: left; }
.rating-thanks { margin: 0; color: var(--ink-soft); }

.dialog { width: min(100% - 2rem, 32rem); padding: 1.25rem 1.5rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.dialog form { display: grid; gap: 0.6rem; }
.dialog h2 { margin: 0 0 0.25rem; font-size: 1.15rem; }
.dialog textarea, .rating textarea { width: 100%; padding: 0.5rem 0.6rem; font: inherit; color: var(--ink); background: var(--page); border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.dialog .check { display: flex; align-items: center; gap: 0.4rem; }
.dialog details { font-size: 0.85rem; color: var(--ink-soft); }
.dialog pre { max-height: 12rem; overflow: auto; margin: 0.4rem 0 0; padding: 0.5rem; background: var(--page); border-radius: 8px; white-space: pre-wrap; }
.hint { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.form-status { margin: 0; min-height: 1.2em; font-size: 0.9rem; color: var(--ink-soft); }
.form-status[data-kind="error"] { color: var(--danger); }
.form-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
