@import "base.css";

/* App uses same warm paper palette — utility, not dashboard */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  flex-wrap: wrap;
}

.app-header .logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.app-header .logo:hover {
  color: var(--accent);
}

.app-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.app-nav button {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.45rem 0.65rem;
  border: none;
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.app-nav button:hover {
  color: var(--ink);
}

.app-nav button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.app-main {
  flex: 1;
  padding: 2rem 1.5rem 3rem;
  max-width: var(--measure-wide);
  margin: 0 auto;
  width: 100%;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel h2 {
  font-size: 1.45rem;
  margin: 0 0 0.35rem;
}

.panel-intro {
  color: var(--ink-muted);
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
  max-width: 40ch;
}

/* History — simple rows, not cards */
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}

.history-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  background: none;
}

.history-item:hover h3 {
  color: var(--accent);
}

.history-item h3 {
  margin: 0 0 0.2rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  transition: color 0.12s;
}

.history-meta {
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.history-arrow {
  color: var(--ink-faint);
  font-size: 0.9rem;
  flex-shrink: 0;
}

.empty-state {
  padding: 3rem 0;
  color: var(--ink-muted);
  font-size: 0.95rem;
  border-top: 1px solid var(--line);
}

/* New TLDR form */
.new-tldr-form {
  max-width: var(--measure);
}

.new-tldr-form .actions {
  margin-top: 0.5rem;
}

/* Settings — plain form sections */
.settings-form {
  max-width: var(--measure);
}

.settings-form fieldset {
  border: none;
  border-top: 1px solid var(--line);
  padding: 1.25rem 0;
  margin: 0 0 0.5rem;
}

.settings-form legend {
  padding: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  float: left;
  width: 100%;
}

.settings-form fieldset::after {
  content: "";
  display: table;
  clear: both;
}

.radio-group {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.toggle-label {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.45;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

.settings-form h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

#loading {
  color: var(--ink-muted);
  font-size: 0.95rem;
}

/* ——— Reader overlay (calm reading surface) ——— */
.reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2c2a28;
  color: #f7f4ee;
}

.reader-overlay.dyslexia {
  letter-spacing: 0.04em;
  word-spacing: 0.12em;
}

.reader {
  display: flex;
  flex-direction: column;
  width: min(92vw, 44rem);
  height: min(92vh, 40rem);
  padding: 1.5rem 1.75rem 1.75rem;
}

.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.reader-brand {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: #c4bbb0;
}

.reader-close {
  background: none;
  border: 1px solid #5c5854;
  color: #f7f4ee;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
}

.reader-close:hover {
  border-color: #8a847c;
  background: rgba(255, 255, 255, 0.05);
}

.reader-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.25rem;
  min-height: 0;
}

.reader-progress {
  color: #8a847c;
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.reader-text-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow-y: auto;
}

.reader-text {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(1.35rem, 4vw, 2rem);
  line-height: 1.55;
  max-width: 100%;
}

.reader-text.long {
  font-size: clamp(1.15rem, 3.2vw, 1.65rem);
}

.reader-status {
  color: #8a847c;
  margin: 0;
  font-size: 0.85rem;
}

.reader-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  padding-top: 1rem;
}

.reader-footer .btn-primary {
  background: #f7f4ee;
  color: #2c2a28;
  border-color: #f7f4ee;
}

.reader-footer .btn-primary:hover {
  background: #efeae0;
  border-color: #efeae0;
  color: #2c2a28;
}

.reader-footer .btn-secondary {
  color: #f7f4ee;
  border-color: #5c5854;
}

.reader-footer .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f7f4ee;
}

.reader-footer .btn {
  min-width: 7rem;
}

.reader-overlay .word-active {
  background: rgba(247, 244, 238, 0.15);
  border-radius: 2px;
}

.reader-overlay strong {
  font-weight: 700;
}
