/* Depends on: tokens.css -- linked as a separate <link> by every page that draws text layers, never
   @import-ed (test_template_lint). Shared by stories, Reels and photos: spec
   docs/superpowers/specs/2026-10-03-text-layers-design.md. Sections: fonts and layers (here),
   editor (.tle-*). The fonts are OFL-licensed (static/fonts/text/OFL-*.txt).
   Browsers get Latin-subset WOFF2 (~60 KB for the five faces against ~310 KB of brotli'd TTF); the full TTFs stay
   beside them for Pillow (text_burn). A glyph outside the Latin range falls back to the system font on screen.
   Regenerate: pyftsubset X.ttf --unicodes="<the unicode-range below>" --flavor=woff2 --layout-features='*'
   --no-hinting --desubroutinize --output-file=X.latin.woff2 */

@font-face { font-family: "TL Poppins"; font-weight: 700; font-display: swap; src: url("../fonts/text/Poppins-Bold.latin.50291d8cdd37.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "TL Poppins"; font-weight: 300; font-display: swap; src: url("../fonts/text/Poppins-Light.latin.1d49412bee03.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "TL Space Mono"; font-weight: 700; font-display: swap; src: url("../fonts/text/SpaceMono-Bold.latin.1310d791d45a.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "TL Bebas"; font-weight: 400; font-display: swap; src: url("../fonts/text/BebasNeue-Regular.latin.9019def252d4.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "TL Pacifico"; font-weight: 400; font-display: swap; src: url("../fonts/text/Pacifico-Regular.latin.cb134450e425.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* A canvas is any box a layer is positioned in; its width sets the text size (6.2cqw x scale, TL-006). */
.tl-canvas { position: absolute; container-type: inline-size; pointer-events: none; z-index: 3; }
.tl-canvas[hidden] { display: none; }
/* A layer's text wraps at 90% of the canvas wherever it sits, as text_burn wraps the download. The width is
   explicit because an absolutely positioned box left at auto shrinks into the room right of `left`: a layer
   at x = 0.8 wrapped into a fifth of the canvas. Content-box, so a plate's padding goes around those 90%
   as it does in text_burn, not inside them (tokens.css makes everything border-box). */
.tl-layer {
  position: absolute; width: max-content; max-width: 90%; box-sizing: content-box;
  text-align: center; white-space: pre-wrap; overflow-wrap: anywhere;
  transform-origin: center; line-height: 1.15;
  font-size: 22px; font-size: calc(6.2cqw * var(--tl-scale, 1));
  text-shadow: var(--tl-shadow, none);
}
.tl-plated { padding: 0.2em 0.5em; border-radius: 0.4em; }
.tl-font-classic { font-family: "TL Poppins", system-ui, sans-serif; font-weight: 700; }
.tl-font-modern { font-family: "TL Poppins", system-ui, sans-serif; font-weight: 300; text-transform: uppercase; letter-spacing: 0.12em; }
.tl-font-typewriter { font-family: "TL Space Mono", ui-monospace, monospace; font-weight: 700; }
.tl-font-strong { font-family: "TL Bebas", Impact, "Arial Narrow", sans-serif; font-weight: 400; text-transform: uppercase; }
.tl-font-neon {
  font-family: "TL Pacifico", cursive; font-weight: 400;
  text-shadow: 0 0 0.1em #fff, 0 0 0.35em var(--tl-glow, #fff), 0 0 0.7em var(--tl-glow, #fff);
}
/* ---------- Editor (text_layers_editor.js) ---------- */
.tl-editing { pointer-events: auto; touch-action: none; }
.tl-editing .tl-layer { pointer-events: auto; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.tl-editing .tl-layer.is-selected { outline: 1.5px dashed rgba(255, 255, 255, 0.9); outline-offset: 4px; }
.tl-editing .tl-layer:empty::before { content: "Escribe…"; opacity: 0.6; }
/* Guides (the editor's `guides`): what the finished page covers with its own interface, hatched over the
   text so a layer under one reads as covered. White on the black letterbox and on the picture alike; a
   guide the selected layer runs under turns amber (fixed, not the theme's: it always sits on video). The
   label hugs the left edge, away from text, which starts centred. */
.tle-guides { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.tle-guides[hidden] { display: none; }
.tle-guide {
  position: absolute; box-sizing: border-box; display: flex; align-items: center; justify-content: flex-start; padding: 0 8px;
  border: 1px dashed rgba(255, 255, 255, 0.6); color: rgba(255, 255, 255, 0.9);
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0 5px, transparent 5px 11px);
  font: 700 9.5px/1.2 system-ui, sans-serif; letter-spacing: 0.06em; text-transform: uppercase;
  text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85); overflow: hidden;
}
.tle-guide.is-vertical { writing-mode: vertical-rl; justify-content: center; padding: 0; }
.tle-guide.is-hit {
  border: 1.5px solid #ffb020; color: #ffb020;
  background: repeating-linear-gradient(135deg, rgba(255, 176, 32, 0.28) 0 5px, transparent 5px 11px);
}

.tle { display: flex; flex-direction: column; gap: 10px; }
.tle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tle-panel[hidden] { display: none; }
.tle-panel { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.tle-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface-2); color: var(--text-primary); font-size: 14px; cursor: pointer;
}
.tle-btn:disabled { opacity: 0.45; cursor: default; }
.tle-btn[aria-pressed="true"], .tle-btn[aria-checked="true"] { border-color: var(--accent); color: var(--accent); }
.tle-btn-primary { border-color: var(--accent); background: var(--accent); color: #04150c; font-weight: 700; }
.tle-text { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text-primary); font: inherit; }
.tle-fonts, .tle-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.tle-font { font-size: 15px; line-height: 1.1; padding: 8px 12px; }
.tle-font.tl-font-modern, .tle-font.tl-font-strong { font-size: 14px; }
.tle-swatch { width: 30px; height: 30px; padding: 0; border: 2px solid var(--line); border-radius: 50%; cursor: pointer; }
.tle-swatch[aria-checked="true"] { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.tle-size { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.tle-size input { width: 140px; }

/* ---------- Photo post forms (photo_text_editor.js) ---------- */
.pte-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; }
.pte-strip[hidden] { display: none; }
.pte-thumb { position: relative; flex: 0 0 auto; width: 64px; height: 64px; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.pte-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pte-badge { position: absolute; right: 4px; bottom: 4px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: #04150c; font-size: 11px; font-weight: 800; }
.pte-badge[hidden] { display: none; }
body.pte-open { overflow: hidden; }
.pte-overlay { position: fixed; inset: 0; z-index: 220; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(4, 6, 8, 0.92); overflow-y: auto; }
.pte-overlay[hidden] { display: none; }
.pte-card { display: flex; flex-direction: column; gap: 12px; width: min(100%, 520px); max-height: 100%; }
.pte-frame { position: relative; align-self: center; line-height: 0; }
.pte-photo { display: block; max-width: 100%; max-height: 52vh; width: auto; height: auto; border-radius: 10px; }
.pte-toolbar { color: var(--text-primary); }
