/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

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

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
  (-webkit-min-device-pixel-ratio: 1.25),
  (min-resolution: 1.25dppx),
  (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}

/* Pulls the h2 closer to the h1 below it */
.container h2 {
    margin-bottom: 0px;
}

/* Removes the gap above the h1, and reduces the gap below it */
.container h1 {
    margin-top: 5px;
    margin-bottom: 5px;
}

/* Modifies your existing .date rule to pull it closer to the h1 */
.date {
    margin-top: 5px;
    /* Keep your other .date properties like font-size and color here! */
}

body {
    font-family: Arial, sans-serif;
    text-align: center;
    color: #333;
    padding: 20px;

    /* New Background Image Properties */
    background-image: url("../img/wedding_background.jpg");
    background-size: cover;
    background-position: center;
    min-height: 100vh; /* Adds forced height */
    margin: 0; /* Removes default white borders */
    background-repeat: no-repeat;
}

.container {
    max-width: 600px;
    margin: 40px auto;

    /* 1. Force the box to be at least 600 pixels tall */
    min-height: 600px;

    /* 2. Center the text vertically inside the taller box */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;

    /* Your background and overlay settings */
    background-image: linear-gradient(rgba(255, 255, 255, 0.40), rgba(255, 255, 255, 0.40)), url("../img/jason_nina.jpg");
    background-size: cover;
    background-position: center;

    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);

    /* 3. Hide the container before the envelope opens */
    opacity: 0;
}

h1 {
    color: #2c3e50;
    font-size: 2.5em;
    font-weight: bold;
}

h11 {
    color: #2c3e50;
    font-size: 2em;
}


.date {
    font-size: 1.5em;
    font-weight: bold;
    color: #2c3e50;
}

.location {
    font-size: 1.2em;
    margin-bottom: 30px;
    color: #7f8c8d;
}

.invitation {
    font-size: 1.2em;
    margin-bottom: 30px;
    color: #2c3e50;
}

form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}

label {
    font-weight: bold;
    font-size: 0.9em;
}

input, select, button {
    padding: 12px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 6px;
}

button {
    background-color: #2c3e50;
    color: white;
    cursor: pointer;
    border: none;
    font-weight: bold;
}

button:hover {
    background-color: #1a252f;
}

.button-link {
    display: inline-block;
    background-color: #2c3e50;
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: bold;
    margin-top: 20px;
}

.button-link:hover {
    background-color: #1a252f;
}

@media only screen and (max-width: 768px) {
    body {
        /* This overrides the main image only on small screens */
        background-image: url("../img/wedding_background_mobile.jpg");
    }
}

/* --- The Letter Animation Trigger --- */
.container.reveal {
    animation: fadeSlideUp 1.2s ease-out forwards;
}

/* --- The Envelope Scene --- */
.envelope-scene {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    background-color: rgba(0, 0, 0, 0.4);
    transition: opacity 0.8s ease, visibility 0.8s;
}

.envelope {
    position: relative;
    width: 300px;
    height: 220px;
    background-color: #d1d8e0;
    border-radius: 8px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    transition: transform 0.8s ease;
}

/* Creates the front pockets using CSS borders */
.envelope-front {
    position: absolute;
    bottom: 0; left: 0; width: 0; height: 0;
    border-left: 150px solid #bdc3c7;
    border-right: 150px solid #bdc3c7;
    border-bottom: 120px solid #a6acb2;
    border-top: 100px solid transparent;
    z-index: 3;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

/* Creates the top flap */
.envelope-flap {
    position: absolute;
    top: 0; left: 0; width: 0; height: 0;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-top: 120px solid #ecf0f1;
    z-index: 4;
    transform-origin: top;
    transition: transform 0.6s ease-in-out;
}

/* The Red Wax Stamp */
.red-stamp {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background-color: #c0392b;
    border-radius: 50%;
    z-index: 5;
    cursor: pointer;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2), 0 4px 6px rgba(0,0,0,0.3);
    border: 2px solid #e74c3c;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 0.8em;
    letter-spacing: 1px;
    transition: transform 0.3s ease;
}

.red-stamp:hover {
    transform: translateX(-50%) scale(1.1);
    background-color: #e74c3c;
}

/* --- Javascript Triggered Animations --- */

/* 1. Rotates the flap upwards */
.envelope-scene.is-opening .envelope-flap {
    transform: rotateX(180deg);
    z-index: 1;
}

.envelope-scene.is-opening .red-stamp {
    opacity: 0;
}

/* 2. Fades out the entire envelope scene */
.envelope-scene.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.envelope-scene.is-hidden .envelope {
    transform: scale(0.8) translateY(100px);
}

/* The Animation Engine */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* The Trigger (You should already have this) */
.container.reveal {
    animation: fadeSlideUp 1.2s ease-out forwards;
}
