/* =========================================
   MY ALBUM JOURNAL
   Visual design and responsive layout
   ========================================= */

:root {
  --background: #f7f4ee;
  --surface: #fffdf9;
  --text: #25251f;
  --muted: #77766e;
  --border: #e4e0d7;
  --accent: #bd5438;
  --accent-light: #f0e2d9;
  --dark: #292a24;
  --radius: 12px;
  --page-width: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

body,
input,
textarea,
select,
button {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font-size: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

.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;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px max(5%, calc((100% - var(--page-width)) / 2));
  background: rgba(247, 244, 238, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 21px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-actions > a {
  font-size: 13px;
  font-weight: 600;
}

.header-actions > a:hover {
  color: var(--accent);
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 650;
  font-size: 13px;
  line-height: 1.3;
  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-dark {
  background: var(--dark);
  color: white;
}

.button-dark:hover {
  background: var(--accent);
}

.button-light {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.button-light:hover {
  background: var(--surface);
  border-color: var(--text);
}

/* Hero */

main {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 28px;
}

.hero {
  padding: 100px 0 90px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.2px;
  line-height: 1.5;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(54px, 8vw, 96px);
  font-weight: 400;
  letter-spacing: -5px;
  line-height: 0.98;
}

.hero-description {
  max-width: 420px;
  margin: 25px 0 27px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.hero .button {
  min-height: 48px;
  padding: 14px 21px;
}

/* Section headings */

.stats-section,
.journal-section {
  padding: 64px 0;
  border-bottom: 1px solid var(--border);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
}

.section-heading h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 400;
  letter-spacing: -1.3px;
  line-height: 1.2;
}

.section-description {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* Statistics */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  min-width: 0;
  padding: 23px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 4vw, 40px);
  font-weight: 400;
  line-height: 1.25;
}

#stat-top {
  font-size: clamp(18px, 2.8vw, 27px);
}

/* Journal toolbar */

.journal-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 25px;
}

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

.journal-toolbar input,
.journal-toolbar select {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
}

.journal-toolbar select {
  min-width: 175px;
}

/* Album cards */

.album-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 28px 20px;
}

.album-card {
  min-width: 0;
}

.album-artwork {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  background: #e8e1d5;
  border-radius: 5px;
}

.album-artwork img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 250ms ease;
}

.album-card:hover .album-artwork img {
  transform: scale(1.035);
}

.artwork-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 15px;
  color: #777064;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
}

.album-rating {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 9px;
  background: rgba(255, 253, 249, 0.95);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}

.album-card h3 {
  margin: 13px 0 3px;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.album-artist {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.album-year {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.album-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.genre-tag {
  padding: 4px 8px;
  background: var(--accent-light);
  color: #81422f;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.4;
}

.album-notes {
  margin: 12px 0 0;
  color: #4f4e47;
  font-size: 13px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.favourite-tracks {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.favourite-tracks p {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.favourite-tracks ul {
  margin: 0;
  padding-left: 17px;
  font-size: 12px;
}

.album-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.text-button {
  padding: 6px 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover {
  color: var(--accent);
}

/* Status and empty states */

.status-message {
  padding: 20px 0;
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 50px 25px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 400;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* Login and review editor */

.form-panel {
  max-width: 720px;
  margin: 55px auto;
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.form-panel form > label,
.form-panel form > fieldset > legend {
  display: block;
  margin: 20px 0 7px;
  font-size: 13px;
  font-weight: 750;
}

.form-panel input:not([type="checkbox"]):not([type="hidden"]),
.form-panel textarea,
.form-panel select {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

.form-panel textarea {
  resize: vertical;
  line-height: 1.65;
}

.form-panel input::placeholder,
.form-panel textarea::placeholder {
  color: #a19e95;
}

.form-panel form > button {
  margin-top: 20px;
  margin-right: 8px;
}

.search-row {
  display: flex;
  gap: 10px;
}

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

.search-row button {
  flex-shrink: 0;
}

.lookup-results {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.lookup-result {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.lookup-result img,
.lookup-artwork-placeholder {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: cover;
  background: #eee8dc;
  border-radius: 4px;
}

.lookup-artwork-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.lookup-result-info {
  flex: 1;
  min-width: 0;
}

.lookup-result-info strong,
.lookup-result-info span {
  display: block;
  overflow-wrap: anywhere;
}

.lookup-result-info strong {
  font-size: 13px;
}

.lookup-result-info span {
  color: var(--muted);
  font-size: 12px;
}

.lookup-result .button {
  flex-shrink: 0;
}

.selected-album {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 25px 0;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.selected-album img,
.selected-artwork-placeholder {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  object-fit: cover;
  background: #eee8dc;
  border-radius: 5px;
}

.selected-artwork-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.selected-album h3 {
  margin: 0;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.selected-album p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-panel fieldset {
  margin: 25px 0;
  padding: 0;
  border: 0;
}

#track-options {
  display: grid;
  gap: 5px;
  margin-top: 12px;
}

.track-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
}

.track-option input {
  width: 17px;
  height: 17px;
  margin-top: 3px;
  accent-color: var(--accent);
}

.track-option span {
  overflow-wrap: anywhere;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#login-message,
#editor-message {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

#login-message.error,
#editor-message.error {
  color: #b42318;
}

#login-message.success,
#editor-message.success {
  color: #237449;
}

/* Footer */

.site-footer {
  padding: 30px 20px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

/* Tablet */

@media (max-width: 900px) {
  .album-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 25px 16px;
  }

  .hero {
    padding: 80px 0 70px;
  }
}

/* Mobile */

@media (max-width: 600px) {
  .site-header {
    padding: 12px 16px;
    gap: 10px;
  }

  .brand {
    gap: 7px;
    font-size: 13px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    font-size: 18px;
  }

  .header-actions {
    gap: 12px;
  }

  .header-actions > a {
    display: none;
  }

  .header-actions .button {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 11px;
  }

  main {
    padding: 0 18px;
  }

  .hero {
    padding: 68px 0 60px;
  }

  .hero h1 {
    font-size: clamp(49px, 13vw, 70px);
    letter-spacing: -2.5px;
  }

  .hero-description {
    max-width: 330px;
    font-size: 15px;
  }

  .stats-section,
  .journal-section {
    padding: 45px 0;
  }

  .section-heading {
    align-items: flex-start;
    gap: 12px;
  }

  .section-heading h2 {
    font-size: 31px;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat-card {
    padding: 12px 10px;
  }

  .stat-card p {
    min-height: 32px;
    margin-bottom: 7px;
    font-size: 10px;
    line-height: 1.5;
  }

  .stat-card strong {
    font-size: 25px;
  }

  #stat-top {
    font-size: 16px;
  }

  .journal-toolbar {
    flex-direction: column;
  }

  .journal-toolbar select {
    min-width: 0;
  }

  .album-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 23px 12px;
  }

  .album-card h3 {
    margin-top: 9px;
    font-size: 13px;
  }

  .album-artist {
    font-size: 12px;
  }

  .album-rating {
    top: 7px;
    right: 7px;
    padding: 4px 7px;
    font-size: 11px;
  }

  .album-genres {
    gap: 4px;
  }

  .genre-tag {
    padding: 3px 6px;
    font-size: 9px;
  }

  .section-heading > .button {
    padding: 9px 10px;
    font-size: 11px;
  }

  .form-panel {
    margin: 35px auto;
    padding: 20px 15px;
  }

  .search-row {
    flex-direction: column;
  }

  .search-row .button {
    width: 100%;
  }

  .lookup-result {
    align-items: flex-start;
    gap: 10px;
  }

  .lookup-result img,
  .lookup-artwork-placeholder {
    width: 52px;
    height: 52px;
  }

  .lookup-result .button {
    min-height: 36px;
    padding: 8px;
    font-size: 11px;
  }

  .selected-album img,
  .selected-artwork-placeholder {
    width: 78px;
    height: 78px;
  }
}

/* Respect reduced-motion preferences */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
