/* Dishbook — layout, recipe cards, and responsive rules (stylingGuide.md) */

:root {
  --bg-page: #f9f8f4;
  --bg-card: #ffffff;
  --text: #1f1f1f;
  --text-muted: #5c5c5c;
  --accent: #c4473a;
  --accent-hover: #a3392e;
  --border: #e0ddd4;
  --shadow: rgba(31, 31, 31, 0.06);
  --max-width: 700px;
  --space-section: 1.75rem;
  --space-card: 1rem;
  --radius-card: 6px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg-page);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-hover);
}

/* Centered page column: header + main share max width */
body > header,
body > main {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

body > header {
  padding-top: 1.25rem;
  padding-bottom: var(--space-section);
}

body > main {
  flex: 1;
  padding-bottom: 2.5rem;
}

/* Heading hierarchy */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  margin: var(--space-section) 0 0.6rem;
}

main > h1:first-child,
main > h2:first-child {
  margin-top: 0;
}

h2 a {
  color: inherit;
  text-decoration: none;
}

h2 a:hover {
  color: var(--accent);
  text-decoration: underline;
}

p {
  margin: 0 0 0.75rem;
}

/* ---- Header / nav (shared_header) ---- */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.top a {
  font-weight: 600;
}

.top > div:first-child a {
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--text);
  letter-spacing: 0.02em;
}

.top > div:first-child a:hover {
  color: var(--accent);
}

.nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  font-weight: 600;
  text-decoration: none;
}

.nav a:hover {
  text-decoration: underline;
}

header h1 {
  margin-top: 1rem;
}

header > p {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
}

/* ---- Recipe cards (home, search, profile) ---- */
.recipes,
.recipes-list,
.cards-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-card);
}

.recipe-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1rem 1.15rem;
  box-shadow: 0 1px 3px var(--shadow);
}

.recipe-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.recipe-card p {
  margin: 0 0 0.65rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.recipe-card img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0 0 0.65rem;
}

.recipe-card ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
}

.recipe-card li {
  margin-bottom: 0.2rem;
}

/* ---- Search ---- */
.search-block {
  margin-bottom: var(--space-section);
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 3px var(--shadow);
}

.search-block form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.search-block label {
  display: block;
  width: 100%;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.search-block input[type="search"] {
  flex: 1 1 12rem;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
}

.search-block button {
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.search-block button:hover {
  background: var(--accent-hover);
}

/* ---- Profile ---- */
.profile-intro {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: var(--space-section);
}

.profile-intro img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
}

.profile-intro > div:last-child p:last-child {
  margin-bottom: 0;
}

/* ---- Login ---- */
.login-form {
  max-width: 22rem;
  padding: 1rem 0;
}

.login-form label {
  font-weight: 600;
}

.login-form input {
  width: 100%;
  max-width: 100%;
  margin-top: 0.25rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
}

.login-form button {
  margin-top: 0.5rem;
  padding: 0.5rem 1.1rem;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.login-form button:hover {
  background: var(--accent-hover);
}

/* ---- Recipe detail ---- */
.recipe-byline {
  margin-bottom: 0.85rem;
}

.recipe-tags .tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
}

.recipe-tags .tag-list li {
  padding: 0.2rem 0.55rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.85rem;
}

.recipe-tags h2 {
  margin-top: 0;
}

figure.recipe-photo {
  margin: 0 0 var(--space-section);
}

figure.recipe-photo img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
}

.recipe-description {
  margin: 0;
}

.recipe-description p {
  margin: 0 0 0.75rem;
}

.recipe-description p:last-child {
  margin-bottom: 0;
}

.recipe-info {
  margin: var(--space-section) 0;
  padding: 1rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 3px var(--shadow);
}

.recipe-info > h2 {
  margin-top: 0;
  margin-bottom: 0.65rem;
}

.recipe-info p {
  margin: 0 0 0.4rem;
}

.recipe-info p:last-child {
  margin-bottom: 0;
}

.recipe-columns {
  display: flex;
  flex-direction: column;
  gap: var(--space-section);
  margin-top: var(--space-section);
}

.recipe-columns > div {
  min-width: 0;
}

.recipe-columns ul,
.recipe-columns ol {
  margin: 0;
  padding-left: 1.25rem;
}

.recipe-columns li {
  margin-bottom: 0.35rem;
}

.recipe-columns h2 {
  margin-top: 0;
}

@media (min-width: 640px) {
  h1 {
    font-size: 2rem;
  }

  .profile-intro {
    flex-direction: row;
    align-items: flex-start;
  }

  .profile-intro > div:first-child {
    flex: 0 0 140px;
  }

  .profile-intro > div:last-child {
    flex: 1;
    min-width: 0;
  }

  .recipe-columns {
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
  }

  .recipe-columns > div {
    flex: 1;
  }
}

/* ---- Comments (recipe detail) ---- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.comment-section {
  margin-top: var(--space-section);
  padding-top: var(--space-section);
}

.comment-section-heading {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.comment-section-divider {
  height: 0;
  margin: 0 0 1rem;
  border: 0;
  border-top: 1px solid var(--border);
}

.comment-composer-form {
  margin-bottom: 1.25rem;
}

.comment-composer {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.comment-composer--guest {
  align-items: center;
  margin-bottom: 1.25rem;
}

.comment-avatar {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  background: #2c5282;
  border-radius: 10px;
}

.comment-avatar--guest {
  background: var(--text-muted);
}

.comment-avatar--small {
  width: 2rem;
  height: 2rem;
  font-size: 0.95rem;
  border-radius: 8px;
}

.comment-composer-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.comment-composer-input {
  width: 100%;
  margin: 0;
  padding: 0.65rem 1rem;
  font: inherit;
  line-height: 1.4;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  resize: vertical;
  min-height: 2.75rem;
  background: var(--bg-card);
}

.comment-composer-input::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.comment-composer-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.comment-composer-footer {
  display: flex;
  justify-content: flex-end;
}

.comment-composer-submit {
  padding: 0.4rem 1rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.comment-composer-submit:hover {
  background: var(--accent-hover);
}

.comment-composer-guest-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comment-list-empty {
  margin: 0;
  padding: 0.75rem 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.comment-card {
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 1px 3px var(--shadow);
}

.comment-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.comment-card-author {
  font-weight: 600;
  font-size: 0.95rem;
}

.comment-card-time {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.comment-card-body {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  word-break: break-word;
}

.comment-card-body--deleted {
  color: var(--text-muted);
  font-style: italic;
}

.comment-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
  margin-top: 0.75rem;
}

.comment-text-button {
  padding: 0;
  font: inherit;
  font-size: 0.88rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
}

.comment-text-button:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.comment-text-button--danger {
  color: #b83280;
}

.comment-text-button--danger:hover {
  color: #97266d;
}

.comment-children {
  margin-top: 0.75rem;
}

.comment-list--nested {
  margin-left: 1.25rem;
}

.comment-item {
  list-style: none;
}

.comment-reply-target {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.comment-edit-textarea {
  width: 100%;
  margin: 0;
  padding: 0.65rem 0.85rem;
  font: inherit;
  line-height: 1.4;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  resize: vertical;
  min-height: 5rem;
  background: #fff;
}

.comment-edit-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.65rem;
  justify-content: flex-end;
}

.comment-save-button {
  padding: 0.4rem 1rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.comment-save-button:hover {
  background: var(--accent-hover);
}

.comment-item.is-editing .comment-card {
  border-color: var(--accent);
}

.is-hidden {
  display: none !important;
}
