@import url('https://fonts.googleapis.com/css2?family=Pirata+One&display=swap');

@font-face {
  font-family: 'Harry Potter';
  font-style: normal;
  font-weight: 400;
  src: local('Harry Potter'),
       local('Harry P'),
       url('fonts/harry-potter.woff') format('woff'),
       url('https://fonts.cdnfonts.com/s/25438/HARRP___.woff') format('woff');
  font-display: swap;
}

.fhf-shell,
.fhf-shell *,
.fhf-shell *::before,
.fhf-shell *::after {
  box-sizing: border-box;
}

.fhf-shell {
  container: fortunes / inline-size;
  position: relative;
  background-color: #f4eccf;
  background-image:
    /* Fine horizontal reed pith fibers */
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      rgba(110, 72, 30, 0.045) 1px,
      transparent 2px,
      transparent 5px
    ),
    /* Irregular horizontal reed strips (12-28px bands) */
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      rgba(130, 85, 35, 0.02) 11px,
      rgba(155, 105, 42, 0.055) 13px,
      transparent 16px,
      transparent 29px
    ),
    /* Fine vertical cross-woven fibers */
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      rgba(110, 72, 30, 0.04) 1px,
      transparent 2px,
      transparent 6px
    ),
    /* Irregular vertical reed bands */
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      rgba(140, 95, 40, 0.025) 15px,
      rgba(105, 68, 26, 0.06) 18px,
      transparent 21px,
      transparent 37px
    ),
    /* Organic brightness and press highlights */
    radial-gradient(ellipse 65% 45% at 25% 20%, rgba(255, 253, 242, 0.85), transparent 70%),
    radial-gradient(ellipse 75% 55% at 80% 80%, rgba(224, 192, 138, 0.35), transparent 80%),
    /* Aged diagonal tone */
    linear-gradient(135deg, rgba(165, 115, 50, 0.08) 0%, transparent 45%, rgba(125, 80, 30, 0.12) 100%),
    /* Aged perimeter vignette */
    radial-gradient(circle at 50% 50%, transparent 52%, rgba(115, 75, 28, 0.18) 100%);
  border: 1px solid rgba(125, 82, 38, 0.38);
  border-radius: 24px;
  box-shadow:
    inset 0 0 38px rgba(120, 80, 35, 0.16),
    inset 0 1px 1px rgba(255, 255, 255, 0.55),
    0 20px 45px rgba(25, 16, 8, 0.28);
  color: #3e2819;
  overflow: hidden;
  padding: clamp(1.4rem, 3.5vw, 2.4rem);
  margin-top: 1rem;
}

.fhf-form {
  display: grid;
  gap: 1.1rem;
}

.fhf-form[hidden] { display: none; }

/* Handoff Portrait: Inside top of shell with Pirata font, 2x2 grid, & instant badges */
.fhf-portrait {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-bottom: 1.5rem;
  width: 100%;
}

.fhf-pet-name {
  font-family: "Pirata One", Georgia, serif;
  font-size: clamp(3rem, 8vw, 4.8rem);
  font-weight: 400;
  line-height: 1.05;
  color: #4e3017;
  text-shadow: 1px 1px 0 rgba(255, 252, 240, 0.9), 0 2px 8px rgba(78, 48, 23, 0.12);
  text-align: center;
  letter-spacing: 0.02em;
  margin: 0 0 1.35rem;
  width: 100%;
  overflow-wrap: anywhere;
}

.fhf-pet-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 0 0 1.35rem;
  width: 100%;
}

.fhf-pet-details > div {
  padding: clamp(0.85rem, 2vw, 1.2rem);
  border: 1px solid rgba(125, 85, 42, 0.28);
  border-radius: 14px;
  background: rgba(255, 252, 242, 0.72);
  box-shadow: 0 2px 6px rgba(80, 50, 20, 0.06);
  backdrop-filter: blur(2px);
  overflow-wrap: anywhere;
}

.fhf-pet-details dt {
  color: #276957;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.fhf-pet-details dd {
  margin: 0;
  color: #3e2819;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.35;
}

.fhf-instant-context {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  margin: 0 0 1.25rem;
}

.fhf-instant-context span {
  background: rgba(39, 105, 87, 0.08);
  border: 1px solid rgba(39, 105, 87, 0.22);
  border-radius: 13px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  font-size: 0.84rem;
  padding: 0.85rem 1rem;
  color: #3e2819;
  box-shadow: 0 2px 6px rgba(39, 105, 87, 0.05);
}

.fhf-instant-context strong {
  color: #276957;
  font-family: Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.2;
}

.fhf-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.fhf-row > * {
  min-width: 0;
}

.fhf-species {
  border: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.fhf-radio-options {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.fhf-species legend,
.fhf-field {
  color: #4a3528;
  font-size: 1.25rem;
  font-weight: 750;
  margin-bottom: .35rem;
  width: 100%;
}

.fhf-species label {
  background: rgba(255, 255, 255, .55);
  border: 1px solid rgba(119, 83, 49, .2);
  border-radius: 999px;
  cursor: pointer;
  padding: .5rem .8rem;
  white-space: nowrap;
}

.fhf-species input {
  accent-color: #276957;
}

.fhf-field {
  display: grid;
  gap: .35rem;
  min-width: 0;
}

.fhf-field input {
  background: #fffaf2;
  border: 1px solid rgba(119, 83, 49, .3);
  border-radius: 12px;
  color: #4a3528;
  font-size: 1rem;
  max-width: 100%;
  min-width: 0;
  padding: .65rem .75rem;
  width: 100%;
}

.fhf-field input[type="date"] {
  padding: .6rem .5rem;
}

.fhf-field span {
  color: rgba(74, 53, 40, .72);
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.35;
}

/* Autocomplete Container & Items */
.fhf-autocomplete-wrap {
  position: relative;
  width: 100%;
}

.fhf-autocomplete-list {
  background: #fffaf2;
  border: 1px solid rgba(119, 83, 49, .35);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
  list-style: none;
  max-height: 240px;
  margin: .4rem 0 0;
  overflow-y: auto;
  padding: .4rem 0;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 1000;
}

.fhf-autocomplete-list[hidden] {
  display: none;
}

.fhf-autocomplete-item {
  color: #4a3528;
  cursor: pointer;
  font-size: .95rem;
  padding: .65rem 1rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.fhf-autocomplete-item:hover,
.fhf-autocomplete-item.is-selected {
  background: rgba(39, 105, 87, .15);
  color: #276957;
  font-weight: 700;
}

.fhf-autocomplete-item strong {
  color: #276957;
  text-decoration: underline;
}

.fhf-button {
  background: linear-gradient(135deg, #227323, #276957);
  border: 0;
  border-radius: 999px;
  color: white;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 750;
  margin-top: .4rem;
  min-height: 52px;
  padding: .9rem 1.4rem;
}

.fhf-button:disabled {
  cursor: wait;
  opacity: .7;
}

.fhf-fine {
	text-align: center;
  color: rgba(74, 53, 40, .75);
  font-size: .84rem;
  margin-top: .35rem;
  margin-bottom: 0;
  text-align: center;
}

/* Progress bar & status updates */
.fhf-status {
  min-height: 0;
}

.fhf-status:empty {
  display: none;
}

.fhf-progress-wrap {
  margin-top: 1.25rem;
  text-align: center;
}

.fhf-progress-bar {
  background: rgba(119, 83, 49, 0.15);
  border: 1px solid rgba(119, 83, 49, 0.25);
  border-radius: 999px;
  height: 14px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.fhf-progress-fill {
  background: linear-gradient(90deg, #276957, #8bc9b2);
  border-radius: 999px;
  height: 100%;
  transition: width 0.4s ease-out;
  width: 0%;
}

.fhf-status-text {
  color: #276957;
  font-size: 0.95rem;
  font-weight: 750;
  margin-top: 0.85rem;
  text-align: center;
}

.fhf-status-error {
  color: #842f2f;
  font-weight: 700;
  margin-top: .75rem;
  text-align: center;
}

/* AI Failure: Hazy Error & Countdown */
.fhf-hazy-wrap {
  text-align: center;
  margin: 1.75rem auto 1.25rem;
  padding: 1.75rem 1.25rem;
  max-width: 580px;
  background: rgba(255, 252, 242, 0.88);
  border: 1px solid rgba(119, 83, 49, 0.28);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(80, 50, 20, 0.08);
  backdrop-filter: blur(2px);
}

.fhf-hazy-title {
  font-family: "Harry Potter", "Pirata One", Georgia, serif;
  font-size: clamp(2.3rem, 6vw, 3.4rem);
  font-weight: 400;
  line-height: 1.15;
  color: #4e3017;
  text-shadow: 1px 1px 0 rgba(255, 252, 240, 0.9), 0 2px 8px rgba(78, 48, 23, 0.12);
  letter-spacing: 0.04em;
  margin: 0 0 1.25rem;
  text-align: center;
}

.fhf-hazy-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.fhf-hazy-retry {
  display: inline-block;
  min-width: 180px;
}

.fhf-hazy-retry:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.fhf-hazy-sub {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
}

.fhf-link-action {
  background: none;
  border: none;
  color: #7b512c;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
  font-family: inherit;
  transition: color 0.15s ease;
}

.fhf-link-action:hover {
  color: #4e3017;
}

.fhf-results[hidden] {
  display: none;
}

/* Fortune Reading Results */
.fhf-reading {
  border-top: 1px solid rgba(119, 83, 49, .22);
  margin-top: 2.75rem;
  padding-top: 2.75rem;
}

.fhf-portrait ~ .fhf-results .fhf-reading {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.fhf-kicker,
.fhf-position {
  color: #276957;
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.fhf-reading h3 {
  font-family: Georgia, serif;
  font-size: 2.1rem;
  margin: .5rem 0 1.75rem;
}

.fhf-context {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0 0 2rem;
}

.fhf-context span {
  background: rgba(39, 105, 87, .09);
  border: 1px solid rgba(39, 105, 87, .16);
  border-radius: 13px;
  display: grid;
  gap: .3rem;
  font-size: .82rem;
  padding: .9rem 1.1rem;
}

.fhf-context strong {
  color: #276957;
  font-family: Georgia, serif;
  font-size: 1.1rem;
}

.fhf-grid {
  display: grid;
  gap: 1.6rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fhf-card {
  background: rgba(255, 255, 255, .52);
  border: 1px solid rgba(119, 83, 49, .18);
  border-radius: 18px;
  padding: 1.35rem;
}

/* Full Card Visibility - 2:3 aspect ratio, unrounded edges, no cropping */
.fhf-image-frame {
  aspect-ratio: 2 / 3;
  background: transparent;
  border-radius: 0;
  margin: 1.25rem 0;
  overflow: visible;
}

.fhf-tarot-image {
  border-radius: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .24);
  display: block;
  height: 100%;
  object-fit: contain;
  transition: transform .3s ease;
  width: 100%;
}

.fhf-tarot-image.is-reversed {
  transform: rotate(180deg);
}

.fhf-orientation {
  background: rgba(39, 105, 87, .12);
  border-radius: 999px;
  display: inline-block;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  margin-top: .6rem;
  margin-bottom: .85rem;
  padding: .35rem .65rem;
  text-transform: uppercase;
}

.fhf-notice {
  background: rgba(152, 101, 54, .12);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  padding: .9rem 1.1rem;
}

.fhf-story {
  background: rgba(255, 255, 255, .5);
  border: 1px solid rgba(119, 83, 49, .18);
  border-radius: 18px;
  margin-top: 2.5rem;
  padding: 1.75rem;
}

.fhf-story h4 {
  color: #276957;
  font-family: Georgia, serif;
  font-size: 1.3rem;
  margin: 1.5rem 0 .65rem;
}

.fhf-story h4:first-child {
  margin-top: 0;
}

.fhf-card h4 {
  font-family: Georgia, serif;
  font-size: 1.25rem;
  margin: 0 0 .5rem;
}

.fhf-card p {
  font-size: .94rem;
  line-height: 1.6;
  margin: .65rem 0 0;
}

@media (max-width: 900px) {
  .fhf-context,
  .fhf-instant-context {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .fhf-shell { border-radius: 18px; padding: 1.15rem; }
  .fhf-grid,
  .fhf-context,
  .fhf-instant-context {
    grid-template-columns: 1fr;
  }
  .fhf-radio-options { align-items: stretch; }
  .fhf-species label { flex: 1 1 auto; text-align: center; white-space: normal; }
  .fhf-reading { margin-top: 2rem; padding-top: 2rem; }
  .fhf-reading h3 { font-size: 1.7rem; overflow-wrap: anywhere; }
  .fhf-card,
  .fhf-story { padding: 1rem; }
}

@media (max-width: 480px) {
  .fhf-pet-details {
    grid-template-columns: 1fr;
  }
}

/* Respond to the module width, including the homepage's desktop split. */
@container fortunes (max-width: 600px) {
  .fhf-context,
  .fhf-instant-context,
  .fhf-grid { grid-template-columns: minmax(0, 1fr); }
  .fhf-species label { white-space: normal; min-height: 44px; }
  .fhf-card, .fhf-story { padding: 1rem; }
  .fhf-reading h3 { font-size: 1.7rem; overflow-wrap: anywhere; }
}

/* Keep the two field pairs together wherever the form has room. */
@container fortunes (max-width: 440px) {
  .fhf-row { grid-template-columns: minmax(0, 1fr); }
  .fhf-pet-details { grid-template-columns: minmax(0, 1fr); }
}

/* Quiet, text-first local activity suggestions beneath the reading. */
.fhf-activities { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(125,82,38,.22); }
.fhf-activity-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.fhf-activity-card { display: flex; flex-direction: column; padding: 1.25rem; border: 1px solid rgba(125,82,38,.22); border-radius: 14px; background: rgba(255,255,255,.22); }
.fhf-activity-card h4 { margin: 0 0 .65rem; }
.fhf-activity-card p { margin: 0 0 1rem; }
.fhf-activity-card a { margin-top: auto; text-underline-offset: .2em; }
.fhf-activity-card a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.fhf-activity-note { font-size: .8rem; opacity: .8; }
@media (max-width: 760px) { .fhf-activity-grid { grid-template-columns: 1fr; } }
