/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */

@font-face {
  font-family: "stitch-font";
  src: url(/assets/HovdenStitch-Regular.otf);
}

:root {
  --primary-background: #faf7f2;
  --secondary-background: #2d4a3e;
  --accent: #b8714e;
  --accent-hover: #9d5e3d;
  --cool-tan: #c4a882;
  --text-primary: #1c1c1c;
  --text-muted: #6b7280;
  --border: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  background-color: var(--secondary-background);
  margin: 0;
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a, a:focus, a:active {
  text-decoration: none;
  color: inherit;
}

a:hover {
  color: var(--secondary-background);
}

button, .button {
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: .45rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
  letter-spacing: 0.01em;
  margin-bottom: .5rem;
}

button:hover, .button:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.content-cushion {
  padding-left: .75rem;
  padding-right: .75rem;
}

.flex-container {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
}

.header {
  padding: .85rem 1.5rem;
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.footer {
  margin-top: auto;
  padding: .75rem 1.5rem;
  box-shadow: 0 -1px 0 var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  width: calc(100% - 3rem);
}

.text-input {
  outline: none;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--radius-sm);
  padding: .4rem .75rem;
  font-size: 0.875rem;
  background: white;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input:focus {
  border-color: var(--secondary-background);
  box-shadow: 0 0 0 3px rgba(45,74,62,0.12);
}

.stitch-font {
  font-family: "stitch-font";
}

.container {
  padding: .5rem;
}

.bg-primary {
  background-color: var(--primary-background);
}

.welcome {
  font-size: 1.75rem;
  font-weight: 600;
}

.quote {
  font-size: 1.95rem;
  text-align: center;
  color: var(--text-primary);
  font-style: italic;
  line-height: 1.8;
  margin: .25rem 0 1rem 0;
}

.quote-display {
  display: flex;
  flex-direction: column;
}

.quote-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}

.recipes {
  display: flex;
  padding: .75rem;
  padding-top: 1rem;
  gap: 1rem;
}

.recipe-choices {
  min-width: 200px;
  max-width: 240px;
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.recipe-choices-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .5rem;
}

.recipe-list {
  list-style-type: none;
  padding-left: .25rem;
  margin: 0;
}

.recipe-list li {
  padding: .3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.recipe-list li:last-child {
  border-bottom: none;
}

.buttons-container {
  display: flex;
  gap: .35rem;
  margin-top: .25rem;
  padding: .25rem 0;
  flex-wrap: wrap;
}

.all-buttons-container {
  display: flex;
  gap: .35rem;
  margin-top: .25rem;
  padding: .25rem 0;
}

.all-buttons-container .buttons-container {
  max-width: fit-content;
}

.quote-card {
  flex-grow: 1;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: fit-content;
}

.quote-card h1 {
  margin: 0 0 .5rem 0;
  font-size: 1.4rem;
}

.recipe-display {
  padding: 1.25rem;
  border-radius: var(--radius);
  max-height: 500px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.recipe-info {
  flex: auto;
  display: flex;
  align-items: center;
  margin: 0;
  flex-wrap: wrap;
  gap: .25rem;
}

.recipe-info h1 {
  padding-top: 0;
  margin: 0;
  font-size: 1.5rem;
}

.recipe-info span {
  padding: .25rem .6rem;
  background: rgba(0,0,0,0.05);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.recipe {
  flex: auto;
  display: flex;
  max-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
}

.recipe-ingredients {
  padding: .5rem;
  width: 30%;
  margin-right: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.ingredient-list {
  padding-left: .25rem;
}

.ingredient {
  display: flex;
  justify-content: space-between;
  padding: .3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.ingredient:last-child {
  border-bottom: none;
}

.ingredient-name, .ingredient-measurement {
  width: 50%;
}

.ingredient-measurement {
  text-align: end;
  color: var(--text-muted);
}

.recipe-steps {
  overflow-y: auto;
  overflow-x: hidden;
  max-width: 70%;
  border-left: 2px solid rgba(45,74,62,0.15);
  padding-left: 1.25rem;
}

.step-list-box {
  padding-left: 0;
}

.step-box {
  margin: .75rem 1rem;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  font-size: 0.925rem;
  line-height: 1.7;
}

.comments-container {
  flex-grow: 1;
}

.comments {
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.log-in {
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.images {
  justify-self: end;
}

.form {
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.input-field {
  margin: .5rem 0;
}

.search-output {
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden;
}

.quote-form {
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.quote-buttons {
  margin-top: .75rem;
  text-align: end;
}

.file-upload {
  margin-bottom: .5rem;
}

/* ── Form page layout ── */

.form-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem .75rem;
}

.form-page-header {
  margin-bottom: 1.25rem;
}

.form-page-header h2 {
  margin: 0 0 .2rem 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--primary-background);
}

.form-page-header p {
  margin: 0;
  color: rgba(250,247,242,0.65);
  font-size: 0.9rem;
}

.form-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.form-section:has(+ .form-submit) {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section-title {
  margin: 0 0 1rem 0;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.form-hint {
  margin: -.5rem 0 1rem 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem 1.5rem;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin: 0;
}

.input-field label {
  font-size: 0.85rem;
  font-weight: 500;
}

.text-input {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 0.9rem;
}

.search-form {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.search-input {
  width: auto;
}

select.text-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2rem;
  cursor: pointer;
}

.ingredient-list-header {
  display: flex;
  gap: .5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: .4rem;
  padding: 0 .1rem;
}

.ingredient-list-header span:first-child { flex: 1; }
.ingredient-list-header span:nth-child(2) { width: 100px; }
.ingredient-list-header span:nth-child(3) { width: 120px; }

.ingredient-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: .5rem;
}

.ingredient-row .text-input { flex: 1; }

.ingredient-amount {
  width: 100px;
  flex: 0 0 100px !important;
}

.ingredient-unit {
  width: 120px;
  flex: 0 0 120px !important;
}

.steps-list {
  padding-left: 1.5rem;
  margin: 0 0 1rem 0;
}

.steps-list li {
  margin-bottom: .75rem;
}

.step-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
  font-size: 0.9rem;
}

.form-actions-row {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.button-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.button-ghost:hover {
  background: rgba(0,0,0,0.04);
  color: var(--text-primary);
  transform: none;
}

.file-upload-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.file-upload {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: 0;
}

.file-upload label {
  font-size: 0.85rem;
  font-weight: 500;
}

.form-submit {
  display: flex;
  justify-content: flex-end;
  padding-top: 1rem;
  margin-top: 1.75rem;
}

.button-lg {
  padding: .65rem 2.5rem;
  font-size: 1rem;
}

.flash-message {
  background: #fef3cd;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

/* ── Recipe show page ── */

.recipe-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem .75rem;
}

.recipe-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  gap: 1rem;
}

.recipe-page-header h2 {
  margin: 0 0 .6rem 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--primary-background);
}

.recipe-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.recipe-meta-tag {
  background: rgba(250,247,242,0.15);
  color: rgba(250,247,242,0.85);
  padding: .2rem .65rem;
  border-radius: 20px;
  font-size: 0.8rem;
}

.recipe-page-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.recipe-columns {
  display: flex;
  min-height: 250px;
}

.recipe-ingredients-col {
  width: 35%;
  padding-right: 1.5rem;
  border-right: 2px solid var(--border);
  flex-shrink: 0;
}

.recipe-steps-col {
  flex: 1;
  padding-left: 1.5rem;
}

.recipe-steps-list {
  padding-left: 1.25rem;
  margin: 0;
}

.recipe-steps-list li {
  margin-bottom: 1rem;
  line-height: 1.7;
  font-size: 0.925rem;
}

.recipe-photos-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.recipe-photos-row img {
  border-radius: var(--radius-sm);
  max-height: 200px;
}

.recipe-photo-item {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

/* ── Home page ── */

.home-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .75rem;
}

.home-list-header .form-section-title {
  margin: 0;
}

.recipe-list-home {
  margin-top: .75rem;
}

/* ── Search / All page ── */

.search-results {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.search-results-subheader {
  margin-top: 1.25rem;
}

/* ── Comments ── */

.comment-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem 0;
}

.comment-item {
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-user {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: .2rem;
}

.comment-body {
  margin: 0;
  font-size: 0.9rem;
}

.comment-form {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: .5rem;
}

.comment-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 70px;
  resize: vertical;
  font-family: inherit;
  font-size: 0.9rem;
  margin-bottom: .5rem;
}

.comment-submit {
  display: flex;
  justify-content: flex-end;
}

/* ── Mobile responsiveness ── */

@media (max-width: 640px) {
  /* Header: stack title above search form */
  .header {
    flex-direction: column;
    align-items: stretch;
    gap: .6rem;
    padding: .75rem 1rem;
  }

  .header h1 {
    font-size: 1.2rem;
  }

  .search-form {
    width: 100%;
  }

  .search-input {
    flex: 1;
    min-width: 0;
  }

  /* Footer: stack on narrow screens */
  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: .25rem;
    width: calc(100% - 2rem);
    padding: .75rem 1rem;
  }

  /* Page containers: tighter padding */
  .recipe-page {
    padding: 1rem .5rem;
  }

  .form-page {
    padding: 1rem .5rem;
  }

  /* Recipe/search page header: stack title and button/form */
  .recipe-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .recipe-page-header h2 {
    font-size: 1.4rem;
  }

  /* Show page: stack ingredients and steps vertically */
  .recipe-columns {
    flex-direction: column;
    min-height: unset;
  }

  .recipe-ingredients-col {
    width: 100%;
    padding-right: 0;
    border-right: none;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid var(--border);
  }

  .recipe-steps-col {
    padding-left: 0;
  }

  /* Quote: smaller on mobile */
  .quote {
    font-size: 1.3rem;
  }

  /* New/edit form: single column */
  .form-grid {
    grid-template-columns: 1fr;
  }

  /* Ingredient rows: name takes full width, amount+unit share next row */
  .ingredient-list-header {
    display: none;
  }

  .ingredient-row {
    flex-wrap: wrap;
    padding-top: .75rem;
    padding-bottom: 1rem;
    margin-bottom: .5rem;
    border-bottom: 1px solid var(--border);
  }

  .ingredient-row:first-of-type {
    padding-top: 0;
  }

  .ingredient-row:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
  }

  .ingredient-row > input[type="text"] {
    flex: 1 1 100%;
  }

  .ingredient-amount {
    flex: 1 1 auto !important;
    width: auto;
  }

  .ingredient-unit {
    flex: 2 1 auto !important;
    width: auto;
  }
}
