/* Global CSS for pages */

html {
    /* Adwaita colors */
    --bg-color: #fafafb;
    --fg-color: rgba(0, 0, 6, 0.8);
    --base-color: #fff;
    --text-color: #000;
    --borders: #d3d7cf;
    --icon-invert: 0.2; /* average(0x2e, 0x34, 0x36) / 0xff */

    /* Misc colors */
    --header-color: #999;
    --header-text-color: white;
    --row-hover-color: rgba(0, 0, 0, .1);

    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    html {
        /* Adwaita colors */
        --bg-color: #222226;
        --fg-color: #fff;
        --base-color: rgba(255, 255, 255, 0.08);
        --text-color: #fff;
        --borders: #1b1b1b;
        --icon-invert: 0.93; /* average(0xee, 0xee, 0xec) / 0xff */

        /* Misc colors */
        --header-color: #666;
        --row-hover-color: rgba(255, 255, 255, .1);
    }
}

html,
body {
    margin: 0;
    padding: 0;
}

html {
    font-family: -webkit-system-font;
    font-size: 11pt;
    color: var(--fg-color);
    background-color: var(--bg-color);
}

h1 {
    font-size: 20pt;
    font-weight: 800;
    margin-bottom: 0;
}

/* about: */

#about-app {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog {
    padding: 12px;
    text-align: center;
}

@media (min-width: 550px) {
    .dialog {
        padding: 36px 42px;
        background-color: var(--base-color);
        border-radius: 12px;
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03),
                    0 1px 3px 1px rgba(0, 0, 0, 0.07),
                    0 2px 6px 2px rgba(0, 0, 0, 0.03);
    }
}

.properties {
    margin: auto;
}

.prop-label {
    color: #999;
}

#about-title {
    font-weight: 800;
}

#about-subtitle {
    opacity: 0.55; /* Adwaita's dim-label */
}

#about-icon {
    filter: drop-shadow(0 1px 12px rgba(0, 0, 0, 0.05))
            drop-shadow(0 -1px rgba(0, 0, 0, 0.05))
            drop-shadow(1px 0 rgba(0, 0, 0, 0.1))
            drop-shadow(0 1px rgba(0, 0, 0, 0.3))
            drop-shadow(-1px 0 rgba(0, 0, 0, 0.1));
}

/* about:epiphany */

html.epiphany-html {
    background-color: #3465a4;
    background-image: none;
}

.epiphany-body {
    color: #eeeeec;
    max-width: 40em;
    margin: 2em auto;
}

#ephytext {
    margin-top: 15%;
    font-size: 1.5em;
    text-align: center;
}

#from {
    margin-top: 1em;
    font-size: 1.5em;
    text-align: right;
    font-weight: bold;
}

/* about:memory */

#memory {
  margin: 20px;
}

#memory h2 {
  margin: 2rem 0 0;
}

.memory-table {
    width: 100%;
    margin: 0 0 0.9em 0;
    font-size: 11px;
    text-align: left;
    border-collapse: collapse;
}

.memory-table caption {
    margin: 1rem 0;
    font-size: 1rem;
    font-weight: bold;
    color: var(--fg-color);
}

@media (min-width: 600px) {
    .memory-table {
        width: 80%;
        margin: 0 12.5% 0.9em 12.5%;
        font-size: 1rem;
    }
    .memory-table caption {
        font-size: 1.2rem;
    }
}

.memory-table th {
    padding: 4px;
    background: var(--header-color);
    border: 2px solid var(--header-color);
    color: var(--header-text-color);
}

.memory-table td {
    padding: 2px;
    border-bottom: 1px solid var(--borders);
    color: var(--fg-color);
    border-top: 1px solid transparent;
    width: 16%;
}

.memory-table tr:hover td {
    background: var(--row-hover-color);
    color: var(--fg-color);
}


/* about:applications */

.suggested-action {
    color: white;
    background-color: #3584e4;
    border: none;
    border-radius: 5px;
}

.suggested-action:hover,
.suggested-action:focus,
.suggested-action:active,
.suggested-action.active {
    color: white;
    background-color: #3987e5;
}

.destructive-action {
    color: white;
    background-color: #e01b24;
    border: none;
    border-radius: 5px;
}

.destructive-action:hover,
.destructive-action:focus,
.destructive-action:active,
.destructive-action.active {
    color: white;
    background-color: #e41c26;
}

#applications {
    margin: 20px;
}

.applications-body table { width: 100%; border-collapse: collapse; }

.applications-body table, td { 
    border: 1px solid var(--borders);
    border-left: none; border-right: none;
}

.applications-body p { margin-bottom: 24px; }
.applications-body td { padding: 12px;}
.applications-body td.icon { width: 64px; padding-left:0; padding-right:0; }
.applications-body td.datas { width: 200px; }
.applications-body td.input { width: 64px; padding-left:0; padding-right:0; }
.applications-body td.date { width: auto; text-align: right; font-size: small; }
.applications-body .appname { font-weight: bold; }
.applications-body .appurl, td.date { opacity: 0.55; /* Adwaita's dim-label */ }
.applications-body .suggested-action { width: auto; padding: 10px;  margin-right: 6px;}
.applications-body .destructive-action { width: auto; padding: 10px; }
.applications-body .appurl, .applications-body .appurl { overflow-wrap: anywhere;}

@media only screen and (max-width : 600px) { 
    .applications-body td.date { display:none; }
    .applications-body .appurl, .applications-body .appurl { white-space: nowrap;overflow: hidden;text-overflow: ellipsis; max-width: 256px;}
}

@media only screen and (max-width : 400px) { 
    .applications-body td.date { display:none; }
    .applications-body .appurl, .applications-body .appurl { white-space: nowrap;overflow: hidden;text-overflow: ellipsis; max-width: 120px;}
}

@media only screen and (max-width : 360px) { 
    .applications-body .appname { white-space: nowrap;overflow: hidden;text-overflow: ellipsis; max-width: 120px;}
}

/* about:incognito */

.incognito-body {
    box-sizing:border-box;
    display:flex;
    flex-direction: column;
    justify-content: center;
    max-width:40em;
    margin: 30px auto 60px;
    padding-left: 12px;
    padding-right: 12px;
    text-align:block;
    line-height: 1.5;
}

.incognito-body h1 {
    text-align:center;
}

.incognito-body-image {
    margin:auto;
    display:block;
    filter: brightness(0) invert(var(--icon-invert));
    opacity: 0.5;
}

/* about:overview */

#overview {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#most-visited-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    grid-gap: 9px;
    margin: 6px;
}

@media (min-width: 500px) {
    #most-visited-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        grid-gap: 18px;
        margin: 18px;
        width: 800px;
    }
}

.overview-item {
    position: relative;
    outline: 0;
    transition: 0;
    text-align: center;
    text-decoration: none;
}

/* Hide 9th item on narrow widths to avoid uneven number */
.overview-item:last-child {
    display: none;
}

@media (min-width: 672px) {
    .overview-item:last-child {
        display: block;
    }
}

.overview-title {
    margin: 10px 6px;
    padding-bottom: 2px;
    display: inherit;
    white-space: nowrap;
    overflow: hidden;
    font-family: -webkit-system-font;
    font-size: 11pt;
    color: var(--fg-color);
    text-overflow: ellipsis;
    text-align: center;
}

/* Note: this CSS is adjusted from Ephy.Overview.Item.setThumbnailPath()
 * in overview.js.
 */
.overview-thumbnail {
    height: 160px;
    display: block;
    background: url(ephy-resource:///org/gnome/epiphany/page-icons/web-watermark.svg) center no-repeat, var(--base-color);
    background-repeat: no-repeat;
    border-radius: 12px;
    border-color: 1px solid transparent;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03),
                0 1px 3px 1px rgba(0, 0, 0, 0.07);
    transition: transform 150ms ease, box-shadow 150ms ease;
}

/* In order to preserve a wide aspect ratio as the layout changes, we need to reduce the height */
@media (min-width: 341px) {
    .overview-thumbnail {
        height: 120px;
    }
}

/* After this point we can go back to the regular height */
@media (min-width: 450px) {
    .overview-thumbnail {
        height: 160px;
    }
}

.overview-thumbnail:hover,
:focus .overview-thumbnail {
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07),
                0 1px 3px 1px rgba(0, 0, 0, 0.11),
                0 2px 6px 2px rgba(0, 0, 0, 0.07);
}

.overview-thumbnail:active {
    box-shadow: inset 0 1px 1px 0 rgba(0,0,0,0.07),
                inset 0 1px 2px 1px rgba(0,0,0,0.11);
}

.overview-close-button {
    -webkit-transition: all 250ms;
    position: absolute;
    top: 9px;
    right: 9px;
    opacity: 1;
    z-index: 5;
    color: #888;
    width: 24px;
    height: 24px;
    background: url(ephy-resource:///org/gnome/epiphany/page-icons/overview-remove-item.svg) center no-repeat, rgba(80,80,80,.3);
    border-radius: 50%;
}

.overview-close-button:hover {
    background: url(ephy-resource:///org/gnome/epiphany/page-icons/overview-remove-item.svg) center no-repeat, rgba(0,0,0,.8);
}

.overview-close-button:active {
    text-shadow: none;
    background-color: #000;
}

.overview-item:hover {
    opacity: 1;
}

.overview-removed.overview-item {
    transition: all 0.25s ease-out;  /* This value needs to be synced with the timeout in overview.js */
    transform: scale(0.5);
    opacity: 0;
}

.overview-removed .overview-close-button {
    display: none;
}

html[dir="rtl"] .overview-close-button {
    left: 20px;
    right: inherit;
}

html[dir="rtl"] .overview-item {
    float: right;
}

.overview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    height: 80%;
    max-width: 800px;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.overview-empty p {
    text-align: center;
}

.overview-empty img {
    -webkit-user-select: none;
    -webkit-user-drag: none;
    opacity: 0.5;
    width: 128px;
    filter: brightness(0) invert(var(--icon-invert));
}
