@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Inter:wght@400;500;600&family=Space+Mono:wght@400;700&display=swap');

:root {
  --color-bg: #fdf6e9;
  --color-surface: #ffffff;
  --color-ink: #111111;
  --color-muted: #6b6252;
  --color-primary: #ff5a36;
  --color-primary-ink: #111111;
  --color-secondary: #ffd23f;
  --color-accent: #2f6fed;
  --color-accent-ink: #ffffff;
  --color-danger: #e5484d;
  --color-border: #111111;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  --border-width: 3px;
  --shadow-offset: 4px;
  --shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--color-border);
  --shadow-sm: 2px 2px 0 var(--color-border);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1rem 4rem;
  color: var(--color-ink);
  background: var(--color-bg);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

/* ---------- header / wordmark ---------- */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 1rem;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  transform: rotate(-1deg);
  display: inline-block;
}

.tagline {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 0.15rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 0 1.5rem;
  border-bottom: var(--border-width) solid var(--color-border);
  margin-bottom: 1.5rem;
}

#loggedOut {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

#loggedIn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

#whoAmI {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}

#streakInfo {
  color: var(--color-muted);
}

/* ---------- form controls ---------- */

input,
textarea,
select {
  font: inherit;
  font-family: var(--font-body);
  padding: 0.6rem 0.75rem;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

textarea {
  display: block;
  width: 100%;
  min-height: 5rem;
  margin: 0.6rem 0;
  resize: vertical;
}

button {
  font: inherit;
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  padding: 0.55rem 1.1rem;
  background: var(--color-primary);
  color: var(--color-primary-ink);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--color-border);
}

button:active {
  transform: translate(var(--shadow-offset), var(--shadow-offset));
  box-shadow: 0 0 0 var(--color-border);
}

@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
  button:hover,
  button:active {
    transform: none;
  }
}

label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
}

.dev-link {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  word-break: break-all;
  margin-top: 0.5rem;
}

.dev-link a {
  color: var(--color-accent);
}

.error {
  color: var(--color-danger);
  font-weight: 600;
  font-size: 0.85rem;
}

/* ---------- composer ---------- */

#composer {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 2rem;
}

#composer h2 {
  margin-bottom: 0.75rem;
}

#composer select {
  margin-bottom: 0.4rem;
}

#composer > label {
  display: flex;
  margin: 0.5rem 0 0.9rem;
}

/* ---------- feed ---------- */

#feed h2 {
  margin-bottom: 1rem;
}

.post {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.post:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow);
}

.post strong {
  font-family: var(--font-mono);
  font-weight: 700;
}

.post p {
  margin: 0.5rem 0;
}

.post .meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-muted);
  display: flex;
  gap: 0.9rem;
  align-items: center;
  margin-top: 0.6rem;
}

/* post-kind / critique badges */

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border: 2px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
}

.badge--free { background: var(--color-surface); }
.badge--prompt_response { background: var(--color-accent); color: var(--color-accent-ink); border-color: var(--color-ink); }
.badge--horror_story { background: var(--color-primary); color: var(--color-primary-ink); }
.badge--critique { background: var(--color-secondary); color: var(--color-ink); }

.critique {
  border-left: var(--border-width) solid var(--color-secondary);
  padding-left: 0.75rem;
  margin: 0.6rem 0;
  font-size: 0.9rem;
}

#postDetail {
  background: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

#closeDetailBtn {
  background: var(--color-surface);
  margin-bottom: 1rem;
}

@media (max-width: 480px) {
  body {
    margin: 1rem auto;
  }
  .masthead {
    flex-direction: column;
    align-items: flex-start;
  }
}
