/* === Screenplay Portfolio — styles.css (v2) === */

@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* ── Theme variables ── */
:root {
  --bg-outer: #f0f0f0;
  --bg-page: #fdfdfd;
  --text: #1a1a1a;
  --text-muted: #999;
  --divider: #999;
  --shadow: rgba(0, 0, 0, 0.12);
  --controls-bg: rgba(240, 240, 240, 0.95);
  --controls-border: #ccc;
  --btn-bg: transparent;
  --btn-hover: rgba(0, 0, 0, 0.08);
  --btn-active-bg: #1a1a1a;
  --btn-active-text: #fdfdfd;
}

[data-theme="dark"] {
  --bg-outer: #1a1a1a;
  --bg-page: #2a2a2a;
  --text: #d4d4d4;
  --text-muted: #777;
  --divider: #555;
  --shadow: rgba(0, 0, 0, 0.4);
  --controls-bg: rgba(30, 30, 30, 0.95);
  --controls-border: #444;
  --btn-bg: transparent;
  --btn-hover: rgba(255, 255, 255, 0.08);
  --btn-active-bg: #d4d4d4;
  --btn-active-text: #1a1a1a;
}

[data-theme="sepia"] {
  --bg-outer: #d5c4a1;
  --bg-page: #f4ecd8;
  --text: #3e2723;
  --text-muted: #8d6e63;
  --divider: #a1887f;
  --shadow: rgba(62, 39, 35, 0.12);
  --controls-bg: rgba(213, 196, 161, 0.95);
  --controls-border: #a1887f;
  --btn-bg: transparent;
  --btn-hover: rgba(62, 39, 35, 0.08);
  --btn-active-bg: #3e2723;
  --btn-active-text: #f4ecd8;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 12pt;
  line-height: 1;
}

body {
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  background: var(--bg-outer);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

/* ── Controls bar ── */
.controls {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  gap: 1.5em;
  padding: 0.5em 1em;
  background: var(--controls-bg);
  border-bottom: 1px solid var(--controls-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  transition: background 0.3s, border-color 0.3s;
}

.controls__group {
  display: flex;
  gap: 0.25em;
  align-items: center;
}

.controls__label {
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-right: 0.25em;
  opacity: 0.6;
}

.controls__btn {
  font-family: inherit;
  font-size: inherit;
  background: var(--btn-bg);
  color: var(--text);
  border: 1px solid var(--controls-border);
  padding: 0.25em 0.6em;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}

.controls__btn:hover {
  background: var(--btn-hover);
}

.controls__btn.active {
  background: var(--btn-active-bg);
  color: var(--btn-active-text);
  border-color: var(--btn-active-bg);
}

/* ── Page container (letter-sized paper) ── */
.page {
  max-width: 8.5in;
  margin: 0.5in auto;
  background: var(--bg-page);
  padding: 1in 1in 1in 1.5in;
  box-shadow: 0 2px 12px var(--shadow);
  min-height: 11in;
  transition: background 0.3s, box-shadow 0.3s;
}

/* ── Scene headings (slug lines) ── */
.scene-heading {
  text-transform: uppercase;
  font-weight: 700;
  margin-top: 2em;
  margin-bottom: 1em;
  letter-spacing: 0.02em;
}

/* ── Action paragraphs ── */
.action {
  margin-bottom: 1em;
  line-height: 1;
}

/* ── Character cue ── */
.character {
  text-transform: uppercase;
  font-weight: 700;
  text-align: center;
  margin-top: 1.5em;
  margin-bottom: 0;
}

/* ── Dialogue block ── */
.dialogue-block {
  max-width: 4in;
  margin: 0 auto 1em;
}

.dialogue {
  text-align: center;
  line-height: 1;
}

.parenthetical {
  text-align: center;
  font-style: italic;
  margin-bottom: 0.25em;
}

/* ── Title page ── */
.title-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 9in;
  text-align: center;
  position: relative;
}

.title-page__title {
  font-size: 2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 3in;
}

.title-page__written-by {
  margin-top: 2em;
  font-style: italic;
}

.title-page__author {
  margin-top: 0.5em;
  font-weight: 700;
}

.title-page__tagline {
  margin-top: 1em;
  font-style: italic;
  opacity: 0.7;
}

.title-page__contact {
  position: absolute;
  bottom: 0;
  left: 0;
  text-align: left;
  line-height: 1.4;
}

/* ── Dividers (page breaks) ── */
.divider {
  border: none;
  border-top: 1px dashed var(--divider);
  margin: 2em 0;
  transition: border-color 0.3s;
}

/* ── Sub-headings within scenes ── */
.sub-heading {
  text-transform: uppercase;
  font-weight: 700;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  text-decoration: underline;
}

/* ── Text entries (portfolio items) ── */
.text-entry {
  margin-bottom: 1em;
  padding-left: 1em;
}

.text-entry__title {
  font-weight: 700;
}

.text-entry__meta {
  opacity: 0.7;
  font-size: 0.9rem;
}

/* ── Fade out (footer) ── */
.fade-out {
  text-align: center;
  text-transform: uppercase;
  font-weight: 700;
  margin-top: 3em;
  margin-bottom: 1em;
  letter-spacing: 0.1em;
}

/* ── Drafts grid ── */
.drafts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5em;
  margin-top: 1.5em;
}

.draft-card {
  border: 1px solid var(--divider);
  padding: 1em;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

.draft-card:hover {
  border-color: var(--text);
  box-shadow: 2px 2px 0 var(--divider);
}

.draft-card__label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  opacity: 0.5;
  font-weight: 700;
}

.draft-card__title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
}

.draft-card__preview {
  font-size: 0.7rem;
  line-height: 1.3;
  opacity: 0.75;
  max-height: 6em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

.draft-card__slug {
  display: block;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.3em;
  font-size: 0.65rem;
}

.draft-card__meta {
  font-size: 0.7rem;
  opacity: 0.6;
}

.draft-card__cta {
  font-size: 0.7rem;
  text-align: center;
  opacity: 0.5;
  margin-top: auto;
  letter-spacing: 0.05em;
}

.draft-card:hover .draft-card__cta {
  opacity: 1;
}

/* ── Modal overlay ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  padding: 2em;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-page);
  color: var(--text);
  max-width: 6.5in;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5in 1in 1in 1.5in;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  font-family: 'Courier Prime', 'Courier New', Courier, monospace;
  font-size: 12pt;
  line-height: 1;
  transition: background 0.3s, color 0.3s;
}

.modal__close {
  position: sticky;
  top: 0;
  float: right;
  font-family: inherit;
  font-size: 1.5rem;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0 0.3em;
  line-height: 1;
  opacity: 0.5;
  z-index: 1;
}

.modal__close:hover {
  opacity: 1;
}

.modal__content .m-title {
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  font-size: 1.2rem;
  margin-bottom: 1.5em;
  letter-spacing: 0.05em;
}

.modal__content .m-context {
  margin-bottom: 1.5em;
  font-style: italic;
  opacity: 0.8;
  line-height: 1.3;
}

.modal__content .m-slug {
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 1.5em;
  margin-bottom: 1em;
}

.modal__content .m-action {
  margin-bottom: 1em;
  line-height: 1;
}

.modal__content .m-character {
  text-transform: uppercase;
  font-weight: 700;
  text-align: center;
  margin-top: 1.2em;
  margin-bottom: 0;
}

.modal__content .m-paren {
  text-align: center;
  font-style: italic;
  max-width: 3.5in;
  margin: 0 auto;
}

.modal__content .m-dialogue {
  text-align: center;
  max-width: 3.5in;
  margin: 0 auto 0.8em;
  line-height: 1;
}

/* ── Links ── */
a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-style: dotted;
}

a:hover {
  text-decoration-style: solid;
}

/* ── Placeholder markers ── */
.placeholder {
  color: var(--text-muted);
  font-style: italic;
  transition: color 0.3s;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .controls {
    gap: 0.75em;
    font-size: 0.65rem;
    padding: 0.4em 0.5em;
  }

  .controls__label {
    display: none;
  }

  .page {
    margin: 0;
    padding: 1em 1.2em;
    box-shadow: none;
    min-height: auto;
  }

  .title-page {
    min-height: 80vh;
  }

  .title-page__title {
    margin-top: 2in;
    font-size: 1.5rem;
  }

  .dialogue-block {
    max-width: 85%;
  }

  .drafts-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 1em 1.2em;
    max-height: 90vh;
  }

  .modal-overlay {
    padding: 0.5em;
  }
}

/* ── Print ── */
@media print {
  .controls {
    display: none;
  }

  body {
    background: white;
    color: #1a1a1a;
  }

  .page {
    box-shadow: none;
    margin: 0;
    padding: 1in 1in 1in 1.5in;
    background: white;
  }

  .divider {
    page-break-after: always;
    border: none;
    margin: 0;
  }
}
