/* ============================================================================
   Typography Imports
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&display=swap');

/* ============================================================================
   Color Variables
   ============================================================================ */
:root {
  --color-header: #1b4d2e;      /* Rich dark green */
  --color-text: #000000;         /* Black */
  --color-background: #f5f1ed;   /* Eggshell gray */
  --color-border: #d4cfc9;       /* Lighter eggshell for borders */
}

/* ============================================================================
   Reset & Base Styles
   ============================================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--color-text);
  background-color: var(--color-background);
  line-height: 1.6;
  letter-spacing: 0.3px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================================
   Header & Navigation
   ============================================================================ */
header {
  background-color: var(--color-header);
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.navbar {
  padding: 1.5rem 0;
}

.navbar-container {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  row-gap: 0.75rem;
  /* No overflow clipping here: it would cut off the dropdown menus. */
}

.site-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-background);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.site-title:hover {
  opacity: 0.9;
}

.nav-menu {
  display: flex;
  align-items: center; /* Vertically center nav items */
  list-style: none;
  gap: 2rem;
  padding-left: 0;
  margin-left: auto; /* Pushes the nav menu to the right */
}

.nav-item {
  position: relative;
}

.nav-link {
  color: var(--color-background);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  transition: opacity 0.2s ease;
  display: block;
}

.nav-link:hover {
  opacity: 0.8;
}

.nav-trigger {
  border: none;
  background: none;
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--color-background);
  border: 2px solid var(--color-header);
  border-radius: 4px;
  list-style: none;
  min-width: 200px;
  max-width: calc(100vw - 2rem);
  margin-top: 0.5rem;
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
  pointer-events: none;
}

.dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-menu a {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--color-text);
  text-decoration: none;
  transition: background-color 0.2s ease;
  text-underline-offset: 0;
}

.dropdown-menu a:hover {
  background-color: var(--color-border);
  opacity: 1;
}

/* ============================================================================
   Blog Styling
   ============================================================================ */
.blog-list {
  margin-top: 3rem;
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-item {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

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

.post-title {
  font-size: 1.5rem;
  font-family: 'Lora', serif;
  color: var(--color-header);
  text-decoration: none;
  margin-bottom: 0.5rem;
  display: block;
}

.post-title:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.post-date {
  font-size: 0.95rem;
  color: #666;
  display: block;
  margin-bottom: 0.75rem;
  font-style: italic;
}

.post-excerpt {
  font-size: 1rem;
  color: #333;
  margin: 0.75rem 0 0 0;
  line-height: 1.6;
}

/* ============================================================================
   Listening & Blog List Styles
   ============================================================================ */

.post-list,
.listen-list {
  list-style: none;
  padding: 0;
}

.post-item,
.listen-item {
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  transition: box-shadow 0.2s ease;
}

.post-item:hover,
.listen-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.post-title,
.listen-title {
  color: var(--color-header);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.post-title:hover,
.listen-title:hover {
  text-decoration: underline;
}

.post-date,
.listen-date {
  display: block;
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.post-excerpt,
.listen-excerpt {
  color: #333;
  margin: 0.75rem 0;
  line-height: 1.6;
}

.listen-artist,
.listen-type {
  margin: 0.5rem 0;
  font-size: 0.95rem;
  color: #555;
}

.listen-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

.listen-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: var(--color-header);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background-color 0.2s ease;
}

.listen-link:hover {
  opacity: 0.85;
}

/* Apple Music Embed */
.listen-embed {
  margin: 1.5rem 0;
  border-radius: 10px;
  overflow: hidden;
}

.listen-embed iframe {
  display: block;
  width: 100%;
  border: none;
}

.listen-embed-small {
  margin: 1rem 0;
  border-radius: 10px;
  overflow: hidden;
}

.listen-embed-small iframe {
  display: block;
  width: 100%;
  max-height: 200px;
  border: none;
}

.listen-recommendations {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.listen-recommendations p {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.listen-recommendations ul {
  margin-left: 1.5rem;
  padding: 0;
}

.listen-recommendations li {
  margin-bottom: 0.25rem;
  color: #555;
}

.listen-subtitle {
  font-size: 0.9rem;
  color: #666;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  font-style: italic;
}

/* Mobile navigation adjustments */
@media (max-width: 768px) {
  /* Wrap the nav onto its own line rather than scrolling it sideways —
     a scroll container would clip the dropdown menus. */
  .nav-menu {
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .nav-item {
    white-space: nowrap;
  }

  /* Right-align dropdowns so they open inside the viewport. */
  .dropdown-menu {
    left: auto;
    right: 0;
    min-width: 11rem;
    max-width: calc(100vw - 2rem);
  }
}

@media (max-width: 480px) {
  .nav-menu {
    gap: 1rem;
  }

  .nav-link {
    font-size: 0.9rem;
    padding: 0.4rem 0;
  }

  .navbar-container {
    padding: 0 1rem;
  }
}

/* ============================================================================
   Headings
   ============================================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Lora', serif;
  color: var(--color-header);
  font-weight: 600;
  margin: 1.5rem 0 0.75rem 0;
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  margin-top: 0;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 1.5rem;
  color: var(--color-text);
}

h4 {
  font-size: 1.5rem;
}

h5 {
  font-size: 1.25rem;
}

h6 {
  font-size: 1.1rem;
}

/* ============================================================================
   Container Layout - Centre Third / Max-Width
   ============================================================================ */
main,
article,
.container {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
  flex: 1;
}

/* ============================================================================
   Typography Elements
   ============================================================================ */
p {
  margin-bottom: 1rem;
}

a {
  color: var(--color-header);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

a:hover {
  opacity: 0.8;
}

strong, b {
  font-weight: 600;
}

em, i {
  font-style: italic;
}

code,
pre {
  background-color: #ede9e5;
  font-family: 'Courier New', monospace;
  border-radius: 4px;
}

code {
  padding: 0.2em 0.4em;
  font-size: 0.9em;
}

pre {
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--color-border);
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

blockquote {
  border-left: 4px solid var(--color-header);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: #555;
  font-style: italic;
}

/* ============================================================================
   Lists
   ============================================================================ */
ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.5rem;
}

/* ============================================================================
   Utility Classes
   ============================================================================ */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

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

/* ============================================================================
   Link Preview Card
   ============================================================================ */
.link-preview-card {
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.2s ease-in-out;
}

.link-preview-card:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.link-preview-card .preview-link {
  text-decoration: none;
  color: var(--color-text);
  display: flex;
  flex-grow: 1;
}

.link-preview-card .preview-content {
  flex-grow: 1;
}

.link-preview-card h4 {
  font-family: 'Lora', serif;
  font-size: 1.1rem;
  color: var(--color-header);
  margin: 0;
  text-decoration: none;
}

.link-preview-card .preview-url {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
  word-break: break-all;
}

.link-preview-card {
  max-width: 100%; /* Ensure it doesn't exceed parent width */
  box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

.link-preview-card .preview-image {
  max-width: 120px; /* Set a max width for the image */
  height: auto;
  object-fit: cover;
  border-radius: 4px;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */
@media (max-width: 768px) {
  html {
    font-size: 16px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  main,
  article,
  .container {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 16px;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.375rem;
  }

  h3 {
    font-size: 1.125rem;
  }

  h4 {
    font-size: 1.125rem;
  }

  main,
  article,
  .container {
    padding: 1rem;
  }
}

/* ============================================================================
   Link Preview Cards
   ============================================================================ */

.link-preview-card {
  display: inline-block;
  width: 100%;
  max-width: 100%;
  margin: 0.75rem 0;
}

.preview-link {
  display: block;
  padding: 1rem;
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.preview-link:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--color-header);
}

.preview-content {
  display: flex;
  flex-direction: column;
}

.preview-content h4 {
  color: var(--color-header);
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
}

.preview-url {
  color: #666;
  font-size: 0.85rem;
  word-break: break-word;
  margin: 0;
  font-family: monospace;
}

/* ============================================================================
   Link Preview Card Styles
   ============================================================================ */
.link-preview-card {
  background-color: #f9f9f9;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow 0.2s ease;
}

.link-preview-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.preview-link {
  text-decoration: none;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.preview-link h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
  color: var(--color-header);
}

.preview-link .preview-url {
  font-size: 0.85rem;
  color: #666;
  word-break: break-all;
}

/* ============================================================================
   Responsive Design - Link Preview Card
   ============================================================================ */
@media (max-width: 768px) {
  .link-preview-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .link-preview-card .preview-image {
    max-width: 100%;
    height: auto;
  }

  .link-preview-card .preview-content {
    display: block;
  }

  .link-preview-card h4 {
    font-size: 1.2rem;
  }

  .link-preview-card .preview-url {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .link-preview-card {
    padding: 0.75rem;
  }

  .link-preview-card h4 {
    font-size: 1.1rem;
  }

  .link-preview-card .preview-url {
    font-size: 0.85rem;
  }
}

/* ============================================================================
   Site Logo
   ============================================================================ */
.site-title {
  display: inline-block;
  line-height: 0;
  flex-shrink: 0;
}

.site-logo {
  height: 4rem;
  width: auto;
  display: block;
}

@media (max-width: 480px) {
  .site-logo {
    height: 2.5rem;
  }
}

/* ============================================================================
   Selected Media — card grid
   ============================================================================ */

/* The grid needs more room than the 40rem reading measure. Browsers without
   :has() simply keep the default width and drop to a single column. */
main:has(.media-page) {
  max-width: 52rem;
}

/* Type pills. Everything is drawn from the site palette — the house green and
   the eggshell neutrals — so no new hues are introduced. Types are told apart
   by weight rather than hue, which also carries the meaning: the green family
   is Tom's own voice, the neutral family is other people's coverage.
   --tint is the one derived value: the house green at ~10% on white. */
.media-type {
  --tint: #e8eeea;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  white-space: nowrap;
  /* Drawn with an inset shadow rather than a border so outlined and filled
     pills stay exactly the same size. */
  box-shadow: inset 0 0 0 1px transparent;
}

/* Green family — Tom speaking */
.media-type--wrote {
  background-color: var(--color-header);
  color: var(--color-background);
}

.media-type--interview {
  background-color: transparent;
  color: var(--color-header);
  box-shadow: inset 0 0 0 1px var(--color-header);
}

.media-type--expert-comment {
  background-color: var(--tint);
  color: var(--color-header);
}

/* Neutral family — someone else's reporting */
.media-type--quoted {
  background-color: #ede9e5;
  color: #555;
}

.media-type--mentioned {
  background-color: transparent;
  color: #6b6560;
  box-shadow: inset 0 0 0 1px var(--color-border);
}

/* Key / legend */
.media-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 1.5rem 0 1.75rem 0;
  padding: 0;
}

.media-key__item {
  margin-bottom: 0;
}

.media-key__count {
  opacity: 0.65;
  font-weight: 500;
  margin-left: 0.15rem;
}

/* Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}

.media-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.1rem 1.2rem 1.2rem 1.2rem;
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-header);
  border-radius: 4px;
  text-decoration: none;
  color: var(--color-text);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.media-card:hover,
.media-card:focus-visible {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  border-color: var(--color-header);
  opacity: 1;
}

.media-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.media-card__outlet {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-header);
}

.media-card__date {
  font-size: 0.8rem;
  color: #6b6560;
  white-space: nowrap;
}

.media-card__title {
  font-family: 'Lora', serif;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--color-header);
  /* Push the type pill to the bottom so pills line up across a row. */
  flex-grow: 1;
}

.media-card:hover .media-card__title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.media-card__type {
  align-self: flex-start;
}

@media (max-width: 480px) {
  .media-grid {
    gap: 0.75rem;
  }

  .media-card {
    padding: 0.9rem 1rem 1rem 1rem;
  }

  .media-card__title {
    font-size: 1rem;
  }
}

/* ============================================================================
   Forms
   ============================================================================ */
form {
  display: grid;
  gap: 1rem;
  max-width: 500px;
}

.form-group {
  display: grid;
  grid-template-columns: 1fr 3fr;
  align-items: center;
  gap: 1rem;
}

.form-group-stacked {
  grid-template-columns: 1fr;
}

label {
  font-weight: 500;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-family: inherit;
}

button[type="submit"] {
  padding: 0.75rem 1.5rem;
  background-color: var(--color-header);
  color: var(--color-background);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

button[type="submit"]:hover {
  opacity: 0.9;
}

@media (max-width: 480px) {
  .form-group {
    grid-template-columns: 1fr;
  }
}
