/* =========================================
   Variables
   ========================================= */
:root {
  /* Colors */
  --color-bg: #f5f1e8; /* warm beige background */
  --color-surface: #fdfbf7; /* soft cream surface */
  --color-surface-alt: #ffffff; /* paper white */

  --color-text: #1f2733; /* deep readable text */
  --color-text-muted: #5b6472;
  --color-primary: #1b2a4a; /* deep navy */
  --color-primary-soft: #253659;
  --color-accent: #7f2532; /* muted burgundy */

  --color-success: #2f7d4a;
  --color-warning: #b6862a;
  --color-danger: #b1343b;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2933;
  --gray-900: #111827;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Georgia", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --font-display: "Playfair Display", "Georgia", "Times New Roman", serif;

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-base: 1rem;    /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.25rem;   /* 20px */
  --font-size-2xl: 1.5rem;   /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem;  /* 36px */

  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* Spacing scale (0–96px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Shadows (subtle, editorial) */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.18);

  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-normal: 220ms ease-out;
  --transition-slow: 320ms ease-out;
}

/* =========================================
   Reset / Normalize
   ========================================= */
*, *::before, *::after {
  box-sizing: border-box;
}

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  vertical-align: baseline;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  line-height: 1;
}

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}

ol,
ul {
  list-style: none;
}

blockquote,
q {
  quotes: none;
}

blockquote::before,
blockquote::after,
q::before,
q::after {
  content: '';
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
  max-width: 100%;
  height: auto;
}

img,
svg {
  vertical-align: middle;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* =========================================
   Base Styles
   ========================================= */
body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: var(--color-text);
  background: radial-gradient(circle at top left, #fdfbf7 0, #f5f1e8 40%, #f0e8dc 100%);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main {
  display: block;
}

p {
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

p + p {
  margin-top: calc(var(--space-2) * -1);
}

small {
  font-size: var(--font-size-sm);
}

strong,
b {
  font-weight: 600;
}

em,
i {
  font-style: italic;
}

/* Headings - editorial, spacious */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--color-primary);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-3);
}

h1 {
  font-size: clamp(2.25rem, 3vw, 3rem);
  letter-spacing: 0.02em;
}

h2 {
  font-size: clamp(1.875rem, 2.4vw, 2.25rem);
}

h3 {
  font-size: clamp(1.5rem, 1.8vw, 1.875rem);
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h6 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1 + p,
h2 + p,
h3 + p {
  color: var(--color-text-muted);
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  text-underline-offset: 0.18em;
  transition: color var(--transition-normal), text-decoration-color var(--transition-normal);
}

a:hover,
a:focus-visible {
  color: var(--color-accent);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid transparent;
}

/* Lists */
ul.list,
ol.list {
  margin-left: var(--space-6);
  margin-bottom: var(--space-4);
  list-style: disc;
}

ol.list {
  list-style: decimal;
}

/* Code */
code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

pre {
  overflow-x: auto;
}

/* =========================================
   Accessibility & Motion
   ========================================= */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

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

/* =========================================
   Utilities
   ========================================= */
/* Container */
.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--space-4);
  max-width: 1120px;
}

@media (min-width: 1280px) {
  .container {
    max-width: 1200px;
  }
}

/* Flex utilities */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-col {
  flex-direction: column;
}

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

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

/* Grid utilities */
.grid {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-gap-4 {
  gap: var(--space-4);
}

.grid-gap-6 {
  gap: var(--space-6);
}

/* Centering */
.centered {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Spacing helpers */
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.py-4 { padding-block: var(--space-4); }
.py-6 { padding-block: var(--space-6); }
.px-4 { padding-inline: var(--space-4); }

/* Text alignment */
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

/* =========================================
   Components
   ========================================= */
/* Buttons */
.button,
button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-size: var(--font-size-sm);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-soft) 100%);
  color: #ffffff!important;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-normal), color var(--transition-normal), box-shadow var(--transition-normal), transform var(--transition-fast), border-color var(--transition-normal);
}

.button:hover,
button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  background: linear-gradient(135deg, var(--color-accent) 0%, #5f1c26 100%);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.button:active,
button:active,
input[type="button"]:active,
input[type="submit"]:active,
input[type="reset"]:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.button--secondary {
  background: #fff!important;
  color: var(--color-primary)!important;
  border-color: rgba(27, 42, 74, 0.28);
  box-shadow: none;
}

.button--secondary:hover {
  border-color: rgba(27, 42, 74, 0.45);
}

.button--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-primary)!important;
  box-shadow: none;
}

.button--ghost:hover {
  background: rgba(0, 0, 0, 0.02);
}

.button[disabled],
button[disabled],
input[type="button"][disabled],
input[type="submit"][disabled],
input[type="reset"][disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.button:focus-visible,
button:focus-visible,
input[type="button"]:focus-visible,
input[type="submit"]:focus-visible,
input[type="reset"]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* Form inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(15, 23, 42, 0.12);
  background-color: var(--color-surface-alt);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), background-color var(--transition-normal);
}

input::placeholder,
textarea::placeholder {
  color: var(--gray-400);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: rgba(127, 37, 50, 0.7);
  box-shadow: 0 0 0 1px rgba(127, 37, 50, 0.4);
}

input[disabled],
select[disabled],
textarea[disabled] {
  background-color: var(--gray-100);
  cursor: not-allowed;
  color: var(--gray-500);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

label {
  display: inline-block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

/* Cards - for book tiles, editorial blocks */
.card {
  background-color: var(--color-surface-alt);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(15, 23, 42, 0.04);
}

.card--muted {
  background: linear-gradient(135deg, #fdfbf7 0%, #f5f1e8 50%, #efe3d3 100%);
}

.card-header {
  margin-bottom: var(--space-4);
}

.card-title {
  font-family: var(--font-display);
  margin-bottom: var(--space-2);
}

.card-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.card-body {
  font-size: var(--font-size-sm);
}

/* Image frame for book cover / editorial imagery */
.image-frame {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background-color: #000000;
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Tags / Pills (e.g., genres, formats) */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background-color: #f1ebe1;
  color: var(--color-text-muted);
}

.tag--primary {
  background-color: rgba(27, 42, 74, 0.08);
  color: var(--color-primary);
}

.tag--accent {
  background-color: rgba(127, 37, 50, 0.08);
  color: var(--color-accent);
}

/* Helper for subtle section dividers */
.section-divider {
  height: 1px;
  width: 100%;
  background: linear-gradient(to right, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.16), rgba(15, 23, 42, 0));
  margin-block: var(--space-6);
}

/* =========================================
   Layout accents for editorial feel
   ========================================= */
.section {
  padding-block: var(--space-10);
}

.section--alt {
  background-color: var(--color-surface);
}

.section-heading {
  margin-bottom: var(--space-6);
  text-align: left;
}

.section-heading span.label {
  display: inline-block;
  font-size: var(--font-size-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: var(--space-2);
}

